IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to 'lock' a PDS member...


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Josh Keller

New User


Joined: 08 Oct 2007
Posts: 36
Location: Columbia, SC

PostPosted: Tue Oct 09, 2007 9:57 pm
Reply with quote

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.


Code:
ADDRESS "ISPEXEC"
  "LMINIT  DATAID("DIDAPS") DATASET('"PDS"') ENQ(SHRW)"
  "LMQUERY DATAID("DIDAPS") PROJECT(PRJV) GROUP1(GRP1V)",
                 "GROUP2(GRP2V) GROUP3(GRP3V) GROUP4(GRP4V)",
                 "TYPE(TYPEV) "


  "LMOPEN  DATAID("DIDAPS") OPTION(INPUT)"
  "LMMFIND DATAID("DIDAPS") MEMBER("MBR")",
  "                 LRECL(LENVAR)  RECFM(FORMVAR)",
  "                 GROUP(GRPVAR) "



Thanks for any help.
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Tue Oct 09, 2007 10:51 pm
Reply with quote

I use something like this. Let's call this REXXPGM.

Code:

/*************************REXX*******************/ 
PARSE UPPER ARG MEMBER                                               
DSN1= "('HLQ.PDS.DATASET')"                                           
IF JOBFIND ¬= "" THEN SIGNAL FINDMEM                                 
ISPEXEC "EDIT DATASET"||DSN1                                           
EXIT                                                                   
FINDMEM:                                                               
   DSN1= "('HLQ.PDS.DATASET("||MEMBER||")')"                         
   ISPEXEC "EDIT DATASET"||DSN1                                       
   EXIT                                                               
END                                                                   


If you want to view the whole PDS, you enter TSO REXXPGM.

If you want to view a specific member, you enter TSO REXXPGM MEMNAME.

If you want to view all member starting with PROG, you enter TSO REXXPGM PROG*.

There has never been any contention issues with this setup.
Back to top
View user's profile Send private message
Josh Keller

New User


Joined: 08 Oct 2007
Posts: 36
Location: Columbia, SC

PostPosted: Wed Oct 10, 2007 8:46 pm
Reply with quote

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'
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Lock Escalation DB2 3
No new posts How to copy the -1 version of a membe... TSO/ISPF 4
No new posts Searching for a member but don't know... TSO/ISPF 6
No new posts Looking For a PDS Member Without Open... PL/I & Assembler 10
No new posts Library member auto insert option TSO/ISPF 3
Search our Forums:

Back to Top