File SORT For Record key



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

File SORT For Record key

Postby Vineet » Tue Sep 18, 2012 7:30 pm

Hi All,

I am having a Sequential file having LRECL = 1199 & RECFM = FB. File is Sorted on First 16 Bytes i.e. (1,16,CH,A). My Requirement is, For all the Records where First 15 Bytes are same & there is a Difference in the Remaning Field then I need to write the Record to the Output File. O/P File having same Attribute as Input File. Below is Example.


Input File

1234|ABCDE|XYZ98|HELLO|MAINFRAME|XYZ12345|..... ---> To be written to O/P File. First 16 Bytes = 1234|ABCDE|XYZ98
1234|ABCDE|XYZ98|HELLO|MAINFRAME|ABC12345|.....---> To be written to O/P File. First 16 Bytes = 1234|ABCDE|XYZ98
1234|HIJKL|XYZ98|HELLO|MAINFRAME|XYZ12345|..... ---> Not To be written to O/P File. First 16 Bytes = 1234|ABCDE|XYZ98

5678|IJKLM|99999|HELLO|MAINFRAME|XYZ12345|.....----> Not to be written to O/P file. First 16 Bytes = 5678|IJKLM|99999
5678|IJKLM|99999|HELLO|MAINFRAME|XYZ12345|.....----> Not to be written to O/P file. First 16 Bytes = 5678|IJKLM|99999

7899|ABCDE|88888|WORLD|MAINFRAME|XYZ12345|.... To be written to O/P File. First 16 Bytes = 7899|ABCDE|88888
7899|ABCDE|88888|WORLD|MAINFRAME|XYZ12345|.... Not to be written to O/P file. First 16 Bytes = 7899|ABCDE|88888
7899|ABCDE|88888|WORLD|MAINFRAME|XYZ99999|.... To be written to O/P File. First 16 Bytes = 7899|ABCDE|88888
7899|ABCDE|88888|WORLD|MAINFRAME|XYZ88888|.... To be written to O/P File. First 16 Bytes = 7899|ABCDE|88888

Can this be achieved using SORT.

Thanks
Kind Rgd's

Vineet Anand
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: File SORT For Record key

Postby skolusu » Tue Sep 18, 2012 9:29 pm

Vineet,

It is not clear as to what you are trying to do.

Why did you want to write this record when it is exactly the same
7899|ABCDE|88888|WORLD|MAINFRAME|XYZ12345|.... To be written to O/P File. First 16 Bytes = 7899|ABCDE|88888
7899|ABCDE|88888|WORLD|MAINFRAME|XYZ12345|.... Not to be written to O/P file. First 16 Bytes = 7899|ABCDE|88888


what do you do with orphan records like this ?
1234|HIJKL|XYZ98|HELLO|MAINFRAME|XYZ12345|..... ---> Not To be written to O/P File. First 16 Bytes = 1234|ABCDE|XYZ98


It has got nothing to compare against. Why aren't you writing this record?
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: File SORT For Record key

Postby Vineet » Tue Sep 18, 2012 10:02 pm

Hi KOLUSU,

I am sorry for the Incorrect Information. below is the Correct One.

Input File

1234|ABCDE|XYZ98|HELLO|MAINFRAME|XYZ12345|..... ---> To be written to O/P File. First 16 Bytes = 1234|ABCDE|XYZ98
1234|ABCDE|XYZ98|HELLO|MAINFRAME|ABC12345|.....---> To be written to O/P File. First 16 Bytes = 1234|ABCDE|XYZ98
1234|ABCDE|XYZ98|HELLO|MAINFRAME|XYZ12345|..... ---> Not To be written to O/P File. First 16 Bytes = 1234|ABCDE|XYZ98

If U Notice 1st 16 Bytes in all 3 Records are same.Record 1 & 3 is Same & Record 2 Differs (ABCD12345). So in the O/P File Record 1 & 2 to be Written.

5678|IJKLM|99999|HELLO|MAINFRAME|XYZ12345|.....----> Not to be written to O/P file. First 16 Bytes = 5678|IJKLM|99999
5678|IJKLM|99999|HELLO|MAINFRAME|XYZ12345|.....----> Not to be written to O/P file. First 16 Bytes = 5678|IJKLM|99999

If U Notice 1st 16 Bytes in 2 Records are same.Also the Remaning Fileds are Same. So Both Of the Records Not to be Written to the O/P File.

7899|ABCDE|88888|WORLD|MAINFRAME|XYZ12345|.... To be written to O/P File. First 16 Bytes = 7899|ABCDE|88888
7899|ABCDE|88888|WORLD|MAINFRAME|XYZ12345|.... Not to be written to O/P file. First 16 Bytes = 7899|ABCDE|88888
7899|ABCDE|88888|WORLD|MAINFRAME|XYZ99999|.... To be written to O/P File. First 16 Bytes = 7899|ABCDE|88888
7899|ABCDE|88888|WORLD|MAINFRAME|XYZ88888|.... To be written to O/P File. First 16 Bytes = 7899|ABCDE|88888

If U Notice 1st 16 Bytes in all 4 Records are same.Record 1 & 2 is Same, Record 3 & 4 Differs (XYZ99999 / XYZ88888). So in the O/P File Record 1,3 & 4 to be Written.

If U need Further Clarification Please do let eme know. In Nut Shell I can say, There should be One Instance of Common Records i.e. First 16 Bytes + Remaning Fields. If any Other Field Differs apart From the 16 Bytes that Should be Written to O/P File.

Rgd's
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: File SORT For Record key

Postby skolusu » Tue Sep 18, 2012 10:10 pm

Vineet wrote:Hi KOLUSU,

I am sorry for the Incorrect Information. below is the Correct One.

If U need Further Clarification Please do let eme know. In Nut Shell I can say, There should be One Instance of Common Records i.e. First 16 Bytes + Remaning Fields. If any Other Field Differs apart From the 16 Bytes that Should be Written to O/P File.

Rgd's


Vineet,

It is still confusing. If you need 1 instance of common records why aren't you writing this record?

5678|IJKLM|99999|HELLO|MAINFRAME|XYZ12345|

On the other hand you write the first record from this group when both of them are exactly the same.

7899|ABCDE|88888|WORLD|MAINFRAME|XYZ12345|.... To be written to O/P File. First 16 Bytes = 7899|ABCDE|88888
7899|ABCDE|88888|WORLD|MAINFRAME|XYZ12345|.... Not to be written to O/P file. First 16 Bytes = 7899|ABCDE|88888

So be clear on what you are trying to do and show us better examples.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: File SORT For Record key

Postby enrico-sorichetti » Tue Sep 18, 2012 10:15 pm

wouldn' t have been simpler to say...
eliminate all <full record> duplicates keeping just one ???
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: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: File SORT For Record key

Postby skolusu » Tue Sep 18, 2012 10:38 pm

enrico-sorichetti wrote:wouldn' t have been simpler to say...
eliminate all <full record> duplicates keeping just one ???


I believe that is indeed the final requirement, however he seems to skip a few records. SELECT on the full record with FIRST would get him the results he want.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: File SORT For Record key

Postby Vineet » Wed Sep 19, 2012 12:22 am

I am sorry for the Incorrect Information. below is the Correct One.

Input File

1234|ABCDE|XYZ98|HELLO|MAINFRAME|XYZ12345|..... ---> To be written to O/P File. First 16 Bytes = 1234|ABCDE|XYZ98
1234|ABCDE|XYZ98|HELLO|MAINFRAME|ABC12345|.....---> To be written to O/P File. First 16 Bytes = 1234|ABCDE|XYZ98
1234|ABCDE|XYZ98|HELLO|MAINFRAME|XYZ12345|..... ---> Not To be written to O/P File. First 16 Bytes = 1234|ABCDE|XYZ98

If U Notice 1st 16 Bytes in all 3 Records are same.Record 1 & 3 is Same & Record 2 Differs (ABCD12345). So in the O/P File Record 1 & 2 to be Written.
Here We Need to Write Only Those Records where First 16 Bytes are same & any One of the Remaning field(s) is Different. In the above stated example XYZ12345 & ABCD12345 Differs where as First
16 Bytes are same.

5678|IJKLM|99999|HELLO|MAINFRAME|XYZ12345|.....----> Not to be written to O/P file. First 16 Bytes = 5678|IJKLM|99999
5678|IJKLM|99999|HELLO|MAINFRAME|XYZ12345|.....----> Not to be written to O/P file. First 16 Bytes = 5678|IJKLM|99999

If U Notice 1st 16 Bytes in 2 Records are same.Also the Remaning Fileds are Same. So Both Of the Records Not to be Written to the O/P File.
Here First 16 Bytes & All Remaning Fields are same. So None of Record to be Written to the File.

7899|ABCDE|88888|WORLD|MAINFRAME|XYZ12345|.... To be written to O/P File. First 16 Bytes = 7899|ABCDE|88888
7899|ABCDE|88888|WORLD|MAINFRAME|XYZ12345|.... Not to be written to O/P file. First 16 Bytes = 7899|ABCDE|88888
7899|ABCDE|88888|WORLD|MAINFRAME|XYZ99999|.... To be written to O/P File. First 16 Bytes = 7899|ABCDE|88888
7899|ABCDE|88888|WORLD|MAINFRAME|XYZ88888|.... To be written to O/P File. First 16 Bytes = 7899|ABCDE|88888

If U Notice 1st 16 Bytes in all 4 Records are same.Record 1 & 2 is Same (16 Bytes + Remaning Fields), Record 3 & 4 Differs (16 Bytes are same where as Field XYZ99999 / XYZ88888 differs). So in the O/P File Record 1,3 & 4 to be Written.

If U need Further Clarification Please do let eme know. In Nut Shell I can say, There should be One Instance of Common Records i.e. First 16 Bytes + Remaning Fields. If any Other Field Differs apart From the 16 Bytes that Should be Written to O/P File.

Rgd'sVineet

Posts: 51
Joined: 19 Jun 2007, 11:38
Private message
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: File SORT For Record key

Postby enrico-sorichetti » Wed Sep 19, 2012 12:40 am

Your description is still clear as mud :evil:

but rereading it 10 times ...

why did You not simply write ....

if a group of records ( with the same 16 byte key ) consists only of <full> equal records eliminate the whole group

otherwise eliminate the <full> duplicates keeping one of each
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: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: File SORT For Record key

Postby skolusu » Wed Sep 19, 2012 10:24 pm

vineet,

Stop posting the same thing over and over. Please answer my questions.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: File SORT For Record key

Postby dick scherrer » Fri Sep 21, 2012 8:05 pm

Hello,

To help someone help you, you need to post a few a few sample input records and the exact output you want when your process is run. You need to post enough info so that the rules are understood.

Use the "code" tags to preserve alignment sand improve readabaility,
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post