# Introduction to Environment Variables

Read Time: 8 minute(s)

# 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.


export variable=value
echo $variable

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

Variables are usually configured in the .profile/.bash_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:

ok = PUTENV(envar=x)
ok = 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 number 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 number 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.

All jBASE programs execute in the same process unless explicitly executed via the @IM**:"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)
LIBPATH pathnames of system libraries (AIX)
LANG language type (UNIX only)
JBASE_LOCALE setting to determine collation sequences for internationalization and secondary indexes
JBASE_TIMEZONE setting to determine the timezone to use for UTF8 timestamp conversion into local time for display
JBASE_DATE_FORMAT specifies the format of how dates are converted to/from internal and external date representations
TZ timezone (UNIX)
LC_ALL will override a specified list of locale settings (UNIX)
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
JBASE_DYNAMIC_MULTISESSION Dynamically allocates multi-session licenses when set to 1

# Additional jBASE Environment Variables

# Execution

JBASE_ERRMSG_TRACE Controls whether or not to log jBASE messages to the $JBCRELEASEDIR/tmp/jbase_error_trace file.
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 the divisor of an arithmetic division is zero
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
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 be executed after off (Linux/AIX)
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.
JBCCALLDEPTH Set the stack size for a CALL
JBC_LOG_SIZE Set the maximum size of the jBASE error log

# 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
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
JBC_INCLUDE_FILE a list of source code files that will automatically be compiled prior to compiling the current program.
JBC_INCLUDE_PATH a list of directories the compiler searches through when an INCLUDE statement is seen in a program.
DECATALOG_DELETE_OBJECT_CODE Delete the intermediate compiled object file when the program (or subroutine) is DECATALOG'd.
JELF Enable Single Shared Object builds in jBASE BASIC and other related options

# 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_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.
JDIAG Turns on internal verbose messaging. Index detail is an example
JFILESAVE_DEVICE Used with the JFILESAVE command, defines the full path to where system backups are stored.
JFILESAVE_STATFILE Used with the JFILESAVE command, it defines the full path to where backup statistics are stored.

# 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)
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


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

For example, to create all files from a jbackup to JP (jPlus) files and as Case Insensitive, set the following environment variable before doing the jrestore. Note the use of double-quotes on UNIX when there is more than one setting.


# 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

Back to Knowledgebase