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

Free DA Return code = 12


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

New User


Joined: 23 Feb 2009
Posts: 2
Location: maryland, usa

PostPosted: Tue Mar 03, 2009 8:59 pm
Reply with quote

Hi,

I am in the process of testing a REXX program, and received a return code of 12 while trying to free the Dataset.


Code:

"ALLOC DA('"CPYIN"') FI(RCDIN) SHR"               
VMCC = RC                                         
IF VMCC = 0 THEN                                 
   DO                                             
   "CALL 'SSA.ET995.LOAD(CKBLKCTL)'"             
    DMCC = RC                                     
     IF DMCC > 0 THEN                             
      DO                                         
      SAY "       FILE " CPYIN                   
      SAY "         IS EMPTY, READING NEXT RECORD"
      SIGNAL READEREC                             
      END                                         
   END                                           
"FREE DA('"CPYIN"')"                     
IF DMCC = 0 THEN                                     
  DO                                                 
     IF CNTYPE = "AFP" THEN                         
     DO                                             
       ISPEXEC FTCLOSE                               
       ISPEXEC FTOPEN TEMP                           
       ISPEXEC FTINCL CNREGAFP                       
          VMCC = RC                                 
         IF VMCC \= 0 THEN                           
            DO                                       
              ISPEXEC SETMSG MSG(VALID002)           
              SIGNAL FINI                           
            END                                     
         IF VMCC = 0 THEN                           
            DO                                       
              ISPEXEC FTCLOSE                       
              ISPEXEC VGET ZTEMPF ASIS               
         


Input File used for testing contains 2 to 3 different files, one of them is empty. For example the input file REGR.TEST.FY08.REGR.DATA, has the following data:


ABC.XYZ
DEF.XYZ.EMPTY
TEST1.FILE
ENDOFFILE


Of the above files, second file ie DEF.XYZ.EMPTY is empty.

The program processes the first two files successfully. But when the control comes to the third file, we get a RC =12 while performing the statement "FREE DA('"CPYIN"')" and so control does not go to the IF statement.

We tested with different types of input files. But it looks like whenever it tries to process a file after the empty file, it gives a RC of 12 (for FREE DA).

Please let us know what might have gone wrong in the code so that it would process all the files (irrespective of whether it is before or after the empty file) that are mentioned in the input file.

Please let me know if you have any questions.

Thanks,
Raj
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Tue Mar 03, 2009 10:19 pm
Reply with quote

Please add a trace instruction
Code:
TRACE('R')

and show us the result.
Back to top
View user's profile Send private message
Rajimohan

New User


Joined: 23 Feb 2009
Posts: 2
Location: maryland, usa

PostPosted: Wed Mar 04, 2009 1:35 am
Reply with quote

Hi,

Thanks for the response, I tried with the TRACE ('R'), following is the output.

The filenames

MIRSSA.ET994.AUG084.NOT02.IUMIRNOT.SKELCOMP and MIRSSA.ET994.AUG08.BD05.IUMIRNOT.SKELCOMP, are the subsequent files after the empty file in the input Dataset (please refer my previous post)

Code:

"EXECIO 1 DISKR EFILEIN"                     
  "EXECIO 1 DISKR EFILEIN"                   
PULL ENRCD                                   
  "MIRSSA.ET994.AUG084.NOT02.IUMIRNOT.SKELCOMP
    "                                         
IF ENRCD = "ENDOFFILE"                       
  "0"                                         
APPLID = SUBSTR(ENRCD,1,3)                   
  "MIR"                                       
CPYIN  = SUBSTR(ENRCD,4,47)                   
  "SSA.ET994.AUG084.NOT02.IUMIRNOT.SKELCOMP   
     CPYIN  = STRIP(CPYIN)                                           
          "SSA.ET994.AUG084.NOT02.IUMIRNOT.SKELCOMP"                     
     /* THE FOLLOWING REMOVES TRAILING BLANKS */                     
    DSNM = STRIP( CPYIN )                                           
          "SSA.ET994.AUG084.NOT02.IUMIRNOT.SKELCOMP"                     
     "ISPEXEC VPUT("CPYIN") SHARED"                                   
       >>>   "ISPEXEC VPUT(SSA.ET994.AUG084.NOT02.IUMIRNOT.SKELCOMP) SHARED"
       +++ RC(20) +++                                                       
    SAY "PROCESSING FILE " CPYIN                                     
          "PROCESSING FILE  SSA.ET994.AUG084.NOT02.IUMIRNOT.SKELCOMP"   
PROCESSING FILE  SSA.ET994.AUG084.NOT02.IUMIRNOT.SKELCOMP   
...........................               

"ALLOC DA('"CPYIN"') FI(RCDIN) SHR"                                 
  "ALLOC DA('SSA.ET994.AUG084.NOT02.IUMIRNOT.SKELCOMP') FI(RCDIN) SHR
                                                                   
RC(12) +++                                                         
VMCC = RC                                                           
  "12"                                                             
IF VMCC = 0                                                         
  "0"                                                               
"FREE DA('"CPYIN"')"                                               
  "FREE DA('SSA.ET994.AUG084.NOT02.IUMIRNOT.SKELCOMP')"             
RC(12) +++                                                         
IF DMCC = 0                                                         
  "0"                                                               
JOBNU = JOBNU+1                             
  "12"                                     
SIGNAL READEREC                             
READEREC:                                   
IF JOBNU > 99                               
  "0"                                       
"EXECIO 1 DISKR EFILEIN"                   
  "EXECIO 1 DISKR EFILEIN"                 
PULL ENRCD                                 
  "MIRSSA.ET994.AUG08.BD05.IUMIRNOT.SKELCOMP
    "                                       
IF ENRCD = "ENDOFFILE"                     
  "0"                                       
APPLID = SUBSTR(ENRCD,1,3)                 
  "MIR"                                     
CPYIN  = SUBSTR(ENRCD,4,47)                 
  "SSA.ET994.AUG08.BD05.IUMIRNOT.SKELCOMP   
CPYIN  = STRIP(CPYIN)                       
  "SSA.ET994.AUG08.BD05.IUMIRNOT.SKELCOMP" 
/* THE FOLLOWING REMOVES TRAILING BLANKS */
DSNM = STRIP( CPYIN )                       
  "SSA.ET994.AUG08.BD05.IUMIRNOT.SKELCOMP" 
"ISPEXEC VPUT("CPYIN") SHARED"             
       >>>   "ISPEXEC VPUT(SSA.ET994.AUG08.BD05.IUMIRNOT.SKELCOMP) SHARED"
       +++ RC(20) +++                                                     
    99 *-* SAY "PROCESSING FILE " CPYIN                                   
       >>>   "PROCESSING FILE  SSA.ET994.AUG08.BD05.IUMIRNOT.SKELCOMP"   
PROCESSING FILE  SSA.ET994.AUG08.BD05.IUMIRNOT.SKELCOMP                   
"ALLOC DA('"CPYIN"') FI(RCDIN) SHR"                                 
  "ALLOC DA('SSA.ET994.AUG08.BD05.IUMIRNOT.SKELCOMP') FI(RCDIN) SHR"
RC(12) +++                                                         
VMCC = RC                                                           
  "12"                                                             
IF VMCC = 0                                                         
  "0"                                                               
"FREE DA('"CPYIN"')"                                               
  "FREE DA('SSA.ET994.AUG08.BD05.IUMIRNOT.SKELCOMP')"               
RC(12) +++                                                         
IF DMCC = 0                                                         


Please let me know, why I am getting RC=12 for FREE DA for both the datasets mentioned above.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Wed Mar 04, 2009 1:57 am
Reply with quote

I think you should only FREE it if you had first successfully allocated it.

And my preference is to FREE by ddname, rather than by dataset name.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Mar 04, 2009 2:09 am
Reply with quote

I agree. I also don't like seeing ALLOCATES without the REUSE parameter.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Mar 04, 2009 12:28 pm
Reply with quote

Code:

     "ISPEXEC VPUT("CPYIN") SHARED"                                   
       >>>   "ISPEXEC VPUT(SSA.ET994.AUG084.NOT02.IUMIRNOT.SKELCOMP) SHARED"
       +++ RC(20) +++                                                       

Correct the first error shown and then work through the others, unless of course some of them disappear after correcting the first one.
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 run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
Search our Forums:

Back to Top