Parameter Passing

The format used to write parameters to the parameter file is defined in the program type window. The parameter file can be referenced in scripts using the par and so_par environment variables.

The format used to write prompts to the parameter (pr) file is defined in the Program Type window shown below. However, the actual passing of the parameters is accomplished within the program type script.

The SQLP program type

Different applications demand parameters to be passed in different ways.

ONELINE

The Applications Manager script ONELINE, located in the exec directory, can be executed with the par environment variable as an argument to convert each of the prompt entries in the parameter file to entries on one single line separated by spaces (see the AWEXECS program type script). The code used to execute ONELINE is shown below.

UNIX:

arg="$program `$AW_HOME/exec/ONELINE $par`"
eval $arg

Windows:

call %SQLOPER_HOME%\bin\oneline %SQLOPER_HOME%\run\%par%

This executes identically to programs running on the command line. The output of the ONELINE script may then be used as the arguments to be passed to the application to be run. The application may demand that specific environment variables have values, and these values may need to be set by parsing the parameter file within the program type script.

For example, assume the parameter file contains the following four values:

Jan

Feb

Mar

Apr

When arg is evaluated, the code would look like this:

UNIX:

$program Jan Feb Mar Apr

Windows:

%program% Jan Feb Mar Apr

par vs. so_par

The ONELINE program can be used with the par or so_par environment variables. par holds only the name of the parameter file. so_par is the fully pathed file name of the parameter file.

For example, if the parameter file is pr3212.sh, then par would be pr3212.sh and so_par would be $SQLOPER_HOME/run/pr3212.sh (UNIX) or %SQLOPER_HOME%\run\pr3212.sh (Windows).

PAR Passing

With SQR programs, you can pass in the parameter file using the so_par or par environment variable. For example:

UNIX:

arg="sh $program $so_par

eval $arg

Windows:

call %program% %so_par

When this program is evaluated, it will look like this:

UNIX:

sh $program $AW_HOME/run/pr<seq_no>.sh

Windows:

%program% %AW_HOME\run\pr<seq_no>.sh

where pr<seq_no> is a unique number produced by the Applications Manager agent.

Using Environment Variables

If a program accepts input and output file names from environment variables, you can set the environment variables in the program type script. In the example shown below, the program writes its output to OUTFILE, and gets the parameters from INFILE.

UNIX:

OUTFILE=$file; export OUTFILE

INFILE=$par; export INFILE

$program

Windows:

set OUTFILE=%file%

Set INFILE=%par%

Call %program%