Previous Topic: SECURITY=NONE|RACF|TOPSEC|ACF2

Next Topic: CATALOG=catalogname


SCAN Statement

The following section describes the SCAN statement.

SCAN   {CATALOG=catalogname|DSNAME={dsname|pattern}}
[,EXCCATS=(catnamelist)]
 [,BEGINDSN=dsname]
 [,PREEXIT=exitname]
 [,POSTEXIT=exitname]

The SCAN statement is used to indicate the VSAM/ICF catalog or data set name pattern to be scanned. One or more SET statements can be coded at the top of a command structure. See the Command Structures in the Command Language in this chapter for more information.

Either CATALOG or DSNAME must be specified for the SCAN statement to be valid. It is not valid to specify both on the same SCAN statement.

Narrowing the list of data sets to be processed using the DSNAME parameter on the SCAN statement usually requires less CPU time and less elapsed time than using the CATALOG parameter on the SCAN statement in conjunction with a SELECT statement. This is especially true if your VSAM or ICF catalogs are large. For example, the following two command structures produce the same result, but the second one is generally more efficient.

SCAN CATALOG=ICF.TESTCAT
SELECT DSNNAMES=(LABS.TJP./)
EXAMINE

produces the same result as:

SCAN DSNAME=LABS.TJP./
EXAMINE

Note: The assumption here is that all data sets named LABS.TJP./ are cataloged to ICF.TESTCAT. For the second command structure to work properly, an alias must exist in the master catalog for the high-level qualifier of the data set name.