File control state sample exit program: DFH$REQC

DFH$REQC is a sample global user exit program for use with the file control state program. It is designed to be invoked at the XFCSREQC exit. DFH$REQC allows you to check VSAM error flags after file requests have been acted upon and, optionally, to write messages and data areas to a system console or a transient data queue.

About DFH$REQC

DFH$REQC provides sample processing for the file control state program global user exit, XFCSREQC. The exit program, if enabled at the XFCSREQC exit point, is invoked after a file ENABLE, DISABLE, OPEN, CLOSE, or CANCEL CLOSE request has been acted on.

There is more information about using the sample program in the comments in the DFH$REQC source code. In summary, DFH$REQC performs the following processing:

  1. Checks whether an open request for a VSAM data set has been acted on and that the ACB error flag (ACBERFLG) is nonzero.
  2. If all are true, performs default processing. The ACBERFLG error code is checked. If it is equal to X'74', the following message and data areas are built into 690 bytes of contiguous storage, in such a way that they conform to the editing rules of the WRITE OPERATOR command:
    Message
    VSAM Open error has occurred — VSAM error flag X'nn'

    The ACBERFLG error code is converted from hexadecimal to character format and appended to the end of the message.

    Access method control block (ACB)
    The data starts with an 'ACB' eye-catcher. All the data within the ACB is converted into character format and added after the eye-catcher.
    Exec Interface Block (EIB)
    The data starts with an 'EIB' eye-catcher. All the data within the EIB is converted into character format and added after the eye-catcher.
    Parameter list passed to the exit program
    The data starts with a 'PLIST' eye-catcher. Only the exit-specific parameters are converted to character format and added after the eye-catcher.
    File Information
    The data starts with a 'FINFO' eye-catcher. This is followed by the 8-character file name and the 44-character dsname of the data set associated with the file, as described by fields UEFLNAME and UEDSNAME in the DFHUEFDS DSECT.
  3. Issues a WRITE OPERATOR command to write as much data as has been created in the 690 bytes of storage to the system console.
  4. Returns a normal response of zero in register 15.

The sample program contains logic to write the same messages and data areas that are written on the default processing path to a transient data queue. In this case, output is edited into lines of 132 bytes. Each line is written when it is full, at which point (or upon request) a new data area or message is started.

In addition, the program logic allows for other VSAM error codes to be tested. These can be actioned to follow existing paths within the program, or tailored to use all or part of the set of messages and data areas already defined. Alternatively, the sample program can be customized to expand the set of messages and data areas written.