IBM Support

Determining if a file is open and enabled before accessing the file in a CICS application

Question & Answer


Question

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?

Cause

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:
84 DISABLED
RESP2 values:

50


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.

19 NOTOPEN
RESP2 values:

60


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.
This condition does not occur if the request is made to a CLOSED, DISABLED file. In this case, the DISABLED condition occurs.

Default action: terminate the task abnormally.

Answer

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:

  1. Include the EXEC CICS INQUIRE FILE command to check the file status before trying to access the file within your application.

  2. If the OPENSTATUS is OPEN and the ENABLESTATUS is ENABLED, then your application can continue processing.

  3. 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.

  4. 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.

[{"Product":{"code":"SSGMGV","label":"CICS Transaction Server"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Initialization","Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"5.2;5.1;4.2;4.1;3.2;3.1","Edition":"","Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Product Synonym

CICS/TS CICS TS CICS Transaction Server

Document Information

Modified date:
15 June 2018

UID

swg21461233