Domain: Procedure information
The STMT-SPINOFF( ) function indicates whether a statement spin-off has been activated for the loaded program.
A statement spinoff is triggered when SDF statements are read by the system file
SYSSTMT in a program (read statement with the CMDRST or RDSTMT macro call, see the “SDF-A” manual [16]) and an error occurs.
At the statement level, the statement spin-off can be intercepted with the //STEP statement. At the command level, the STMT-SPINOFF( ) function is the only way to query whether a statement spin-off has taken place or not.
Note
Using this function is senseless in command blocks in which return codes are interpreted like command return codes by program statements (see the BEGIN-BLOCK command, operand PROGRAM-INPUT=*MIXED-WITH-CMD(PROPAGATE-STMT-RC=*TO-CMD-RC)). The reason for this is that the value YES will never be returned because the return code processing does not differentiate between statements and commands.
Format
STMT-SPINOFF( ) |
Result type
STRING (YES / NO / UNDEFINED)
Input parameters
None
Result
YES
A statement spin-off has been initiated for the loaded program.
NO
No statement spin-off has been initiated for the loaded program.
UNDEFINED
No program is loaded.
Error message
SDP0435 DESIRED INFORMATION NOT AVAILABLE
Example
The following procedure starts the program SDF-A and opens a syntax file for reading; the file type is unknown.
/DECLARE-PARAMETER NAME=SYNTAX-FILE(INITIAL-VALUE=*PROMPT) /BEGIN-BLOCK PROGRAM-INPUT=*MIXED-WITH-CMD / START-SDF-A // OPEN-SYNTAX-FILE &(SYNTAX-FILE),TYPE=SYSTEM,MODE=READ / IF (STMT-SPINOFF='YES') // STEP // OPEN-SYNTAX-FILE &(SYNTAX-FILE),TYPE=GROUP(*NO),MODE=READ / IF (STMT-SPINOFF='YES') // STEP // OPEN-SYNTAX-FILE &(SYNTAX-FILE),TYPE=USER(*NO, *NO),MODE=READ / END-IF / END-IF // SHOW-STATUS / EXIT-PROCEDURE RESUME-PROGRAM=*YES /END-BLOCK