When you add records
to an existing VSAM data set, you must do the following:
-
-
Include
both an INFILE statement and a FILE statement with
the same fileref and the VSAM option in the DATA step. Specify any
other options in the INFILE statement, which must precede the FILE
statement.
Note: Because VSAM options are
specified in the INFILE statement, this statement has the extra function
of setting up how an operation is to be performed. Because of this
setup function, the INFILE statement is sometimes used without a corresponding
INPUT statement.
Ordinarily, the INFILE
statement identifies an external data set to be read by an INPUT statement.
However, when you add new records to an existing VSAM data set, you
can use the INFILE statement without a corresponding INPUT statement.
That is, without reading a record because VSAM knows where to put
the new records. Records are added in the following methods:
-
In an ESDS, records are added in
entry order. Therefore, new records are always added with sequential
access to the end of the data set.
-
In a KSDS, records are added with
direct access. KSDS records are ordered by the prime key, which is
part of the record itself.
-
In an RRDS, records are added with
direct access. Because records are added by specifying the RRN, the
RRN of a new record
must be given via the
value of the RRN= variable.
To add a new RRDS record,
you
must set the RRN= variable to the value
of an empty relative-record slot (number) before the PUT statement
executes.