I need to split the file in such a way that I get approx 1000000 records in my output files.
While splitting, we should take care that a group does not get split.
This means if 1000000 th record is D444444444 8, the sort should either stop copying into the first file at the end of all C333333333 or end of all D444444444 without actually splitting the group.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Thu May 28, 2015 11:03 am Post subject:
TS70363,
It can be done quite easily with DFSORT.
1. Code a 8 byte SEQNUM with a RESTART on your key at position 101.
2. With WHEN=GROUP push an 8 byte ID for every 1000000 records at position 109.
3. Use another WHEN=GROUP while checking for 1 in bytes 101 thru 108 and push the group key at position 109 on to position 117.
4. Now validate the counter at position 117 on OUTFIL for 1,2,3.... and just build the first 100 bytes. _________________ Kolusu
www.linkedin.com/in/kolusu
A 00000001 A0000001
A 00000002 00000001
A 00000003 00000001
B 00000001 B0000001
B 00000002 00000001
B 00000003 00000002
C 00000001 C0000002
C 00000002 00000002
D 00000001 D0000002
D 00000002 00000002
E 00000001 E0000003
E 00000002 00000003
E 00000003 00000003
E 00000004 00000003
E 00000005 00000003
E 00000006 00000004
E 00000007 00000004
I am now stuck as Record B (group) should either go to file 1 or file 2 but not both
what exactly do you think you will achieve with this statement? especially the RECORDS=1? Read the instructions once again especially 3 and 4. You also have your push wrong. _________________ Kolusu
www.linkedin.com/in/kolusu
A 00000001 00000001 00000001
A 00000002 00000001 00000001
A 00000003 00000001 00000001
B 00000001 00000001 00000001
B 00000002 00000001 00000001
B 00000003 00000002 00000001
C 00000001 00000002 00000002
C 00000002 00000002 00000002
D 00000001 00000002 00000002
D 00000002 00000002 00000002
E 00000001 00000003 00000003
E 00000002 00000003 00000003
E 00000003 00000003 00000003
E 00000004 00000003 00000003
E 00000005 00000003 00000003
E 00000006 00000004 00000003
E 00000007 00000004 00000003
You now code three OUTFILs, one for 00000001 and 0000002 and one with SAVE.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum