Starting with ACC/SRS release 3.1.5, the OPEN environment can be used to intercept an open request for both VSAM and non-VSAM data sets. The product rules can be used to issue messages, write log records, fail the open, or perform any of the DIF functions available in the rules language. This new interface is only available after starting ACCOPEN and activating the open environment in the rules. For example, the following DIF console command can be issued from the console or added to the START00 in the DIF parameter library
F DIF,START ACCOPEN
By default, the rules do not process the OPEN environment - even after starting ACCOPEN. The following card can be added to the rules language to activate the OPEN environment.
DEFENV OPEN MODE(ACTIVE)
During open processing, the rules can use the &OPEN_TYPE variable to examine the type of open requested. The possible values are OUTPUT, EXTEND, OUTIN, OUTINX, INOUT, UPDATE, RDBACK, and INPUT. While the rules language would typically be used to gather information for logging or reporting purposes, the rule can also deny the open request. For example, the following statement would cause an open failure for the application requesting the open.
SET JCLFAIL=YES
The ACCOPEN environment can be used to enforce standards for OPEN, such as, for example, whether a VSAM dataset is being opened in RLS mode and whether the correct LOGSTREAM id or other RLS attributes are specified. In the example below, a
user-defined SMF record is written for each VSAM dataset opened in RLS mode. Also, if a 'test' LOGSTREAM id is used for a 'production' dataset, the OPEN is failed with an error message. Finally, for a particular dataset and LOGSTREAM id combination, a check is made to ensure that LOG(REDO) is in effect.
DEFENV OPEN MODE(ACTIVE) RULES(ALWAYS)
DEFFILT &VSAM_DATASETS INCLUDE(DSMVT.ACCOPEN.**)
DEFSMF SMF_RECORD SMFRID(201) +
'&VSAMOPEN &JOBNAME &USER &STEPNAME &DSNAME &DATACLAS ' + '&STORCLAS &LOGPARM &FRLOG &LOGSTRID'
DEFMSG LOGFIL_ERROR
'** &DSNAME INCORRECT OPEN LOG=&LOGPARM ' + 'FRLOG=&FRLOG LSID=&LOGSTRID'
DEFMSG REDO_WARN
'** WARNING: &DSNAME RLS OPEN WITH LOG=&LOGPARM IS ' + 'INCORRECT'
DEFRULE OPENRULE IF &ENV = OPEN
&ENVS = VSAM
&DSNAME = &VSAM_DATASETS &OPEN_RLS = YES
THEN DO
ISSUE WRITESMG(SMF_RECORD)
IF &DSNAME = PROD.** &LOGSTRID = TEST.**
THEN ISSUE WRITEMSG(LOGFIL_ERR) SET &JCLFAIL = YES
IF &DSNAME = PROD.EAST.** &LOGSTRID = PROD.LOGSTR2.** &LOGPARM NE ‘REDO’
THEN ISSUE WRITEMSG(REDO_ERR)
END