Program Control Statements

KEY = ( start , length )
Defines a key field for use by FROMKEY and TOKEY program control statements. This statement can only occur once. The parameters are:
start
The position in the record at which the key starts.
length
The length of the key.

For VSAM keyed files, the KEY defaults to the actual key, although, as the files are processed sequentially, any field can be defined as the key for the purpose of specifying a range for record matching.

INCLUDE

Compare records only in the ranges defined by FROMKEYTOKEY or FROMRECCOUNT.

SKIP and INCLUDE are mutually exclusive.

IGNORE

Ignore records only in the ranges defined by FROMKEYTOKEY or FROMRECCOUNT.

SKIP and INCLUDE are mutually exclusive.

FROMKEY = ' value1 ' TOKEY = ' value1 '

Defines a range of records. value1 specifies the first record in the range, while value2 specifies the last record in the range. Hexadecimal values can be specified as x ' hhhhhh ' , where hhhhhh is a hexadecimal number.

FROMREC = recnum COUNT = count

Defines a range of record numbers, from record number x for the next y records.

FD = start , length

Defines a field to be ignored when comparing records. Used with INCLUDE only.

Example of Program Control Statements

In the following example:
  • The key field is defined as being the first ten bytes of the record
  • Records in the ranges AAAAAAAAAA to BBBBBBBBBB and WWWWWWWWW to ZZZZZZZZZZ are compared
  • Positions 11 to 15 and 21 to 25 are ignored in the second range
//SYSIN DD *
 KEY=(1,10)
 INCLUDE FROMKEY='AAAAAAAAAA' TOKEY='BBBBBBBBBB'
 INCLUDE FROMKEY='WWWWWWWWWW' TOKEY='YYYYYYYYYY'
 FD=(11,5)
 FD=(21,5)