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

Splitting a file into number of files and FTP


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rohit MF

New User


Joined: 08 May 2009
Posts: 2
Location: Bangalore

PostPosted: Mon May 11, 2009 1:44 pm
Reply with quote

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
View user's profile Send private message
mshivashankar007

New User


Joined: 03 Aug 2007
Posts: 2
Location: hyderabad

PostPosted: Mon May 11, 2009 2:08 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon May 11, 2009 2:22 pm
Reply with quote

As a first step you may split the files in differnt files and then can FTP them -- one FTP step for each splitted-file.

To split the files as per you need, you might like to check these links:

www.ibmmainframes.com/viewtopic.php?t=29578&highlight=split
www.ibmmainframes.com/viewtopic.php?t=30659&highlight=split
www.ibmmainframes.com/viewtopic.php?t=34979&highlight=split
www.ibmmainframes.com/viewtopic.php?t=38722&highlight=split

or See the "Split a file to n output files dynamically" Smart DFSORT Trick at: www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
Rohit MF

New User


Joined: 08 May 2009
Posts: 2
Location: Bangalore

PostPosted: Mon May 11, 2009 7:17 pm
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Mon May 11, 2009 7:31 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue May 12, 2009 4:57 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue May 12, 2009 5:44 am
Reply with quote

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
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Tue May 12, 2009 8:41 pm
Reply with quote

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
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top