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

Dataset Allocation error with RC 12


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

New User


Joined: 31 Jan 2006
Posts: 39

PostPosted: Wed Jul 08, 2015 1:12 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 08, 2015 1:32 pm
Reply with quote

And did you Trace it?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Jul 08, 2015 2:08 pm
Reply with quote

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
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Wed Jul 08, 2015 5:00 pm
Reply with quote

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
View user's profile Send private message
Sumeendar

New User


Joined: 31 Jan 2006
Posts: 39

PostPosted: Thu Jul 09, 2015 10:39 am
Reply with quote

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
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 Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
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
Search our Forums:

Back to Top