On Thu, 12 Mar 2009 10:36:21 -0600, Howard Brazee <[email protected]>
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.
>
> 
>
>What do you recommend?

I would probably use REXX. Something akin to (UNTESTED!)

/* rexx */
do fileno=1 by 1 /* basically forever */
"EXECIO 100000 DISKR SYSUT1 (STEM RECORD."
if rc <> 0 then leave
"ALLOC DDN(SYSUT2) DSN(...) NEW CATALOG ",
" SPACE(50 20) CYLINDERS ..."
"EXECIO * DISKW SYSUT2(STEM RECORD. FINIS"
"FREE DDN(SYSUT2)"
end
if RECORD.0 <> 0 then do
"ALLOC DDN(SYSUT2) ..."
"EXECIO * DISKW SYSUT2(STEM RECORD. FINIS"
"FREE DDN(SYSUT2)"
end

In the above, I'd make the DSN for the output equal to something that ends with:

FILE&fileno

You could then MPUT the "stem" part of the DSN.

You'd need to make the ALLOCATE commands have the correct dataset attributes
like LRECL and RECFM et al.

If you want to "go crazy", then you could use the UNIX "split" command along
with DTLSPAWN (or BPXBATCH) to read the file and create output UNIX files
which you could then ftp via an MPUT. If you have the Co:Z utilities
(strongly recommended!), then you could:

//SPLIT EXEC DTLSPAWN
//INFILE DD DISP=SHR,DSN=input.file
//STDIN DD *
cd /temp/filesystem
rm prefix.to.output.xx*
fromdsn '//DD:INFILE' | \
split -l 100000 - prefix.to.output.xx
/*

An alternate to the above would be to run BPXBATCH with the commands:

cd /temp/filesystem
rm prefix.to.output.xx*
cp "//'input.mvs.dsn'" /dev/fd/1 | \
split -1 100000 - prefix.to.output.xx

replace 'input.mvs.dsn' with the read MVS dataset name in quotes. You'd then
ftp using the UNIX files and MPUT them to the remote system.

But, I'd really use the REXX myself. Mainly because "normal" z/OS people
will more likely understand it.

--
John

----------------------------------------------------------------------
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