View previous topic :: View next topic
|
Author |
Message |
sandra
New User
Joined: 06 Apr 2005 Posts: 27
|
|
|
|
I have an input file with millions of records and when I am executing the REXX through JCL it is giving the error "Machine storage exhausted"
Could some one help me how the file could be read in ?chucks? at a time.
Currently the code in REXX is
"EXECIO * DISKR ACCOUNTS (STEM R." |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
This is what I've used before
Code: |
CNT = 0
EOF = 0
DO FOREVER UNTIL(EOF)
"EXECIO 500 DISKR CNTIN ( STEM TST."
IF RC <> 0 THEN EOF = 1
CNT = CNT + TST.0
END
SAY "COUNT IS " CNT
"EXECIO 0 DISKR CNTIN ( FINIS"
"FREE FI(CNTIN)"
|
|
|
Back to top |
|
|
sandra
New User
Joined: 06 Apr 2005 Posts: 27
|
|
|
|
Code: |
"EXECIO * DISKR CNTLAA13 (STEM CNTLAA13. FINI"
if rc \= 0 then do
say "CNTLAA13 - RC =" rc " on open. Program terminating"
exit 8
end if
inputRecs = CNTLAA13.0
if inputrecs = 0 then do
outputRecs = 0
return
end if
/* Process each record on the input file */
true = 1
false = 0
IDTNdate = date(S) || delstr(delstr(time(N),6,1),3,1)
drop STY.
STY.1 = "JKHDJCNJDCHNSHNANXBHND CDBNB" || IDTNdate ||,
"L_AG6L_CIS " || TestFlag
STY.0 = 1
do ix = 1 to CNTLAA13.0
parse var CNTLAA13.ix G01Set 1535 G07Set
VG = STY.0 + 1
STY.VG = G01Set
VG = VG + 1
STY.VG = G07Set
STY.0 = VG
end /* ix */
drop CNTLAA13.
VG = STY.0 + 1
STY.VG = "NCDCHFCVNSJCNJN" NKNDCJNCJ
STY.0 = VG
"EXECIO * DISKW CNTLAA14O (stem STY. FINI"
if rc \= 0 then do
say "CNTLAA14O - RC =" rc " on write. Program terminating"
exit 8
end if
outputRecs = STY.0
return
|
Expat,
I tried with the changes you had suggested but the job is failing with
CNTLAA13 - RC = 2 on open. Program terminating
Please find the above mentioned source code. I am not very good in REXX. Could you please let me know where I need to make the change.
Thanks a lot |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Quote: |
I am not very good in REXX. |
And what makes you think I'm any better
I'd probably do something like this
Code: |
true = 1
false = 0
IDTNdate = date(S) || delstr(delstr(time(N),6,1),3,1)
QUEUE "JKHDJCNJDCHNSHNANXBHND CDBNB" || IDTNdate ||, "L_AG6L_CIS " || TestFlag
EOF = 0
DO FOREVER UNTIL(EOF)
"EXECIO 500 DISKR CNTIN ( STEM TST."
IF RC <> 0 THEN EOF = 1
do ix = 1 to CNTLAA13.0
parse var CNTLAA13.ix G01Set 1535 G07Set
QUEUE G01Set
QUEUE G07Set
end /* ix */
"EXECIO " QUEUED() " DISKW CNTLAA14O"
END
"EXECIO 0 DISKR CNTIN ( FINIS"
QUEUE "NCDCHFCVNSJCNJN" NKNDCJNCJ
"EXECIO " QUEUED() " DISKW CNTLAA14O ( FINIS"
|
Maybe I will get a bit of time to play later. Boss man wasn't supposed to be here today, but ......................
From what you're doing here, is it possible that you could use SORT for this .......... because SORT is far far faster and efficient. |
|
Back to top |
|
|
sandra
New User
Joined: 06 Apr 2005 Posts: 27
|
|
|
|
Thanks Expat..The code is working now.....Yes, I could have used the sort, but this a prod code that requires modification.
A problem we have here is when the input file is empty, the header and trailer reccords are written to the output file, where as no records needs to be wriiten out to the file in that case. Could u please help me on this.
How do I check if a file is empty???? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Easiest way .................
1) Set up the output file as null file
2) Use IDCAMS to determine if the input file has data or not. There are lots of examples in the forum on how to do this.
3) If the file is empty then bypass the REXX step, else process it. |
|
Back to top |
|
|
|