Files Accessed by Both CICS and JCL

If a batch job needs exclusive access to a dataset that is also accessed by CICS, then the dataset must be closed and disabled before the batch job can run. The batch job waits until this has been done before executing.

If the batch job does not require exclusive access, there is no problem - it can access the dataset at the same time as CICS.

You can use the casfile command to close and disable a dataset, and to open and enable it again after the batch job has finished with it. You call casfile from the application command prompt. You could call it indirectly from within a JCL jobstream, by writing a simple COBOL program to call it and then calling the COBOL program from the jobstream.

Here are some examples of casfile, showing its most important parameters. See casfile for full details.

To close and disable a file called payroll in an enterprise server called FSDEMO, enter:

casfile -rFSDEMO -oc -ed –dPAYROLL

Where:

To open and enable the same file, enter:

casfile -rFSDEMO -ooi -ee –dPAYROLL

Where:

You can call casfile from a COBOL program via x"91" function 35 (not on UNIX), CBL_EXEC_RUN_UNIT or simply by CALL "CASFILE" using ..., where the input consists of a string containing the options that you use on the command line prefixed with its length, as indicated below.

01  lk-cmd-line.
        05  lk-cmd-len                pic x(02) comp-x.
        05  lk-cmd-data               pic x(1024).

A return code of 0 indicates success. Any other value indicates an error.