View previous topic :: View next topic
|
Author |
Message |
Sumeendar
New User
Joined: 31 Jan 2006 Posts: 39
|
|
|
|
I am trying to allocate mutilple datasets through a loop. however after i allocate 1st dataset, i am unable to allocate the 2nd dataset.
The 1st dataset is correctly allocated. the 2nd dataset when try to allocate fails with RC 12
The 2nd dataset when tried seperately is getting allocated.
here is my piece of code where i am reading a file and allcating a dataset based on file content through a loop
Code: |
DO WHILE EOF = 'NO'
"EXECIO 1 DISKR PARMS"
IF RC = 2 THEN
DO
EOF = 'YES'
SIGNAL EXIT
END
ELSE
PARSE PULL in_rec
parms_read = parms_read+1
membr = (STRIP(SUBSTR(in_rec,01,8)))
call_retcode = 0
schd_dsn = user||'.T.CSP.Q.'||membr
dsnfnd = LISTDSI("'"schd_dsn"'") /* If data set already exist, */
/* delete it. */
IF sysreason = 0 THEN DO
"DELETE '"schd_dsn"'"
END
"ALLOC FI(OUTFILE) NEW SP(5 5) TR DSORG(PS) RECFM(F B)
LRECL(80) DSN('"schd_dsn"')"
SAY '****************'
SAY 'RETURN CODE '||RC
SAY 'REASON CODE '||sysreason
SAY '****************'
IF RC \= 0 THEN DO
SAY ' E Error allocating '||schd_dsn
/* SIGNAL ERROR */
END
CALL BUILD_JCL_SYMBOLICS
CALL WRITE_RECORD
"FREE F(OUTFILE)"
END
RETURN call_retcode
END |
I am not able to get the issue behind alloication.
Kindly help me
Thanks |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
And did you Trace it? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
It would help if you got all your code properly aligned. If that is how it appears on your ISPF screen then may the deities help whoever has to look after your code in the future.
And stop mucking about with unnecessary code:
Code: |
read a record
do while rc = 0
do the work
read next record
end
|
|
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
Works once, huh?
Are you using FILE(OUTFILE) in every allocation? That seems to me to be the most likely issue.
TSO/E Command Reference for your z/OS release just shows return codes 0 and 12 for the ALLOCATE command. Return code 12 shows "Allocation unsuccessful. An error message has been issued."
The ALLOCATE command generally issues fairly decent messages when something goes wrong. What messages did the second allocation issue? |
|
Back to top |
|
|
Sumeendar
New User
Joined: 31 Jan 2006 Posts: 39
|
|
|
|
i am able to resolve the issue. I missed to add below statements
Code: |
"EXECIO 0 DISKW OUTFILE(FINIS"
"FREE F(OUTFILE)" |
|
|
Back to top |
|
|
|