KEY control statement
This statement specifies the physical record in a KSDS to be verified or changed.
The KEY control statement has two formats. When the key of a VSAM record can be specified in a single line, use this format:
KEY key
When the key of a VSAM record is too long to specify in one line, it can be specified using several lines as follows:
KEY continued-key,
continued-key,
.
.
continued-key
- key
- The fully qualified key of the VSAM record. It must be specified
in a single line. It can be specified as any one of the following
expressions:
- A character string (for example, ABCD)
- A character literal (for example, C'ABCD')
- A hexadecimal expression that consists of an even number of digits (for example, X'C1C2C3C4'). A leading zero must be added to an odd number of digits (for example, X'0FFFFF').
When a key is specified as a character literal and the key contains one or more single quotes ('), the quotes must be specified as two consecutive single quotes (''). When a key is specified as a character string, a blank cannot appear within a key field. When the data set key has one or more blanks, use the character literal or the hexadecimal format.
- continued-key
- The portion of the long VSAM key. The fully qualified key of the
VSAM record can be specified on several lines using continued-keys.
Continued-keys can be specified as either of the following expressions
or a combination of the expressions:
- A character literal (for example, C'ABCD')
- A hexadecimal expression that consists of an even number of digits (for example, X'C1C2C3C4'). A leading zero must be added to an odd number of digits (for example, X'0FFFFF').
The continued-key in each line must end with a comma (,) except for the last line. A comment can follow any continued-key separated by at least one blank, even when the continued-key ends with a comma.
The total length of the VSAM key that you specify on the KEY control statement must be equal to the length of the key for the data set. Otherwise, a logical error occurs.