Domain: PROCEDURE
Command description
EXIT-PROCEDURE terminates the current procedure and returns job control to the calling level.
Even if the procedure is terminated normally, i.e. without errors, error information can be passed on. This must be stipulated in the ERROR operand. The specification
ERROR=*YES initiates error handling if SUBCODE1 is not zero.
The RESUME-PROGRAM operand can be used to stipulate that an already loaded program is resumed after termination of the procedure.
If the EXIT-PROCEDURE command is missing at the end of the procedure, the procedure is automatically terminated once execution reaches the end of the procedure. If an error occurs, the error code is also returned to the caller.
Format
EXIT-PROCEDURE |
ERROR = *NO (...) / *YES(...) *NO(...) SUBCODE2 = 0 / < integer 0..255> ,MAINCODE = CMD0001 / <alphanum-name 7..7> *YES(...) SUBCODE1 = 64 / <integer 0..255> ,SUBCODE2 = 0 / <integer 0..255> ,MAINCODE = SDP0018 / <alphanum-name 7..7> ,RESUME-PROGRAM = *NO / *YES |
Operands
ERROR =
Return code which is returned to the caller.
ERROR = *NO(...)
The return code with error class “NO-ERROR” is returned. The operands SUBCODE2 and MAINCODE can be used to pass further error information.
SUBCODE2 = 0 / <integer 0..255>
Additional information on the error class. The default is zero, i.e. there is no additional information.
MAINCODE = CMD0001 / <alphanum-name 7..7>
Passes a message key whose significance the caller can determine with the SDF command HELP-MSG-INFORMATION. The default is CMD0001, i.e the procedure was executed without errors.
ERROR = *YES(...)
The caller receives an return code which indicates an error. The error class and additional information can be passed with the operands SUBCODE1, SUBCODE2 and MAINCODE. If SUBCODE1 is not zero, error handling will be initiated in the calling procedure.
SUBCODE1 = 64 / <integer 0..255>
Number indicating the error class.
Error class 64: “SEMANTIC ERROR”.
SUBCODE2 = 0 / <integer 0..255>
Additional information on the error class. The value 0 means that there is no additional information.
MAINCODE = SDP 0018
Default value for the maincode.
MAINCODE = <alphanum-name 7..7>
Passes a message key whose significance the caller can determine with the SDF command HELP-MSG-INFORMATION (see also the manual “System Messages” [15]).
RESUME-PROGRAM =
Defines whether a program just being loaded is resumed at the end of the procedure.
RESUME-PROGRAM = *NO
The program is not resumed at the end of the procedure.
RESUME-PROGRAM = *YES
The program is resumed at the end of the procedure.
Command return codes
With EXIT-PROCEDURE ERROR = *YES, the command can report any given return code to the caller. From the caller’s point of view, this is the return code of the CALL-
PROCEDURE or INCLUDE-PROCEDURE command. If, however, execution of the EXIT-PROCEDURE command itself results in an error, control is not returned to the caller; instead, one of the following return codes is passed and the error handling within the procedure is initiated.
(SC2) | SC1 | Maincode | Meaning |
0 | CMD0001 | No error | |
1 | CMD0202 | Syntax error | |
3 | CMD2203 | Incorrect syntax file | |
32 | CMD0221 | System error (internal error) | |
130 | SDP0099 | No further address space available |