View previous topic :: View next topic
|
Author |
Message |
Rohit MF
New User
Joined: 08 May 2009 Posts: 2 Location: Bangalore
|
|
|
|
I am executing COBOL program through a JCL. The output file of the program is having N records. I want to split that file into number of files. The number of records in the input file is not fixed. After splitting each file should contain 10,000 records. Want to write 10,000 records in one file and next 10,000 in other file and so on..
We have to FTP the file to the server of a system which is working on some other technology...and if we FTP the file containing such a huge number of records...it would not be possible for them to process that...
So we have to split file and pass it to other system..
Can you tell me how to split the file dynamically and ftp the files created. |
|
Back to top |
|
|
mshivashankar007
New User
Joined: 03 Aug 2007 Posts: 2 Location: hyderabad
|
|
|
|
Through File Aid utility from these options,
$$DD01 COPY OUT=10000 -- first 10,000 records ll copy
$$DD02 SPACE IN=10001 -- pointer placed on 10001 record
$$DD02 COPY OUT=10000 -- from there again 10,000 records
$$DD03 SPACE IN=20001 -- pointer placed again on 20001 record etc,...
example:
//STEP0100 EXEC PGM=FILEAID
//SYSPRINT DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//DD01 DD DSN=file1.input
// DISP=SHR
//DD01O DD DSN=file1 .output
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1000,1000),RLSE),
// DCB=(MODEL.FILE,RECFM=FB,LRECL=1310,BLKSIZE=0)
//DD02 DD DSN=file1.input
// DISP=SHR
//DD02O DD DSN=file1.output
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1000,1000),RLSE),
// DCB=(MODEL.FILE,RECFM=FB,LRECL=1310,BLKSIZE=0)
//SYSIN DD *
$$DD01 COPY OUT=4000000
$$DD02 SPACE IN=4000001
$$DD02 COPY OUT=4000000
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD DUMMY
I think it ll Clear ur requirement |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
Back to top |
|
|
Rohit MF
New User
Joined: 08 May 2009 Posts: 2 Location: Bangalore
|
|
|
|
Thanks for the inputs.
I can generate number of output files as mentioned in the mvs/trick link.
But i have few questions in this
1. when we are generating output files using
OUTFIL FNAMES=(OUT1,OUT2,...,OUTnn) we need to mention how
many files we need as output and we need to define all these output
files.
how will I know how many files need to be declared when I'm planing to generate the output files dynamically.
2. how to find out how many files have been generated and how to
dynamically ftp these file names.
Thanks |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
My gut feeling is that you'll have to make a pass through the entire data first, calculating the number of records to be split. Then, you'll need to build all of the necessary DD statements for both the split step and for the FTP step, as well as all of the necessary FTP "put" commands. Once these have been determined, you'll need to create and submit another job and use these calculated DD statements and FTP "put" commands.
Or, maybe a looping process where you split the data once, FTP it, and then submit a new job with the rest of the data, FTP it, and so on until there is no more data left. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi SSM,
it's not necessary to have a number of passes of the input file.
Here is an easier way to accomplish your suggestion although this does not address the original question on how to split the file dynamically, that has been answered by Kevin.
Code: |
//FILEAID EXEC PGM=FILEAID
//SYSPRINT DD SYSOUT=*
//DD01 DD *
1
2
3
4
5
6
7
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//OUT3 DD SYSOUT=*
//SYSIN DD *
$$DD01 USER OUT=00002,WRITE=OUT1
$$DD01 USER OUT=00002,WRITE=OUT2
$$DD01 USER OUT=00003,WRITE=OUT3
|
Gerry |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
This sounded quite familiar. . .
Quote: |
We have to FTP the file to the server of a system which is working on some other technology...and if we FTP the file containing such a huge number of records...it would not be possible for them to process that...
So we have to split file and pass it to other system.. |
because it is the exact same as this previos topic. . .
ibmmainframes.com/viewtopic.php?t=34987
Did the code from Arun not do what you need? |
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
Your COBOL program could dynamically allocate a new file every 10,000 records using 'IKJTSOEV' & 'IKJEFTSR' or PUTENV or BPXWDYN. It could also write out the FTP control cards to FTP the files it created. It could also write out control cards to delete the files it created when they are no longer needed. |
|
Back to top |
|
|
|