EXEC

Top  Previous  Next

The EXEC statement causes, on a mainframe environment, a program, a JCL or a PROC to be started, depending on the supplied parameters.

In the XFRAME environment, the start method changes depending on what you intend to start.

Starting programs

In UNIX/Linux shells, programs are activated simply providing the name of the executable as command. I.e.

mybin

Normally, COBOL program are not compiled as standalone executable, but they are left as linkable objects, demanding the dynamic link to the runtime phase. This lead to an higher degree of mainteinability, without performance loss.

The run a COBOL intermediate, the command xrun is used, according to the following syntax:

xrun <pgm-name>

Passing data cards

xrun enables programs to receive parameters cards, and to do it, it uses the standard input descriptor. Therefore if your parameter cards are enclosed in the script, an in-script redirection using the “<<” redirector is to be utilized.

I.e.:

#!/bin/csh
xrun PROG1 <<end_data_cards
PROG1 19991201 ***** *****
PROG1 19991202 00099 00145
PROG1 ***
end_data_cards

If the parameters cards are contained in a separate file, then the “<” redirector can be used:

xrun PROG1 < /some/where/cards.txt

Providing a PARM

The PARM parameter of the EXEC command, is managed by xrun through the XRUN_PARM environment variable. It must be set with the desire value before the execution of the program, and unset after the execution.

I.e.

# //STEPX   EXEC PGM=MYPGM,PARM=MYVALUE
setenv XRUN_PARM "MYVALUE"
xrun MYPGM
unsetenv XRUN_PARM

Starting PROCs

The PROCs are converted into shell scripts, that must be invoked by the master script. To allow dynamic parameter substitutions and overrides, called scripts must be run by xdsh.

I.e.

xdsh MYPROC1.csh