Previous Page | Next Page

Accessing VSAM Data Sets

VSAM Options for the FILE and INFILE Statements

You can use the following options for VSAM files in the FILE statement and in the INFILE statement. (Unless otherwise indicated, the option can be used in both.)

BACKWARD | BKWD

causes SAS to read the VSAM data set backwards (INFILE only).

BUFND=value

indicates how many data buffers to use for the VSAM data set.

BUFNI=value

indicates how many index buffers to use for the VSAM data set.

CONTROLINTERVAL | CTLINTV | CNV

indicates that you want to read physical VSAM control interval records rather than logical records. This option is typically used for diagnostic purposes (INFILE only).

ERASE=variable

defines a numeric SAS variable that you must set to 1 when you want to erase a VSAM record (INFILE only).

FEEDBACK=variable | FDBK=variable

defines a numeric variable that SAS sets to the VSAM logical error code. This option is similar to the _FDBK_ automatic variable. When SAS sets the FEEDBACK variable, you must reset it to 0 in order to continue.

GENKEY

causes SAS to use the KEY= variable as the leading portion of a record's key. VSAM retrieves the first record whose key matches the generic key (INFILE only).

KEY=variable | KEY=(variable1 variable2 . . . )

indicates that direct keyed access is being used to read records either from a KSDS or from an ESDS via an alternate index. Also, the variable contains the key value to be used in the retrieval of a record (input) or the writing of a record (output) (INFILE ONLY).

KEYGE

is used in conjunction with the KEY= option. KEYGE indicates that when KEY= is used in a retrieval request, SAS retrieves any record whose key is equal to or greater than the specified key. This option is useful when the exact key is not known (INFILE only).

KEYLEN=variable

specifies a numeric SAS variable that, when used with GENKEY, specifies the length of the key that is to be compared to the keys in the file.

KEYPOS=variable

indicates the numeric variable that SAS sets to the position of the VSAM key field. This option enables you to read keys without knowing the key position in advance. This variable is set to the column number (starting from 1).

NRLS

specifies not to use record-level sharing (RLS) to open an RLS-eligible data set (INFILE only).

PASSWD=value

gives the appropriate password for a VSAM data set that has password protection.

RBA=variable

specifies a numeric variable that you set to the relative byte address (RBA) of the data record that you want to read. The RBA= option indicates that addressed direct access is being used; it is appropriate for KSDS and ESDS. If you specify the CONTROLINTERVAL option, you can use the RBA= option to access control records in an RRDS (INFILE only).

RC4STOP

stops the DATA step from executing if a return code greater than 4 is returned by the operating environment when the VSAM data set is opened.

RECORDS=variable

defines a numeric variable that SAS sets to the number of logical records in a VSAM data set that has been opened for input.

RECORG=record-organization

specifies the organization of records in a new VSAM data set. Use this option only if SMS is active. The following is a list of valid values:

KS

specifies a VSAM key-sequenced data set.

ES

specifies a VSAM entry-sequenced data set.

RR

specifies a VSAM relative-record data set.

LS

specifies a VSAM linear-space data set.

RESET

indicates that the VSAM file is reset to empty (no records) when it is opened. This option applies only to loading a VSAM data set that has been marked REUSE. You cannot use this option if the data set contains an alternate index.

RRN=variable

defines a numeric variable that you set to the relative record number (RRN) of the record that you want to read or write. This option indicates that keyed direct access is being used; it is appropriate for RRDS only.

SEQUENTIAL

specifies sequential VSAM record retrieval when either the RBA= (for an ESDS) or the RRN= option (for an RRDS) is specified (INFILE only).

SKIP

indicates skip-sequential processing of VSAM files. Skip-sequential processing finds the first record whose value is the same as the value that is specified by the KEY= option; records are read sequentially from then on (INFILE only).

UPDATE=variable

defines a numeric SAS variable that indicates that not every record that it reads is to be updated. Use this option when you are updating records in a VSAM data set (INFILE only). When an INFILE and a FILE statement reference the same VSAM data set, records are retrieved for update by default.

In most cases when you retrieve a record for update, no user, including you, can access that particular record or any other records in the same control interval until you free the record by executing a PUT or an INPUT statement for the data set. The UPDATE= option avoids user lockout when only a few of many records read need to be updated. When you set the UPDATE= variable to a value of 1 before the INPUT statement, the record is retrieved for update. This value is the default if UPDATE= is not specified. If you set UPDATE=0 before the INPUT statement, the record is not retrieved for update.

Previous Page | Next Page | Top of Page