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

Free Dataset Allocation


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
VijayKrish

New User


Joined: 30 Jun 2010
Posts: 10
Location: India

PostPosted: Mon Jul 19, 2010 2:39 pm
Reply with quote

I have a REXX program which allocates and writes some data to a PS. When the program is executed everytime, this dataset is deleted and a new one is created. When i run with my TSO id it runs fine. But when another user tries to run the same REXX program, it throws error message "Dataset already in Use". I am not sure if there is any thing wrong with the allocation parameters. Please help me out.

Below is the code:

Code:

OUTPS = "LLD.DRF.RECOMP.MODULES"   
MSG =  SYSDSN("'"OUTPS"'")         
X=MSG(OFF)                         
IF MSG = 'OK' THEN DO               
   ADDRESS TSO "DELETE '"OUTPS"'"   
END                                 
X=MSG(ON)                           
 L_RECL = 500 
 REC_FM = 'F B'
ADDRESS TSO "ALLOCATE DS("OUTPS") NEW SPACE(14,500)", 
            "LRECL("L_RECL") RECFM("REC_FM"),         
             DSORG(PS)"                               
ADDRESS TSO "ALLOC DA("OUTPS") F(XXOUT) OLD"           

                     "EXECIO" LOT.0 "DISKW XXOUT (STEM LOT."

 LOT.1= MEMNAME
 LOT.0=1       

 "EXECIO * DISKW XXOUT (FINIS"           
 "FREE F(XXOUT)"         
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Jul 19, 2010 3:50 pm
Reply with quote

Are you running concurrently using DISP=OLD
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 19, 2010 3:56 pm
Reply with quote

what is the purpose of this ds?

if everyone can use the REXX,
then as soon as one user has successfully executed the REXX,
before he can access the ds - for whatever purpose -
the next user executes the REXX, changes the ds and it is useless for the previous user.

without knowing 'the purpose of the ds', I would hazard a suggestion, that the HLQ be the USERID,
at least that way, user 1 could have use of the data in the ds before user 2 deletes and populates with his own data.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Jul 19, 2010 4:10 pm
Reply with quote

Unless the object is to get a list of modules to recompile
(psychic day special & a quick read of the REXX).
In which case only ONE user at any time will be able to allocate the dataset and in effect run the REXX.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Mon Jul 19, 2010 8:10 pm
Reply with quote

Hi Vijay,

First off, I agree with Dick that each user having their own version of the dataset would be preferable.

What I do is create a dataset that has a HLQ that is deleted by the system after a certain time to avoid cluter. This HLQ would be know by your storage people. The second node is then the user id.

Secondly, looking at you code, it appears to incomplete. You must have deceided what is relevant, and expected the people here to figure out the problem based what you determined to be important.

I would change some of that code as follows. See added comments.

Code:

OUTPS = "LLD.DRF.RECOMP.MODULES"   
MSG =  SYSDSN("'"OUTPS"'")         
X=MSG(OFF)

/* If file already exists then allocate as SHR */
/* Why delete and reallocate it */                         
IF MSG = 'OK' THEN DO
    ADDRESS TSO "ALLOC DA("OUTPS") F(XXOUT) SHR" 
END                                 
X=MSG(ON)
ELSE DO                           
  L_RECL = 500 
  REC_FM = 'F B'
 /*You did not give a file here I added F(XXXOUT)*/                               
  ADDRESS TSO "ALLOCATE DS("OUTPS") NEW SPACE(14,500)", 
  "LRECL("L_RECL") RECFM("REC_FM"),         
   DSORG(PS)  F(XXXOUT)"  ADDRESS TSO "ALLOC DA("OUTPS")
END

/* Why are you allocating it as old now */
F(XXOUT) OLD"           

                     "EXECIO" LOT.0 "DISKW XXOUT (STEM LOT."

 LOT.1= MEMNAME
 LOT.0=1        /* I did not think you can change the .0 and it work*/

 "EXECIO * DISKW XXOUT (FINIS"  /* why not 0 intead of  * */           
 "FREE F(XXOUT)"         
Back to top
View user's profile Send private message
VijayKrish

New User


Joined: 30 Jun 2010
Posts: 10
Location: India

PostPosted: Tue Jul 20, 2010 4:27 pm
Reply with quote

I missed out giving the file in allocate statement which was causing the problem. Now it is running fine. Also i had changed the dataset names with userid as HLQ. Thanks for all your suggestion and quick response.
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top