Dividing a file.

Ask/Clarify the questions on TSO, CLIST & REXX

Moderators: Veera, Moderator Group

Post Reply
Vishwanath G N
Member
Posts: 7
Joined: Sat Apr 06, 2013 9:11 am
Location: Chicago

Dividing a file.

Post by Vishwanath G N » Fri Apr 19, 2013 1:05 am

Hi All,

I have a file lets say with 990 records. I want to divide it into separate files with 100 records each and last few records in one file.

How can I do it using rexx.


Currently I am just reading the records in a stem with do loop I am segregating 100 records and writing them.


Is there any other simple way to do it?
Visi

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Fri Apr 19, 2013 10:47 pm

Use DFSort

But if you really need to do it in Rexx:

Code: Select all

0 - read a record
1 - allocate first output file
2 - do while not eof
3 - Read record
4 - write record
5 - increment counter
6 - when counter = 100
     set counter to 0
     close current file
     open next file
end do while
is one way to do it. The way you are doing it is another and probably simpler.
Regards
Nic

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others