Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Read an input file in chunks :Machine storage exhausted

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Read an input file in chunks :Machine storage exhausted
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

Moderator Team Head


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

PostPosted: Wed Apr 11, 2007 10:57 pm    Post subject: Re: Read an input file in chunks
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: 8593
Location: Back in jolly old England

PostPosted: Wed Apr 11, 2007 11:21 pm    Post subject:
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    Post subject: Re: Read an input file in chunks :Machine storage exhausted
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: 8593
Location: Back in jolly old England

PostPosted: Thu Apr 12, 2007 1:25 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Sat May 26, 2007 7:21 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us