I would like to sort records of same type that come together. For example, sort the first two records (same type of 111 and coming together), and then sort three 222 records (same type of 222 and coming together),.....sort 3 records of 111 type, sort 3 records of 222 type, and so on.
sort key is different for different types. And i dont need to sort the record types 999. _________________ Thanks
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Sep 20, 2007 3:21 pm Post subject:
Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 14 Oct 2004 Posts: 130 Topics: 43 Location: virtual village
Posted: Thu Sep 20, 2007 4:12 pm Post subject:
It's workign Frank. But I have some mroe customization required.
sort key is different for different record type.
Eg.: for type 111 - its from 3-8
for type 222 - its from 3-20 etc.
one more is, I would not like to sort some of the records types as I dont need them to sort. Hcen i would like to skip the sorting for the same to save the time. eg: I dont want to sort the records types 333. Is it possible? _________________ Thanks
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Sep 20, 2007 4:46 pm Post subject:
Yes, it's possible, but if you want me to show you how to do it, you have to give your complete requirements.
Quote:
sort key is different for different record type.
Give the starting position and length of the sort key for every record type regardless of whether you want to sort it or not.
Quote:
one more is, I would not like to sort some of the records types as I dont need them to sort. Hcen i would like to skip the sorting for the same to save the time. eg: I dont want to sort the records types 333. Is it possible?
If you are trying to avoid sorting for some of the record types to "save time", don't bother. Even if you want some of the records in sorted order and others in their original order, you must still sort them all so there's no saving in time involved (it may actually take more time to keep them in their original order). If you want some of the record types in their original order because they need to be in their original order, that's a different story - in that case, you need to give me a complete list of record types for which you want to keep the records in their original order. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 14 Oct 2004 Posts: 130 Topics: 43 Location: virtual village
Posted: Thu Sep 20, 2007 5:45 pm Post subject:
2nd issue-
Okay, as you suggested, lets leave them sorted.
1st issue-
for records type 111, sort key start position is 10, with a length of 10
for records type 222, sort key start position is 10, with a length of 20
for records type 111, sort key start position is 10, with a length of 15
Please revert if this info is not enough. _________________ Thanks
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Sep 20, 2007 6:09 pm Post subject:
In your input example, I see record types 111, 222, 333, 444, 111, 222, 333, 444 in that order.
You say type 111 has 10,10, type 222 has 10,20 and type 111 has 10,15. I don't know how to make sense of that. How does that correspond to the two sets of 111, 222, 333 and 444 record types? Are the sort fields for the first and second sets of 111 types different (10,10 and 10,15)? How do you distinguish one 111 type from the other 111 type? Are the sort fields for both sets of 222 types the same (10,20)? What are the sort fields for the first and second sets of 333 and 444 types? Please give complete information. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 14 Oct 2004 Posts: 130 Topics: 43 Location: virtual village
Posted: Thu Sep 20, 2007 6:15 pm Post subject:
sorry frank, its typo error.
for all records type of 111, sort key start position is 10, with a length of 10
for all records type of 222, sort key start position is 10, with a length of 20
for all records type of 333, sort key start position is 10, with a length of 15
for all records type of 444, sort key start position is 10, with a length of 15 _________________ Thanks
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Sep 20, 2007 6:50 pm Post subject:
Given that all of the sort fields start at the same position, I think you only need to change the SORT statement in my job to the following:
Code:
SORT FIELDS=(81,8,ZD,A,10,20,CH,A)
This should work unless you have duplicate keys for the 111, 333 or 444 type records followed by other non-blank characters that have to be kept in their original order.
If it doesn't work, please show me an example of the input records and actual vs expected output for which it doesn't work. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 14 Oct 2004 Posts: 130 Topics: 43 Location: virtual village
Posted: Thu Sep 20, 2007 7:09 pm Post subject:
Sorry for changing the sort fields. I thougt i could change in code directly. but you generic solution wasn't allowing me to adopt below:
111 - sort fields (20,10), (10,5), and (50,60)
222 - sort fields (20,10), (10,5)
333 - sort fields (20,10), (10,5)
444 - here i dont bother about sorting these records, hence i can say (1,20) _________________ Thanks
Joined: 14 Oct 2004 Posts: 130 Topics: 43 Location: virtual village
Posted: Fri Sep 21, 2007 11:26 am Post subject:
Sorry,
Assume some random fields for sort keys, but with different values for different record types, as I am yet to freeze the sort fields. We are working on the sorting keys currently. _________________ Thanks
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Sep 21, 2007 11:38 am Post subject:
Quote:
Assume some random fields for sort keys, but with different values for different record types, as I am yet to freeze the sort fields. We are working on the sorting keys currently.
You've got to be kidding! If I give you a "generic" solution, you'll just come back and tell me you can't figure out how to adapt it to your "real" requirements.
When you figure out your "real" requirements, come back and post them clearly and in detail: Show an example of your input records and expected output records. Give all of the sort field information for all of the record types. Give the RECFM and LRECL of the input file. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
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