CALL – Execute external program, subroutine, or variable

Use the CALL command to call routines that might be in another REXX routine or variable.

You can specify:
CALL EXT(<external REXX>) [STACK(IN|OUT|BOTH|NONE)]
or
CALL SUB(<subroutine name>)
or
CALL VAR(<variable name>)
where:
EXT
Specifies an external REXX routine to execute, including arguments if required. If the external command sets a return code, this will be passed to the return code of the CALL command.
STACK
Defines what to do with the REXX stack around the running of an external program:
IN
Default. Leaves the stack intact for the external program to use. If the external program does not pull entries from the stack they are left in place for the remainder of the calling program to access or add to.
OUT
Preserves the stack before calling the external program, then once the external program completes, processes any new stack entries on the stack as Workload Automation Programming Language commands, before restoring the original contents of the stack. Workload Automation Programming Language commands from the stack is displayed at MSGLEVEL(2).
BOTH
Passes the stack to the external program to use and then processes the entire content of the stack of Workload Automation Programming Language commands when the external program completes. If the input stack was not completely processed by the external command, any remainder is executed on exit. Workload Automation Programming Language commands from the stack is displayed at MSGLEVEL(2).
NONE
Keeps the stack before calling the external program and then restores the stack ahead of any new entries added by the external program.
SUB
Specifies a subroutine to run immediately following the CALL command. The CALL command fails if the subroutine does not exist.
VAR
Specifies a variable that contains a complete Workload Automation Programming Language command to run immediately following the CALL command. For batch loader this must be the full construct for all segments. The VAR keyword causes the command contained in the variable to be added to the execution stream to execute following this command. The return code of the CALL command indicates only the success of finding the variable and adding the command to be executed. After the command is run, it sets the appropriate return code. Commands queued by the VAR keyword are displayed at MSGLEVEL(2).