Question & Answer
Your CICS application receives a RESP=84 (DISABLED) or RESP=19 (NOTOPEN) when accessing a VSAM file because the file is allocated to a batch job. The file is dynamically allocated and you do not want to add a DD statement to the CICS startup job. The application needs the file and you would like to know: Can CICS be made to wait until the file is available?
The reasons your application receives DISABLED and NOTOPEN responses are documented in the CICS Transaction Server for z/OS (CICS TS) documentation under the EXEC CICS commands used to access VSAM files like READ, WRITE, and DELETE:
A file was initially defined as disabled and has not since been enabled, or was disabled by a SET FILE or a CEMT SET FILE command.
NOTOPEN (RESP2 60) is returned for one of the following reasons:
- The requested file is CLOSED and UNENABLED. The CLOSED, UNENABLED state is reached after a CLOSE request has been received against an OPEN ENABLED file and the file is no longer in use. You can also make CLOSED, UNENABLED the initial state, by specifying STATUS(UNENABLED) and OPENTIME(FIRSTREF) on the FILE resource definition. (For BDAM files, you use the FILSTAT parameter of the DFHFCT TYPE=FILE macro.)
- The requested file is OPEN and in use by other transactions, but a CLOSE request against the file has been received.
- A WRITE request is issued against a data set is quiesced, or is being quiesced, as a result of a SET DSNAME QUIESCED or IMMQUIESCED command.
- The requested file is CLOSED and ENABLED, so CICS has tried to open the file as part of executing the request. This file open has failed for some reason. You should examine the console for messages that explain why the file open has been unsuccessful.
Default action: terminate the task abnormally.
CICS can not be made to wait for the file to be allocated but you can change your CICS application program to wait until the file is available:
- Include the EXEC CICS INQUIRE FILE command to check the file status before trying to access the file within your application.
- If the OPENSTATUS is OPEN and the ENABLESTATUS is ENABLED, then your application can continue processing.
- If the OPENSTATUS is NOT OPEN OR the ENABLESTATUS is NOT ENABLED, then you could include the EXEC CICS SET FILE( ) OPENSTATUS(OPEN) ENABLESTATUS(ENABLED) command to explicitly open and enable the file.
- If the OPEN is not successful, use the EXEC CICS DELAY command for some time then retry the INQUIRE FILE after the time elapses (go back to step 1).
Note: If coding this solution, the open should be successful once the batch job releases the file. However, to ensure that this code does not result in an endless loop, you should consider issuing a WRITE OPERATOR with REPLY after issuing the delay a set amount of times. In the WRITE OPERATOR message, you could ask an operator to check the status of the batch job or the file with manual intervention.
CICS/TS CICS TS CICS Transaction Server
15 June 2018