The RESP option can be specified in any CICS command. Its function is similar to the return code in a batch program. If the RESP option is specified in a command, CICS places a response code at the completion of the command. The application program can check this code, and then proceed to the next processing.
CICS has a built-in function called DFHRESP that enables us to test the RESP value symbolically. This makes coding easier as we do not have to remember the numerical value of numerous response codes.
If WS-RESP = DFHRESP(NORMAL)
If WS-RESP = DFHRESP(LENGERR)
Alternatively we can look up the numerical value of EIBRESP associated with these conditions and code the above statements as,
If WS-RESP = 00
If WS-RESP = 22
For a list of EIBRESP codes with their symbolic equivalents, refer to the below table:
This approach has an advantage over the HANDLE CONDITION approach, because this makes the program more structured.
Procedure to use the RESP option in a CICS command
Define a full word binary field (S9 (8) COMP) in the Working Storage Section as the response field.
Place the RESP option with the response field in a command.
After command execution, check the response code in the response field with DFHRESP(xxxx), where xxxx is,
NORMAL for normal completion
Error for any exceptional condition
... WORKING-STORAGE SECTION. 77 WS-RETNCODE PIC S9(8) COMP. PROCEDURE DIVISION. .. EXEC CICS SEND FROM( ) LENGTH( ) ERASE( ) RESP(WS-RETNCODE) END-EXEC. EVALUETE TRUE WHEN WS-RETNCODE = DFHRESP(NORMAL) GO TO NORMAL-PARA WHEN WS-RETNCODE = DFHRESP(LENGERR) GO TO LENGERR-PARA END-EVALUATE.
During the execution of this program, the following functions are to occur:
At the completion of the SEND command, the WS-RETCODE field will have the response code of the command execution result.
If the SEND command completes normally, control will be passed to NORMAL-PARA.
If a LENGERR is encountered, control will be passed to LENGERR-PARA.
Other exceptions are :
PGMIDERR – Program not found
LENGERR – Load module > 32 K
NOAUTH – Security check error
If any other exceptional condition is encountered, control will be passed to GENERAL-ERR-PARA.
General EXCEPTIONS are
LENGERR – Record length mismatch with file
INVREQ – Read operation not permitted as it is not mentioned in the FCT. Record is locked
NOAUTH – Resource acquisition failed
NOTFND – Record not found
ENDFILE – End of File
QIDERR - DCT entry not found for the ‘Q’
NOSPACE - no space available in TDQ
QZERO - no more items to read in the ‘Q’
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!