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

Read an input file in chunks :Machine storage exhausted


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

New User


Joined: 06 Apr 2005
Posts: 27

PostPosted: Wed Apr 11, 2007 10:24 pm
Reply with quote

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

Global Moderator


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

PostPosted: Wed Apr 11, 2007 10:57 pm
Reply with quote

This topic has a good example.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Apr 11, 2007 11:21 pm
Reply with quote

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

New User


Joined: 06 Apr 2005
Posts: 27

PostPosted: Wed Apr 11, 2007 11:49 pm
Reply with quote

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

Global Moderator


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

PostPosted: Thu Apr 12, 2007 1:25 pm
Reply with quote

Quote:
I am not very good in REXX.

And what makes you think I'm any better icon_confused.gif

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 ...................... icon_eek.gif

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

New User


Joined: 06 Apr 2005
Posts: 27

PostPosted: Sat May 26, 2007 6:05 pm
Reply with quote

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

Global Moderator


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

PostPosted: Sat May 26, 2007 7:21 pm
Reply with quote

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
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top