UPDATA ACB MACRF=(KEY,SEQ, x
OUT)
LIST RPL ACB=UPDATA, UPD indicates the record may be stored x
AREA=WORK, back (or deleted). x
AREALEN=50, x
OPTCD=(KEY,SEQ, x
. SYN,UPD,MVE)
.
LOOP GET RPL=LIST
LTR 15,15
BNZ ERROR
Decide whether to update
the record.
BE LOOP Do not update it; retrieve another.
Update the record.
PUT RPL=LIST Store the record back.
LTR 15,15
BNZ ERROR
B LOOP
ERROR ... Request was not accepted, or failed.
.
WORK DS CL50 VSAM puts the retrieved record here.
A GET for update (OPTCD=UPD) must precede a PUT for update. Besides retrieving the record to be updated, GET positions VSAM at the record retrieved, in anticipation of the succeeding update (or deletion). It is not necessary for you to store back (or delete) the record you retrieved for update. VSAM's position at the record previously retrieved allows you to issue another GET to retrieve the following record. You cannot, however, store back the previous record: the position for update has been forgotten because of the following GET.