BLOCK ACB MACRF=(SEQ, x
DIR),STRNO=2
SEQ RPL ACB=BLOCK, VSAM must remember its position. x
OPTCD=SEQ
DIRUPD RPL ACB=BLOCK, VSAM must remember its position and maintain x
OPTCD=(DIR,UPD) exclusive control until explicitly requested x
. to forget it by PUT or ENDREQ.
.
LOOP GET RPL=SEQ VSAM now remembers its position for x
this request only while it is
LTR 15,15 processing the request.
BNZ ERROR
GET RPL=DIRUPD VSAM can remember its position for this x
request.
LTR 15,15 The control interval will be placed in x
exclusive control until either
BNZ ERROR ENDREQ or PUT UPD is issued.
Decide
whether to update the record:
B FORGET No; do not update the record.
PUT RPL=DIRUPD Yes; update the record, causing VSAM x
to forget its position for DIRUP.
LTR 15,15
BNZ ERROR
B LOOP
FORGET ENDREQ RPL=DIRUPD Cause VSAM to forget its position for DIRUPD.
LTR 15,15 Release exclusive control.
BNZ ERROR
B LOOP
ERROR xxx Request wasn't accepted or failed.
The use of ENDREQ shown here causes VSAM to release exclusive control of the control interval for a record. When PUT is issued after a DIRUPD GET request, ENDREQ need not be issued, because PUT causes VSAM to release exclusive control (the next DIRUPD GET does not depend on VSAM's remembering its position). Another result of ENDREQ is that current buffers are written if they have been modified.
To cause VSAM to give up its position associated with a chain of request parameter lists, specify the first request parameter list in the chain in your ENDREQ macro.
ENDREQ can also be used to cancel an asynchronous request, rather than suspending processing with CHECK.
Because VSAM remembers its position after a direct GET with OPTCD=UPD, LOC or (NUP, NSP), if no PUT or ENDREQ follows, you can switch to sequential access and use the positioning for a GET.
Requirement: If you are sharing subtasks or if you have issued an asynchronous request for access to a data set, you must issue a CHECK or an ENDREQ on all RPLs before you issue a CLOSE or CLOSE TYPE=T. Otherwise, concurrent data set I/O activity causes unpredictable results during a close.