All SDF-P commands supply return codes which provide the user with information on command execution. This command return code is comparable to the return code on the program level. The command return code allows users to respond to specific error situations.
The command return code consists of three parts:
subcode1, which assigns the error situation to an error class indicating how serious the error is. The value of subcode1 is output in decimal. The following five error classes are defined in BS2000:
Class A: no error
The value is zero. Processing can be continued normally.Class B: syntax error
The value is a number between 1 and 31. There is a syntactical error in the command input. This error should be corrected before the command is entered again.Class C: internal error (system error)
The value is 32. The input should be repeated only after the internal error has been rectified.Class D: errors which belong to no other error class
The value is a number between 64 and 127. The maincode should be evaluated to determine what should be done.Class E: command cannot be executed at the moment
The value is a number between 128 and 130. The input can be repeated without correction. The command can be executed after a waiting period. The length of the waiting period is defined as short-term, long-term and indefinite.
Short-term is indicated by the value 128 and means that the waiting period is regarded as acceptable for interactive jobs.
Long-term is indicated by the value 129 and means that the waiting period is regarded as acceptable for batch jobs.
Indefinite is indicated by the value 130 and means that it is not clear whether the error can be rectified at all.
subcode2, which can contain supplementary information on the error class.
maincode, which corresponds to a message code and supplies specific error information. This message code can be used to output the appropriate error message via the predefined MESSAGE( ) function or using the SDF command HELP-MSG-INFORMATION (see the “Commands” manual [3] for information on HELP-MSG-INFORMATION).
The command return code can be requested with the predefined functions SUBCODE1( ), SUBCODE2 ( ) and MAINCODE( ).
There are separate return codes for each command. In addition to the special return codes for specific commands, there are some general return codes, which are listed below.
Notes
Normally, execution of a command is terminated when an error is detected. If more than one error occurs, it is not possible to guarantee that the first error to occur will be the first error reported, since the order of operand checking is not guaranteed.
The return codes and messages are guaranteed only for S procedures, not for non-S procedures or batch jobs.
The following commands are partially or completely checked during the pre-analysis of an S procedure. Any error occurring during this pre-analysis is an error in the command during procedure preparation and the command is not executed. For this reason, there are very few error messages which actually appear during command execution. If one of these commands is generated by means of expression replacement, a context error occurs.
The commands to which the above applies are:BEGIN-BLOCK
BEGIN-PARAMETER-DECLARATION
CYCLE
DECLARE-PARAMETER
ELSE
ELSE-IF
END-BLOCK
END-FOR
END-IF
END-PARAMETER-DECLARATION
END-WHILEEXIT-BLOCK
FOR
GOTO
IF
IF-BLOCK-ERROR
IF-CMD-ERROR
INCLUDE-BLOCK
REPEAT
SET-PROCEDURE-OPTIONS
UNTIL
WHILEIf an error occurs during execution of a command which initiates a block, then this error can be processed only in an IF-BLOCK-ERROR block; this can be done only after completion of the block which started the invalid command.
The defaults are CMD0001 for the maincode and 0 for subcode1 and subcode2.
The general return codes (i.e. the return codes which can occur for any command) are:
(SC2) | Maincode | Meaning1 |
0 | CMD0001 | No error |
1If the table also contains guaranteed messages, then “/ guaranteed messages” is added to the meaning column.
For all commands, statements and records in which expression replacement is carried out, the following return codes may appear if errors occur during expression replacement:
(SC2) | Maincode | Meaning |
1 | SDP0140 | Syntax error during replacement |
The following return code may appear for all data lines in a false context:
(SC2) | Maincode | Meaning |
64 | SDP0091 | Semantic error |
The following return code may appear for all statements in a false context:
(SC2) | Maincode | Meaning |
64 | SDP0091 | Semantic error |