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, if you have already specified RESP, you can 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 that corresponds to the condition that might be 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 ...

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

The following example is a similar test in C:
switch (xxx) {
  case DFHRESP(NORMAL) : break;
  case DFHRESP(INVREQ) : Invreq_Cond();
                         break;
  default              : Errors();
}
The following example is a similar test in assembler language:
CLC   xxx,DFHRESP(NOSPACE)
The translator changes this code to:
CLC   xxx,=F'18'

Because the use of RESP implies NOHANDLE, use care when you use RESP with the RECEIVE command. NOHANDLE overrides both the HANDLE AID and 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 that corresponds to DFHRESP, so you must test the fullword binary value itself.