TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

CICS Response Option


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:

ConditionValueDescription
NORMAL 00
NOTFND 13
DUPREC 14
INVREQ 16
NOSPACE 18
NOTOPEN 19
ENDFILE 20
LENGERR 22
QZERO 23
QBUSY 25
ITEMERR 26
PGMIDERR 27
ENDDATA 29
MAPFAIL 36
QIDERR 44
ENQBUSY 55
DISABLED 84

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

  1. Define a full word binary field (S9 (8) COMP) in the Working Storage Section as the response field.

  2. Place the RESP option with the response field in a command.

  3. 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


Example:

...
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.

Description:

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 :

    1. PGMIDERR – Program not found

    2. LENGERR – Load module > 32 K

    3. 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!

Are you looking for Job Change? Job Portal