Suspend procedure run to allow command input
Component: | SYSFILE |
Functional area: | Procedures |
Domain: | PROCEDURE |
Privileges: | STD-PROCESSING |
Function
The HOLD-PROCEDURE command suspends a procedure and issues a message:
TASK IS IN ESCAPE MODE AT LEVEL NUMBER i
where i = number of the current procedure level
The user can then enter commands at the terminal. This interrupt state is called ESCAPE mode. ESCAPE mode is maintained until it is terminated with a CANCEL-PROCEDURE or RESUME-PROCEDURE command.
The HOLD-PROCEDURE command is not permitted in batch mode. In interactive mode, it may be given only in procedure files, and so does not appear in the menu.
Format
HOLD-PROCEDURE |
Return codes
(SC2) | SC1 | Maincode | Meaning |
---|---|---|---|
0 | CMD0001 | Command executed | |
2 | 0 | SSM2015 | Command not permitted in batch mode |
2 | 0 | SSM2016 | Command cannot be entered from the interactive terminal |
32 | SSM1013 | System error during command execution |
Notes
Nested interrupts are allowed (see Examples). A procedure called in ESCAPE mode can also be interrupted with HOLD-PROCEDURE. In this case, the first interrupt is not lost (see Example 3 on section "HOLD-PROCEDURE").
In ESCAPE mode the symbolic operands that were defined in the interrupted procedure are available to the user and can be used from the terminal. However, a command with a symbolic operand that was replaced by the corresponding value is logged only if logging was requested for the interrupted procedure (see Example 4 on section "HOLD-PROCEDURE").
Examples
Example 1: Execution of an EXIT-PROCEDURE command in ESCAPE mode
The arrows indicate the sequence in which commands are processed (SYSCMD):
The command
/CALL-PROC FROM=PROC1
assigns SYSCMD to the procedure file PROC1.The command
/CALL-PROC FROM=PROC2
assigns SYSCMD to the procedure file PROC2.The command
/HOLD-PROC
activates ESCAPE mode: SYSCMD is assigned to the terminal. ESCAPE mode can also be activated by pressing [K2] if this is allowed in the procedure. However, in this case it is not possible to precisely determine the interrupt point in advance.EXIT-PROCEDURE causes a shift from procedure level 2 to procedure level 1; ESCAPE mode is maintained. (Note: If an RESUME-PROCEDURE command were entered instead of the EXIT-PROCEDURE command, PROC2 would be continued from the point of interruption.)
The RESUME-PROCEDURE command cancels ESCAPE mode. SYSCMD is again assigned to the procedure file PROC1.
SYSCMD is again assigned to primary command input.
Example 2: Execution of a CALL-PROCEDURE command in ESCAPE mode
The arrows indicate the sequence in which commands are processed (SYSCMD):
The command
/CALL-PROC FROM=PROC1
assigns SYSCMD to the procedure file PROC1.The command
/HOLD-PROC
activates ESCAPE mode: SYSCMD is assigned to the terminal. ESCAPE mode can also be activated by pressing [K2] if this is allowed in the procedure. However, in this case it is not possible to precisely determine the interrupt point in advance.The command
/CALL-PROC FROM=PROC2
assigns SYSCMD to the procedure file PROC2.END-PROC causes a shift from procedure level 2 to procedure level 1; ESCAPE mode is still activated, i.e. SYSCMD is assigned to the terminal.
The RESUME-PROCEDURE command cancels ESCAPE mode. SYSCMD is again assigned to the procedure file PROC1.
SYSCMD is again assigned to primary command input.
Example 3: Nesting of ESCAPE levels
The arrows indicate the sequence in which commands are processed (SYSCMD):
The command
/CALL-PROC FROM=PROC1
assigns SYSCMD to the procedure file PROC1.The command
/HOLD-PROC
activates ESCAPE mode: SYSCMD is assigned to the terminal. ESCAPE mode can also be activated by pressing [K2] if this is allowed in the procedure. However, in this case it is not possible to precisely determine the interrupt point in advance.The command
/CALL-PROC FROM=PROC2
assigns SYSCMD to the procedure file PROC2.The command
/HOLD-PROC
activates ESCAPE mode: SYSCMD is assigned to the terminal. ESCAPE mode can also be activated by pressing [K2] if this is allowed in the procedure. However, in this case it is not possible to precisely determine the interrupt point in advance.SYSCMD is assigned to the procedure file PROC2.
SYSCMD is assigned to the terminal (ESCAPE mode is still activated at level 1).
The RESUME-PROCEDURE command causes SYSCMD to again be assigned to the procedure file PROC1.
SYSCMD is assigned to primary command input.
Example 4: Use of symbolic operands in ESCAPE mode
The arrows indicate the sequence in which commands are processed (SYSCMD).
The file name TEST is entered for the symbolic operand “&DAT” when the procedure PROC1 is called with the CALL-PROCEDURE command. After leaving procedure mode with the HOLD-PROC command, an ASSIGN-SYSDTA command is issued at the terminal using the symbolic operand “&DAT”. Since logging of commands on SYSOUT was requested for the procedure file PROC1 (the operand LOGGING=*CMD specified in the BEGIN-PROCEDURE command), this command (supplied with the appropriate value TEST) is also logged on SYSOUT in ESCAPE mode.