AE environment variable substitution

The AE functionality supports a general Unix shell-like environment variable substitution of the form %{key_name}. Note that the % (percent sign) is used instead of the $ (dollar sign). This distinction exists because the use of the dollar sign conflicts with shell script substitution in Linux scripts written to call nzudxcompile or register_ae. AE substitution happens at query runtime, not during registration.

An example text file called text1.txt contains the following environment entries.

TESTVAR1=VALUE1
TESTVAR2=VALUE2
TESTVAR3=VALUE3

Given the following environment variable assignments:

NZAE_INCLUDE_BEFORE_1=/nz/export/.../test1.txt
SUBTEST=%{TESTVAR1}
The value of SUBTEST at runtime is VALUE1
SUBTEST=VALUE1

The substitution process looks first for AE environment variables, then at AE system predefined environment variables, and then at Linux OS process variables.

The AE system predefined environment variables consist of the following:

Table 1. Predefined environment variables
Environment variable Definition
NZAE_RUNTIME_SESSION_ID Session ID of the current request
NZAE_RUNTIME_DATA_SLICE_ID Data slice ID of the current request
NZAE_RUNTIME_TRANSACTION_ID Transaction ID of the current request
NZ_TMP_DIR Location of the NPS temporary directory on the current machine

Example

MY_SESSIONID=%{NZAE_RUNTIME_SESSION_ID}

Assuming the session has an ID of 14776, the result after substitution is MY_SESSIONID=14776. If a variable name cannot be resolved, an error condition occurs. However, you can specify a default value to use if a variable is not found so that no error occurs.

For example:

%{VAR_NAME:default value}

In the above example, if VAR_NAME is not found, the expression evaluates to the value "default value". The first colon marks the end of the variable name and the beginning of the default value. White space around the colon becomes part of the variable name or default value. No variable substitution is performed on the default value itself.