Joined: 08 Oct 2007 Posts: 36 Location: Columbia, SC
I'm created a REXX panel that will allow users to edit a formated PDS member, however I can't use ISPEXEC EDIT DATASET because the user
doesn't have to modify all records.
The pds where these members are located is a shared PDS, so multiple
users have access.
The question here is how do I allocate a single PDS member without
locking the entire PDS so that only one user can edit that
member...just like ISPEXEC EDIT DATASET does.
Here's what's I've tried:
I used ALLOC with MOD and OLD disposition, but that locks out the PDS
from additional ALLOCs, so that was no good.
I used LMINIT/LMOPEN/LMMFIND to get a member as ENQ(EXCLU) but that did not lock out the member. The closest I got was when I tried
ENQ(SHRW) and it would open the member once, but when I tried to open
it again, my session would freeze when I tried to open as output.
(see below) I wait until the user exits to perform my LMCLOSE and LMFREE.
I've ran QUERYENQ but it only lists the PDS and not the member while
the member is allocated.
I'd be happy with a way to determine if that member was already open in
my REXX, but idealy I want to open the member in my REXX, and ISPEXEC
EDIT DATASET would detect the member as already being edited.
I feel like I'm close, but missing one bit of the puzzle.
Joined: 08 Oct 2007 Posts: 36 Location: Columbia, SC
As an update, I found a service called ENQ (this particular one is part of REXXTOOLS, but I think there is a MVS version as well). This allowed me to add an entry to the ENQ table manually in the same manner ISPEXEC EDIT does. I was able to test to see if the member was already on this table prior to allocating in my rexx, and therefore was able to handle my situation. However, although I added it under the SPFEDIT ENQ, ISPEXEC EDIT stil let me edit it, and it too would add an entry in the table. That's not that big of a deal, but still a bit odd...
Here's the code for anyone who may come across this situation.
Code:
ENQREC = PDS||COPIES(' ',44 - LENGTH(PDS))||MEMBER
CALL ENQ 'SPFEDIT', ENQREC, 'E', 'SYSTEMS', 'TEST'
IF RC >= 4 THEN DO
SAY "MEMBER IS IN USE, OR COULD NOT BE OPEN"
EXIT 9
END
CALL ENQ 'SPFEDIT', ENQREC, 'E', 'SYSTEMS'