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

splitting a huge file into smaller ones using REXX


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

New User


Joined: 05 May 2008
Posts: 2
Location: hyderabad

PostPosted: Mon May 05, 2008 4:22 pm
Reply with quote

Hi
how do we split a huge file(around 65000 recs) into smaller recs using
REXX

below is a program for only 8 recs in a file

Code:

...                             
"EXECIO * DISKR INPUT (FINIS STEM INARRAY."                             
P = 1                                             
Q = 5                                             
DO WHILE P <= 7                                 
  DO I=P TO Q                                       
    SAY INARRAY.I
    QUEUE INARRAY.I           
  END       
  "EXECIO "QUEUED()" DISKW OUTPUT (FINIS"
  P = P+3                                           
  Q = Q+3                                           
END 


thr is an error regd the allocation of output file,
we are not understanding how to put the split output into a separate output file.

thanks & Regards
bina
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 05, 2008 4:33 pm
Reply with quote

Quote:

thr is an error regd the allocation of output file,


well if it is error rex000199 then you have allocated a file on tape.

if the error is rex0001998 then you have to many do loops.

if the error is not one of the above, it might be helpful to see a trace and error list. otherwise, you will have to debug on your own.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Mon May 05, 2008 5:07 pm
Reply with quote

1. Read a record. When EOF, close the input, the output, and exit.
2. Add 1 to the input record count.
3. If less than the split value, push record to the stack. Else, close the output, create a new stack, reset the input record count, then push the record to the stack, and assign a new DD to the output.
4. Write record to output.
5. Goto 1.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon May 05, 2008 5:45 pm
Reply with quote

1. If you want a relevant answer, you have to give all the information:
Do you want to split the file on a specific value in the record, or just by counting ?

2. In both case, you should consider using SORT. It will be faster than any REXX you can write.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Mon May 05, 2008 5:50 pm
Reply with quote

yes, IMHO Rexx is not the proper tool for this task, as Marso, I think you should try sort (dfsort, Syncsort...) they have specific options to split a file.
Back to top
View user's profile Send private message
Bina reddy nalla

New User


Joined: 05 May 2008
Posts: 2
Location: hyderabad

PostPosted: Wed May 07, 2008 10:36 am
Reply with quote

Thanks all
i wil try using syncSORT or dfSORT
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
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
No new posts Running REXX through JOB CLIST & REXX 13
Search our Forums:

Back to Top