Howard Brazee wrote:

>I need to create a routine that can be used with a bunch of different 
extracts to split files into new files of 100,000 records each.  They need to 
be 
FTPd to the same location with different names, but I don't want to create 
empty files on the mainframe nor on the destination machine.

Two solutions: One with two reading of input and another solution requiring a 
liitle programming, but with ONE reading of input.

1. Try DFSORT/ICETOOLS splitting:

First run, use COUNT FROM(<input>) to see how many records are there.

Write a nice REXX program to generate these DFSORT/ICETOOS statements 
shown below...

Then try these example combinations...:

<copied from DFSORT manuals and adjusted for Howard's need>

OUTFIL FNAMES=OUT1,STARTREC=1,ENDREC=100000
OUTFIL FNAMES=OUT2,STARTREC=100001,ENDREC=200000
OUTFIL FNAMES=OUT3,STARTREC=300000        
etc...

or 

OPTION COPY                             
OUTFIL FNAMES=(OUTA,OUTB,OUTC, etc ...),SPLIT1R=100000



2. Other solution is to write a COBOL/REXX program with dynamic allocation 
and using a loop of 100000 open/read/write/close. Read up the service 
BPXWDYN.

You can use BPXWDYN in COBOL or REXX. This will give you an opportunity to 
read your input ONCE and finish off all your dynamic alloc/write/close of 
output datasets with one run with no headache of empty outputs.


HTH!

Groete / Greetings
Elardus Engelbrecht

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to