View previous topic :: View next topic
|
Author |
Message |
Rajimohan
New User
Joined: 23 Feb 2009 Posts: 2 Location: maryland, usa
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Please add a trace instruction
and show us the result. |
|
Back to top |
|
|
Rajimohan
New User
Joined: 23 Feb 2009 Posts: 2 Location: maryland, usa
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
I agree. I also don't like seeing ALLOCATES without the REUSE parameter. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
|