Testing for error conditions
You can use the resp and resp2 options with any command to test whether an exception condition was raised during processing. The resp and resp2 values can be referenced by their conditions. The pool dictionary CICSRespConstants contains the value and the condition for each possible response. Refer to the CICS Application Programming Reference for the values and conditions of CICS responses. The declared constant in Smalltalk is the response condition with RESP_ preceding the condition (that is, a condition of FILENOTFOUND can be referenced as RESP_FILENOTFOUND). For example, the following code tests the resp and resp2 values from the ADDRESS command:
| result |
result := CICS address exec.
"Test for a resp value of 0, which is the CICSRespConstant equivalent
of RESP_NORMAL"
(result resp = RESP_NORMAL or: result resp2 = RESP_NORMAL])
ifFalse: [Transcript cr; show: 'Command failed with the following error codes:';
cr;
show: 'RESP: ', result resp printString, '
RESP2: ', result resp2 printString]
You can also test program conditions using the constants declared in CICSCvdaConstants. For example, the following code tests the value of enabledstatus from the INQUIRE FILE command.
| result enable |
result := CICS inquirefile file: 'FAAMGFMG'; exec.
enable := result enablestatus.
"Test the enable status to determine if it is enabled"
enable = CVDA_ENABLED
ifTrue: [CICSTTY cr; nextPutAll: 'Enable status is ENABLED.']
See Appendix A, Messages and codes for a description of the messages and codes that can appear in CICS.
Last modified date: 07/09/2019