Joined: 01 Jan 2010 Posts: 1 Location: Boise, Idaho
I have a situation where multiple iterations of the same batch program will execute within multiple batch jobs (multiple address spaces) and will concurrently add unique records to the same VSAM KSDS file, SHAREOPTION(3,3). I am aware that I need to employ ENQ/DEQ processing for write integrity, including OPEN and CLOSE processing, to eliminate possible VSAM program checks, lost or inaccessible data, uncorrectable data set failures, and other unpredictable results.
Current referenced materials include:
MVS Authorized Assembler Services Guide
MVS Authorized Assembler Services Reference
DFSMS/MVS Using Data Sets
I could not find any coding examples employing the ENQ and DEQ macros. Can anyone provide me with, or direct me to, ENQ/DEQ coding examples?
Also, I am not clear on the required usage of ENQ/DEQ processing as defined above. That is, should my batch program issue an ENQ then issue an OPEN for the data set, then issue a DEQ. Then issue an ENQ for a PUT (write) of a record, then issue a DEQ, for each record written to the file. Then issue an ENQ for a CLOSE of the data set, and then issue a DEQ. Can anyone provide a detailed definition of the ENQ/DEQ processing I need to employ in my batch program?
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
Hello and welcome to the forum,
Probably not what you want to hear, but as this is something new, you might consider using database to do what you need rather than vsam. . . Possibly the biggest single advantage of database is the concurrent update capability that is managed by the system.
Do you intend to "lock out" the entire vsam file or only some set of keys for each process? Something else?
One of the disadvantages/concerns of a roll-your-own enq/deq is that there is no way to enforce compliance. If someone runs code that does not follow the enq "rules", data can be corrupted/lost. Another is the situation where an enq is issued and not released and lots of processes come to a grinding halt.