Sometimes a program accessing a VSAM
data set reads many records but updates only a few of the records.
When a record is retrieved for update, no other user, including you,
can access that particular record or any other records in the same
control interval until you release the record by executing another
PUT or an INPUT statement for the data set. (This is significant when
a VSAM data set is simultaneously accessed by other users or by an
online system, such as CICS.) Use the UPDATE= option in the INFILE
statement to avoid user lockout when only a few of the records that
are retrieved need to be updated.
The UPDATE= option specifies
a numeric SAS variable that indicates whether a record is to be read
only or updated.
-
When you set the UPDATE= variable
to a value of 1 before an INPUT statement executes, the record is
retrieved for update. This is the same action that is taken if the
UPDATE= option is not specified.
-
When you set the UPDATE= variable
to a value of 0 before an INPUT statement executes, the record is
not retrieved for update.
If you retrieve a record
with the UPDATE= variable set to 0 (that is, the record is not retrieved
for update) and then decide that you do want to update the record,
reset the UPDATE= variable to 1, retrieve the record again, and then
update the record. This is possible only with direct access. If
you are reading the data set sequentially, you must keep track of
the records that you want to update (use a SAS data set for this)
and read them for update in a subsequent DATA step.