Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Splitting a file into number of files and FTP

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Splitting a file into number of files and FTP
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    Post subject:
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

Senior Member


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

PostPosted: Mon May 11, 2009 2:22 pm    Post subject:
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:

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

or See the "Split a file to n output files dynamically" Smart DFSORT Trick at: http://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    Post subject:
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

Moderator Team Head


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

PostPosted: Mon May 11, 2009 7:31 pm    Post subject: Reply to: Splitting a file into number of files and FTP
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: 1703
Location: Australia

PostPosted: Tue May 12, 2009 4:57 am    Post subject:
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

Site Director


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

PostPosted: Tue May 12, 2009 5:44 am    Post subject:
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. . .
http://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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us