View previous topic :: View next topic
|
Author |
Message |
shasikanth
New User
Joined: 18 Aug 2003 Posts: 4
|
|
|
|
Hi,
My file which VB of record length 212 has data arranged in the following way
Code: |
1AAA123
2AAA123
2AAA123
2AAA123
3AAA123
3AAA123001
3AAA123001
3AAA123001
3AAA123002
3AAA123002
3AAA123002
43AAA123
53AAA123
|
I wan't sort only the reocrds which have "3" in position 1(Type 3 records) and sort 1:10 and remove the duplicates using SUM FIELDS=NONE.
My Out put after the sort should be
Code: |
1AAA123
2AAA123
2AAA123
2AAA123
3AAA123
3AAA123001
3AAA123002
43AAA123
53AAA123 |
Do any one have any easy way to do this in single cnotrol card using IF THEN in SYNC SORT |
|
Back to top |
|
|
karisurya
New User
Joined: 02 Aug 2007 Posts: 64 Location: Bangalore
|
|
|
|
Hi Shasi,
Seeing the way your input is i have one quick question why you want to sort only records with value "3" in 1st position. Can you tell your actual business requirement, because seeing the exisint data i dont see a reason to specifically put that condition. |
|
Back to top |
|
|
darkstar13
New User
Joined: 06 Nov 2008 Posts: 46 Location: Manila, Philippines
|
|
|
|
Hi,
If your file is FB, 80:
Code: |
//SYSIN DD *
SORT FIELDS=(81,13,CH,A)
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'3'),OVERLAY=(81:1,1,
82:C'99',
84:1,10)),
IFTHEN=(WHEN=(1,1,CH,NE,C'3'),OVERLAY=(81:1,1,
82:SEQNUM,2,ZD,
84:1,10))
SUM FIELDS=NONE
OUTREC FIELDS=(1,80) |
but since your file is VB, you have to consider RDW.
as for the overlay part, i am not sure how to do this is the file is VB.
maybe you can overlay on the fixed portion that will always have empty entries (or filler fields)..
can you give us the layout of your VB file? |
|
Back to top |
|
|
anvesh
New User
Joined: 26 Nov 2009 Posts: 2 Location: hyderabad
|
|
|
|
can you please describe the solution you provided |
|
Back to top |
|
|
darkstar13
New User
Joined: 06 Nov 2008 Posts: 46 Location: Manila, Philippines
|
|
|
|
Hi anvesh,
I created a temporary sort key which consists of:
1. The first byte - since we need to sort ALL records by the first byte
2. A sequence number - I set this to 99 (or any fixed number) so that it WON'T be unique for records with '3' on the first byte, and SEQNUM for the rest. This will make the non '3' records unique, since we don't want the dups for these records removed.
3. The 10-byte sort key - for removing the dups.
I hope that clarified my solution. Senior SORT people would probably give a better solution. |
|
Back to top |
|
|
anvesh
New User
Joined: 26 Nov 2009 Posts: 2 Location: hyderabad
|
|
|
|
Hi dude,
Many thanks for the quick reply and description provided. |
|
Back to top |
|
|
|