Handling exception conditions by inline code
If your program is written in C or C++, or is an AMODE(64) assembler language application, inline code is the only technique available to handle exception conditions. If your program is not written in C or C++ and is not an AMODE(64) assembler language application, handling exception conditions involves either using the NOHANDLE option or specifying the RESP option on EXEC CICS commands, which prevents CICS® from performing its default exception handling.
About this task
The RESP option makes the value of the exception condition directly available to your program, for it to take remedial action.
If you use the NOHANDLE or RESP option, ensure that your program can cope with whatever condition might arise in the course of executing the commands. The RESP value is available to enable your program to decide what to do and more information which it might need to use is carried in the EXEC interface block (EIB). In particular, the RESP2 value is contained in one of the fields of the EIB. For more information about EIB, see EIB fields. Alternatively, if your program specifies RESP2 in the command, the RESP2 value is returned by CICS directly.
The argument of RESP is a user-defined fullword binary data area (long integer). On return from the command, it contains a value that corresponds to the condition that might have been raised. Normally, its value is DFHRESP(NORMAL). The DFHRESP built-in translator function makes it easy to test the RESP value, because you can examine RESP values symbolically. This technique is easier than examining binary values that are less meaningful to someone reading the code.
Using RESP and DFHRESP in COBOL and PL/I
EXEC CICS
call in COBOL that uses the RESP
option. A PL/I example is similar, but ends with a semicolon (;) rather than END-EXEC.
EXEC CICS WRITEQ TS FROM(abc)
QUEUE(qname)
NOSUSPEND
RESP(xxx)
END-EXEC.
IF xxx=DFHRESP(NOSPACE) THEN …
Using RESP and DFHRESP in C and C++
EXEC CICS
call in C that uses the RESP option,
including the declaration of the RESP variable: long response;
⋮
EXEC CICS WRITEQ TS FROM(abc)
QUEUE(qname)
NOSUSPEND
RESP(response);
if (response == DFHRESP(NOSPACE))
{
⋮
}
Using DFHRESP in Assembler language
CLC xxx,DFHRESP(NOSPACE)
BE ...