Environment Variables


jBASE uses a number of environment variables to modify jBASE behavior. Suitable defaults apply to most of them. Although most environment variables can be set any time, the best place to do so is in the .profile script.
 

SETTING/GETTING

Windows

set variable=value
echo %variable%

Variables can be configured in the System environment for all users, and/or on a per user basis via the user environment. Additional variables for jBASE can also be added to the current user configuration in the Windows registry.

Windows variables are usually configured in the System Properties panel.

UNIX

variable=value
export variable
echo $variable

This works for all shells, although some shells (i.e. ksh) allow "export variable=value".

Variables are usually configured in the .profile of the user login directory.  Global variables can be added to the "/etc/profile" script.
 

jBASE PROGRAMS

The jBC functions PUTENV and GETENV can be used to manipulate environment variables. For example:

SUCCESS = PUTENV(envar=x)
SUCCESS = GETENV(envar)


jBASE INITIALIZATION

Some environment variables can only be set before jBASE initialization. jBASE initialization occurs when the first jBASE program is executed on a particular "PORT number".

The jBASE initialization process reads through the environment entries looking for possible variables required by jBASE. This process provides a substantial performance improvement as the state of these environment variables are saved for subsequent jBASE executions. These states continue to be valid as long as the "PORT" is still attached to a process. Some environment variables can be changed by subsequent program execution. The state of these variables are imported back into the state table after program execution.

Certain jBASE programs expect jBASE initialization to have been previously performed otherwise re-initialization will occur and resources expected by the executing program will have been removed.

For instance:

T-ATT requires a "PORT" against which it saves the tape device assignment.
SP-ASSIGN requires a "PORT" with which to save assignment status for print jobs.
READNEXT in a program after SELECT/GET-LIST.

With jBASE 4.1 all programs execute in the same process unless explicitly executed via the CHAR(255):'k' construct.
 

INITIAL ENVIRONMENT VARIABLES

PATH pathnames of executables
HOME pathname of user home directory. Many defaults rely on this environment variable
LD_LIBRARY_PATH pathnames of system libraries (Linux, Solaris only)
LIBPATH pathnames of system libraries (AIX only)
SHLIB_PATH pathnames of system libraries (HPUX only)
LANG language type (Unix only)
JBASE_LOCALE setting to determine collation sequences for internationalization and secondary indexes (jBASE 4.1 and above)
LC_ALL Locale (Unix only)
TZ Timezone (Unix only)
TERM specifies terminal type as per terminfo database
TERMINFO Specifies directory for terminal settings
JBCPORTNO forced Port number for use by user; automatically allocated unless this is set
JBCLOGNAME user name to use in-place of login id
JBCGLOBALDIR pathname of jBASE global configuration directory
JBCRELEASEDIR pathname of jBASE release directory
JBCDATADIR pathname of any configured databases and default directory for the jBASE spooler
JBCEMULATE emulation to be used for this user
JEDIFILEPATH directory Paths of application files location
JEDIFILENAME_MD pathname of file to be used for Master Dictionary entries
JEDIFILENAME_SYSTEM pathname of file to be used for SYSTEM entries

 

ADDITIONAL jBASE ENVIRONMENT VARIABLES.

EXECUTION

JBASE_ERRMSG_ZERO_USED Controls the behavior of jBC programs when an uninitialized variable is encountered
JBASE_ERRMSG_NON_NUMERIC Controls the behavior of jBC programs when a numeric operation on a non-numeric variable is encountered
JBASE_ERRMSG_DIVIDE_ZERO Controls the behavior of jBC programs when a the divisor of an arithmetic division results in a zero
JBCBACKGROUND set to 1 to run "PORT" as background task
JEDIENABLEQ2Q set to 1 to force detection of Qptr to Qptr
JEDI_DISTRIB_DEFOPEN set to 1 to defer OPENs of distributed file parts
JEDI_SECURE_LEVEL set security level for j3 and jPLUS files
Level 1. No flush
Level 2. Flush on link modification (default)
Level 3. Flush after update (network failure)
JEDI_INDEX_MMAP_ON set to force use of memory mapping on indexes when updating memory mapped files
JEDI_AIX_FILE_MMAP_ON set to force use of memory mapping of j4 files on AIX multi-processor machines
JEDI_AIX_OBJECT_MMAP_ON set to force use of memory mapping of .el files on AIX multi-processor machines
JEDI_OBJECT_MMAP_OFF turn off memory mapping of .el files
JBC_TCLRESTART set to command to execute instead of shell
JBC_ENDRESTART set to command to execute after end from debugger
JBCRESTARTPROG set to command to execute after off (unix/Linux only)
JBCOBJECTLIST set to alternate path(s) for user subroutine libraries
Windows - %home%\lib
Unix - $HOME/lib
JBC_BLOCK_SYSTEM14 set to 1 to force a 100 millisecond delay on SYSTEM(14) calls.
JBASE_WIN_TERM_SERVER This should be set on servers running Windows Terminal Server before starting the License Server, and for all sessions required to access jBASE licenses.

Note:

The functionality provided by JBASE_WARNLEVEL on 3.x has been implemented in a different fashion on Release 4. This was a design decision to make the behavior of the runtime more flexible and consistent at the same time. Instead of a global setting handling all conditions, there are now settings for individual error messages according to a bit mask. 

For example, we are all familiar with the well-known error message: Non-numeric value -- ZERO USED. If you set (or export) JBASE_ERRMSG_NON_NUMERIC=3, you will not get this error message and the program will not drop into the debugger. 

Other handy environment variables are:

JBASE_ERRMSG_ZERO_USED to handle the condition where a BASIC program encounters an unassigned variable and JBASE_ERRMSG_DIVIDE_ZERO to handle the condition where a BASIC program encounters a zero divisor.

The bit masks available for these environment variables are as follows: 

      1 - Don't print the error message
      2 - Don't enter the debugger
    16 - Caller to place "0" in the target variable after operation
    32 - Caller to place "" in the target variable after operation
   128 - Caller to leave target variable alone after operation
   256 - Caller to place source variable in the target variable after operation

DEVELOPMENT

JBCDEV_BIN set to alternate path to catalog executables.
Windows - %home%\bin
Unix - $HOME/bin
JBCDEV_LIB set to alternate path to catalog libraries.
Windows - %home%\lib
Unix - $HOME/bin
JBC_COMPILER_COUNT limits the number of concurrent executions of cc on Unix platforms
JBCTTYNAME specify alternate tty name for output. (Unix only)
JDIAG provides a variable amount of trace information
LIB specify additional paths for linking with libraries. (Windows only)
INCLUDE specify additional paths for header files

 

MISCELLANEOUS

JBASEUNIQUE specify alternate jBASE work file
JBCERRFILE specify alternate error message file
JBCSPOOLERDIR specify alternate spooler directory
JBCSPOOLER_JOBRESET controls how the print job counter is reset
JBC_DESPOOLSLEEP specify the interval for despoolers to check for queued jobs
JBC_CRREQ controls linefeeds, formfeeds and carriage returns in print jobs
JBC_INVERT_ALPHA_CHARS set to 1 to invert the case of alphabetic characters entered with INPUT.
JBC_OLD_SP_EDIT specifies the alternative SP-EDIT format
JBCLISTFILE specify alternate select list file
JBCLISTID force user account name to be part stored list ids.

 

TERMINAL

JBCECHO set to 1 to force echo on
JBCSCREEN_DEPTH specify alternate terminal depth (valid only on jBASE 3.x)
JBCSCREEN_WIDTH specify alternate terminal width (valid only on jBASE 3.x)
JBCPRINTER_DEPTH specify alternate printer depth (valid only on jBASE 3.x)
JBCPRINTER_WIDTH specify alternate printer width (valid only on jBASE 3.x)
JBCFLUSH_STDOUT set to 1 to force flushing output
JBCPRISM set hard coded prism sequences (Windows only)
JBC_STDERR set to 1 to redirect standard error to standard out. Useful for CAPTUREing output that would normally be sent to the screen.
JBCCREATEFLAGS set to 0, 1, 2 for output redirection. (Windows only)
0 Direct to current console (default)
1 Direct to new console
2 Detached for no console

 

EMBEDDED SQL

JBC_SQLLIBS set alternate SQL libraries for embedded SQL
JBC_SQLPREPROC set alternate SQL pre-compiler command
JBC_SQLFIXEDLEN set to use fixed length types for char input strings

 

QUERIES

JBCDEFDICTS specify alternate default dictionary files

 

CREATE-FILE

JEDI_PREFILEOP parameters take precedence before command line
JEDI_POSTFILEOP parameters take precedence after command line

e.g. To convert all files on "jbackup" tape to J4 files set the following environment variable be using jrestore.
export JEDI_PREFILEOP=TYPE=J4 (Unix) Can use quotes to surround multiple parameters
set JEDI_PREFILEOP=TYPE=J4 (NT) Don't use quotes

 

JRFS

JBCNETACCESS specify the location of the jRFS security access file
JBCNETDIR specify the location of the jRFS configuration files
JRFS_REMOTE_JQL set to 1 to allow jQL to be executed remotely
JRFS_LOCALPATH_JQL set to 1 to allow remote pointer to have a different name than the remote file
JRFS_SERVERNAME allows the jRFS client to override the service port
JRFS_HOSTNAME allows the jRFS client to override the target host

Porting