View previous topic :: View next topic
|
Author |
Message |
VijayKrish
New User
Joined: 30 Jun 2010 Posts: 10 Location: India
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Are you running concurrently using DISP=OLD |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
VijayKrish
New User
Joined: 30 Jun 2010 Posts: 10 Location: India
|
|
|
|
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 |
|
|
|