Previous Topic: SELECT and EXCLUDE Rule #2Next Topic: SELECT and EXCLUDE Rule #4


SELECT and EXCLUDE Rule #3

SELECT and/or EXCLUDE commands apply to all action commands that follow, until either a non-consecutive SELECT or EXCLUDE is encountered, or until a SCAN or FIND command is encountered. You may apply the preceding rule to one or more selection tests for multiple action commands. In the following example, the two catalogs named will be scanned and all data sets that meet either SELECT test will be both backed up and reported on:

SCAN CATALOG=VOL05.USERCAT
SCAN CATALOG=VOL00.USERCAT
SELECT CRITERIA=(TRKS,GT,30),DSN=/
SELECT CRITERIA=(ARCDT,LE,TODAY-30),DSN=/
BACKUP
REPORT MAPPER, CLDDATA, SVDICT

In the following example, both catalogs will be scanned and those data sets that have not been modified within the last year will be archived. In addition, those data sets that use less than 25 percent of their allocated space will be reported on. Note that because the two SELECT commands are not consecutive, the first SELECT command has no effect on the ARCHIVE command. However, a data set can be selected by both action commands if it met both selection criteria:

SCAN CATALOG=VOL05.USERCAT
SCAN CATALOG=VOL00.USERCAT
SELECT CRITERIA=(PCTUSED,LT,25),DSN=/
REPORT MVDICT
SELECT CRITERIA=(MODDT,LT,TODAY-365),DSN=/
ARCHIVE

You may also combine FIND commands with SELECT and/or EXCLUDE commands:

FIND DSNAMES=LABS.TJP.VSAMFIL
FIND DSNAMES=LABS.DMS.VSAM/
SELECT CRITERIA=(TRKS,GT,20),DSN=/
EXCLUDE DSNAMES=LABS.DMS.VSAMP/
ARCHIVE

Additionally, you can use multiple SELECT statements with the FIND statements and the SELECT statements will be processed in a logical OR capacity. As an example:

FIND DSNAMES=LABS.TJP.VSAMFIL
SELECT CRITERIA=(ARCDT,LE,TODAY-20),DSN=/
FIND DSNAMES=LABS.DMS.VSAM/
SELECT CRITERIA=(TRKS,GT,20),DSN=/
EXCLUDE DSNAMES=LABS.DMS.VSAMP/
ARCHIVE

The previous example will process any data sets starting with LABS.DMS.VSAM and the data set LABS.TJP.VSDAMFIL if it is larger than 20 tracks OR if it has not been backed up in the last 20 days. Note that the order of the FIND and SELECT statements makes no difference as to how the criteria will be applied. The only thing that ends the group is the ACTION command.