At 07:09 -0700 on 08/01/2006, Edward Jaffe wrote about Re: Data set ENQueues and DEQueues in Jobs:

Paul Gilmartin wrote:
Likewise, if RET=CHNG were not available, you could equally well
simply DEQ and re-ENQ  with EXCL scope.


No. Holding a shared ENQ prevents others from acquiring an exclusive ENQ on the same resource and modifying it. To maintain the integrity of the resource, you use RET=CHNG to upgrade from shared to exclusive without losing control. If you were required to DEQ and then re-ENQ to perform the upgrade, you would lose control of the resource between the time you inspected it and the time you had the necessary serialization to update it. In the worst case scenario, someone else could change (or even delete) the resource in-between!!

If there are others with a SHARED ENQ, attempting a RET=CHNG will either put you into a wait (possibly triggering a deadly embrace if you hold another SHR or EXC ENQ that some other task wants to go to EXC status on) or return a failure RC and require you to recover by attempting it again. It is MUCH better to get the EXC initially and later drop back to SHR (assuming that once you have done the code that needs the EXC you can live with just read access) but IBM has not provided this useful capability.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to