Splitting a file from middle using DFSORT in 2 parts



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Splitting a file from middle using DFSORT in 2 parts

Postby ranjeet586 » Wed Jan 07, 2015 10:44 pm

I have a file in which I don't know the number of records (policies only of length 10). I have to split the file in to two parts with equal number of policies (1 difference can happen in case of total odd number). Does any SORT options are available to use in jcl to split the file from middle. Please let me know. Appreciate you help.

Please note, We could split it after giving specific number like below, but if I don't want to hard code the number.

SORT FIELDS=COPY
OUTFIL FNAMES=OUT1,ENDREC=00100000
OUTFIL FNAMES=OUT2,SAVE
OUTREC FIELDS=(1:1,4,5:6,10)

KCT.ITO4860.SOR1
===>
********************
010EC00088
010EC00662
010EC00718
010EC00936
ranjeet586
 
Posts: 9
Joined: Wed Jan 07, 2015 9:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: Splitting a file from middle using DFSORT in 2 parts

Postby BillyBoyo » Wed Jan 07, 2015 11:06 pm

Have you looked at SPLIT and its cousins on OUTFIL? None will give you the implied "first half of the file". Why would that be important? If it is, amend a program which is already reading the file to output the count of records, then use that information in you SORT control cards.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Splitting a file from middle using DFSORT in 2 parts

Postby ranjeet586 » Thu Jan 08, 2015 12:00 am

I have one policy master file from where I am fetching all the policies. Now the list has to be divided in two parts and then IDA file has to be stripped for some other job.

I don't care if I get any utility which could be used through jcl. It would be great if you share any method. Thanks.
ranjeet586
 
Posts: 9
Joined: Wed Jan 07, 2015 9:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: Splitting a file from middle using DFSORT in 2 parts

Postby enrico-sorichetti » Thu Jan 08, 2015 1:47 am

whatever thing You will be using You will have to make TWO passes over the input file
the first one to determine the split point the second one to do it!
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Splitting a file from middle using DFSORT in 2 parts

Postby ranjeet586 » Thu Jan 08, 2015 2:02 am

I have main file in that record count is available in packed format. Can I use that to calculate the middle point.
ranjeet586
 
Posts: 9
Joined: Wed Jan 07, 2015 9:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: Splitting a file from middle using DFSORT in 2 parts

Postby ranjeet586 » Thu Jan 08, 2015 2:02 am

Footer has the record count in the policy master file, from where I am taking all the list of policies.
ranjeet586
 
Posts: 9
Joined: Wed Jan 07, 2015 9:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: Splitting a file from middle using DFSORT in 2 parts

Postby BillyBoyo » Thu Jan 08, 2015 3:00 am

The best thing would be if where the trailer (what we call a footer) is, write out a new file with the count in it.

Then you can use that to generate a SORT symbol or generate the SORT control cards so that your "hardcoded" value is generate each run.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Splitting a file from middle using DFSORT in 2 parts

Postby ranjeet586 » Thu Jan 08, 2015 3:27 am

Thanks for your reply Billy.

Could you please suggest how could we make that if I have trailer available like below in file
KCT.ITO8971.TRAILER1
===>
*************************
999 lÈ*
FFF0097544444444444444444
9990134C00000000000000000
ranjeet586
 
Posts: 9
Joined: Wed Jan 07, 2015 9:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: Splitting a file from middle using DFSORT in 2 parts

Postby neo4u » Fri Jan 09, 2015 1:59 pm

Ranjeet,

try SPLIT option.
SORT FIELDS=COPY               
OUTFIL FNAMES=(OUT1,OUT2),SPLIT


INPUT
111111
222222
333333
444444
555555
666666


OUTPUT
----OUT1----
111111
333333
555555

----OUT2----
222222
444444
666666
neo4u
 
Posts: 8
Joined: Sat Oct 02, 2010 5:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Splitting a file from middle using DFSORT in 2 parts

Postby Terry Heinze » Fri Jan 09, 2015 8:03 pm

ranjeet586,
In the future, please use Code tags to preserve correct character spacing:
*************************
999 lÈ*
FFF0097544444444444444444
9990134C00000000000000000
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post