The INCLUDE-CMD command provides a means of calling command sequences or a procedure from within a program. The commands to be executed are transferred as the value of the CMD operand. INCLUDE-CMD thus provides the same functionality as the INCLUDE-PROCEDURE command (see "INCLUDE-PROCEDURE Start command sequence as include procedure "), albeit with the following restrictions:
The commands to be executed are not read from a file but are specified directly in the CMD operand, which assumes the role of a virtual SYSCMD file. In conjunction with the CMD macro call, it is therefore possible to make a command procedure available in main memory.
INCLUDE-CMD does not support any of the operands of the INCLUDE-PROCEDURE command. Only the default values are used.
Unlike INCLUDE-PROCEDURE, INCLUDE-CMD does not terminate a program when it is called by the CMD macro. The program is also not terminated if a procedure is called in the command sequence transferred in the CMD operand (see the example on "INCLUDE-CMD Call command sequence from program ").
INCLUDE-CMD may be executed in the CMD macro (TU program) and in EXECUTE-SYSTEM-CMD statements.
The system rejects the following operations during execution of the INCLUDE-CMD command to avoid possible inconsistencies since this command is called in program mode:
Start and terminate program: START utility, LOAD-/START-EXECUTABLE-PROGRAM (or LOAD-/START-PROGRAM), RESTART-PROGRAM (see CALL-PROCEDURE ...UNLOAD-ALLOWED=*NO).
Resume program: AID commands, RESUME-PROGRAM, EXIT-PROCEDURE RESUME-PROGRAM=*YES, ENDP-RESUME, INFORM-PROGRAM (and SEND-MSG ...,TO=*PROGRAM).
Abort procedure: CANCEL-PROCEDURE,
when prompted for parameters.Call INCLUDE-CMD recursively.
BEGIN-BLOCK PROGRAM-INPUT=*MIXED-WITH-CMD
SET-JOB-STEP if a program is loaded.