Previous Topic: Specify the File Processing Mode

Next Topic: Work with Data

Specify the File Key

You can specify a file key on an &FILE statement in several ways. The way in which the value is specified on the KEY= operand is independent of the current processing mode (delimited, mapped, or unmapped). The value of the KEY= operand is interpreted as a character string by default. The value can be specified inside quotes, and substitution is carried out on any variables contained inside the quotes. You can put the letter X after the quotes to indicate that the data between the quotes is to be hexadecimal-packed to create the key.

Example: Specify the File Key

If &A=AAAA, both examples indicate a key of 'AAAA 0001':

KEY='&A 0001'
KEY='C1C1C1C140F0F0F0F1'X

also indicates a key of 'AAAA 0001'

There is also a KEYVAR= operand on the &FILE verb, which is an alternative to the KEY= operand. The KEYVAR operand is used to specify a variable whose contents is used as the key. For example, KEYVAR=A indicates that the contents of the variable &A is used as the key. In this case, if &A contains non-printable characters or trailing blanks, they appear in the key unchanged.