Format of the Rules File

The rules file is a text file that can include multiple rules. You can set conditions on specific field names and define multiple conditions within a single rule.

A rule is defined using the following format:

RULE:
	- CONDITION:  condition
	  VALUE:      value
	SUBDIRECTORY: location
---

Where:

  • RULE: defines the start of the definition of a rule and --- indicates where it ends.
  • -CONDITION: indicates where a condition starts.

    A rule can have multiple conditions.

  • A condition must be followed by a VALUE: that specifies the condition value.
  • SUBDIRECTORY indicates a dataset or a file location. Can be a full path or an environment variable.

    A rule can have only one SUBDIRECTORY: entry.

  • Comment lines must be prefixed with # in column 1.

The following is example of a rule that sets a condition for the RECORDTYPE property with a value of 'S'. This indicates that any SPOOL file should be assigned to the $MFSYSCATDIR\SPOOL\ folder ($MFSYCATDIR is an environment variable that indicates the folder that stores the system catalog):

RULE:
	- CONDITION:	RECORDTYPE
	  VALUE:		S
	SUBDIRECTORY:	$MFSYSCATDIR\SPOOL\
---

Names of the catalog record fields

The following names can be used in the rules to indicate catalog record fields:

RECORDTYPE
Type of the catalog record:
S
A spool record
D
A data class record
DSNAME1 - DSNAME10
Name of the dataset name element, number one to five: DSNAME1.DSNAME2.DSNAME3.DSNAME4.DSNAME5.DSNAME6.DSNAME7.DSNAME8.DSNAME9.DSNAME10
DSORG
Dataset organisation. Can be one of the following:
  • PDSM
  • PO
  • PS
  • VSAM
  • GDG
  • IS
LRECL
The record length. Must have a numeric value.
RECFM
The record format. Can be one of the following:
  • F, FA, FB, FBA, FBM, FBS, FM (Fixed)
  • KS, ES, RR, LS (VSAM Files)
  • LSEQ (Line sequential)
  • U (Undefined)
  • V, VA, VB, VBA, VBM, VBS, VM, VS (Variable)
CHARSET
The character set. Takes the following values:
A
ASCII
E
EBCDIC
DATACLASS
The data class of the dataset.
MGMTCLASS
Management class value - The management class of the dataset
UNIT-DEVICE
The unit value of the dataset.
VOLUME
The volume value of the dataset.
JOB-CREATED
The name of the JCL job that created the dataset.

Defining multiple conditions with a rule

You can define multiple conditions within a single rule.

The following example shows a rule for a dataset that has a character set of ASCII; its dataset name has 'PROD' as its first element and 'I' as its fourth element (for example, PROD.BBBB.CCCC.I.EEEE); has a UNIT setting of 'SYSDA'; a RECFM setting of 'VB'; was created by the JCL job 'OVERCHK'; will be created in the '$MFSYSCATDIR\RECFM\' folder:

RULE:
	- CONDITION:	CHARSET
	  VALUE:		A
	  
	- CONDITION:    DSNAME1
	  VALUE:        PROD
	  
	- CONDITION:    DSNAME4
	  VALUE:        I
	  
	- CONDITION:    UNIT-DEVICE
	  VALUE:        SYSDA
	  
	- CONDITION:    RECFM
	  VALUE:        VB

	- CONDITION:    JOB-CREATED
	  VALUE:        OVERCHK
  	  
	SUBDIRECTORY:	$MFSYSCATDIR\RECFM\
---

Using HEX values

You can use hexadecimal values in the rules.

The following example shows a rule that is defined for the dataset LRECL field - if it has a value of H'0063' (decimal 99), it will be assigned to the LRECL99 folder:

RULE:
	- CONDITION:  LRECL
   VALUE:      HEXVALUE 0063
	SUBDIRECTORY: $MFSYSCATDIR\LRECL99\
---

Using wildcards

The rules file has a simple wildcard support. You can use a single or multiple wildcards, *, in the value field to indicate any number of characters - for example, L00*500 or *TE*.**S*.

The following example rule specifies that a dataset whose first name element is ‘PROD’ and whose management class begins with ‘L00’ and ends with ‘500’ is to be assigned to the L00D500 folder:

RULE:
	- CONDITION:	DSNAME1
	  VALUE:	PROD
	  
	- CONDITION:	MGMTCLASS
	  VALUE:	L00*500

	SUBDIRECTORY:	$MFSYSCATDIR\L00D500\
---

Automatic selection of classes

The format of the rules file enables you to assign properties to a dataset based on the same conditions. This can be likened to the Automatic Class Selection process on the mainframe.

You can assign the following attributes to a dataset:

DATACLASS
The name of the DATACLASS
MGMTCLASS
The name of the MGMTCLASS
CHARSET
The character set to use:
A
ASCII
E
EBCDIC
EXPIRE
The expiry time
SUBDIRECTORY
The directory to use for the dataset location. This is the same directory, SUBDIRECTORY, that is used in the general definition of a rule.

The following example shows a rule that specifies that any dataset that has a first name element of ‘MFI01’ and a fourth name element of ‘F2’ is to be assigned to the $MFSYSCATDIR\MFI01\ENDINF2 folder and have the MANGEMENGTCLASS property set to ‘MGMTYYYY’ and the EXPIRY date set to 4 days hence (a specific value can also be used):

RULE:
	- CONDITION:	 DSNAME1
	  VALUE:      MFI01
	  
	- CONDITION:	 DSNAME4
	  VALUE:      F2

	SUBDIRECTORY:	$MFSYSCATDIR\MFI01\ENDINF2
	
	- ATTRIBUTE:  MGMTCLASS
	  VALUE:      MGMTYYYY

	- ATTRIBUTE:  EXPIRE
	  VALUE:      +4

---

For more examples of the allocation rules, see the Mainframe Samples available with this product - Start > All Programs > Micro Focus Enterprise Developer > Samples > Mainframe Samples, and select the JCL – Allocation Override sample.