RESP and RESP2 options

You can use the RESP option with any command to test whether a condition was raised during its execution. With some commands, when a condition can be raised for more than one reason, you can, if you have already specified RESP, use the RESP2 option to determine exactly why a condition occurred.

RESP(xxx)
“xxx” is a user-defined fullword binary data area. On return from the command, it contains a value corresponding to the condition that may have been raised, or to a normal return, that is, xxx=DFHRESP(NORMAL). You can test this value by means of DFHRESP, as follows:
EXEC CICS WRITEQ TS FROM(abc)
                    QUEUE(qname)
                    NOSUSPEND
                    RESP(xxx)
                    RESP2(yyy)
   .
   .
IF xxx=DFHRESP(NOSPACE) THEN ...

The above form of DFHRESP applies to both COBOL and PL/I.

An example of a similar test in C:
switch (xxx) {
  case DFHRESP(NORMAL) : break;
  case DFHRESP(INVREQ) : Invreq_Cond();
                         break;
  default              : Errors();
}
An example of a similar test in assembler language:
CLC   xxx,DFHRESP(NOSPACE)
which the translator changes to:
CLC   xxx,=F'18'

As the use of RESP implies NOHANDLE, you must be careful when using RESP with the RECEIVE command, because NOHANDLE overrides the HANDLE AID command as well as the HANDLE CONDITION command, with the result that PF key responses are ignored.

RESP2(yyy)
“yyy” is a user-defined fullword binary data area. On return from the command, it contains a value that further qualifies the response to certain commands. Unlike the RESP values, RESP2 values have no associated symbolic names and there is no translator built-in function corresponding to DFHRESP, so you must test the fullword binary value itself.