View previous topic :: View next topic
|
Author |
Message |
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Hi,
I do have an input file. I have to split the files based on a key and send it to FTP server. Issue here is I am not sure of how many unique keys the input file will have. if there are 3 keys then 3 files needs to be created. If there are 5 keys, 5 files needs to be created.
Could anybody suggest me a way.
Code: |
06F72600015908473 21810 1*
0559002GR GGL20L-CWZGBA 032317H 2ZZMCA0055900021017 B2*
01J4LB23
06 20170210
06F77400015908476 21810 1*
0559002GR GGL25L-CWZGBA 032317H 2BZMCA0055900021317 B2*
0083LC30
06 20170213
06F82400015908475 21811 1*
0559002GR GGL20L-CWZGBA 032317H 2ZZMCA0055900021117 B2*
04U7LA40
06 20170211
06F72600015908473 21812 1*
0559002GR GGL20L-CWZGBA 032317H 2ZZMCA0055900021017 B2*
01J4LB23
06 20170210
|
Here the keys are 21810, 21811, 21812. I am sure I can pad this keys towards the end with some sequence no and get it in 3 separate files.
But when I execute it next time there can be 10 keys present. How to dynamically define the file names to get the data separately in 10 separate files ?. |
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
I hope we can use dynamic files in cobol to create the files based on how many keys we receive. I have not tried this yet.
But need to check if we can easily do it by SORT.
Kindly advice. |
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
One more information,
When you see the first 8 records belong to key 21810, so it has to be grouped and sent to a separate file. for 21811, there are 4 records, similarly for 21812. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
You could dynamically build your split JCL using a DFSORT step and then submit it through internal reader. But if you're planning to implement this in production, you might want to follow the programming approach depending on your site standards and policies. |
|
Back to top |
|
|
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
Thanks Arun for your response. I am trying to do it via COBOL program as of now. |
|
Back to top |
|
|
|