View previous topic :: View next topic
|
Author |
Message |
sandy0407
New User
Joined: 01 Aug 2010 Posts: 7 Location: Morley
|
|
|
|
Hi,
I have the following requirement.
I have a sequential file of length 10. The first seven digits are account numbers.The file has duplicate account numbers. However, the last 3 digits are different for the records.
The input file is as shown:
7046000034AAA
7046000034CCC
7045555555FFF
7046000034BBB
7044444444DDD
I want the output to show the following:
7044444444DDD
7045555555FFF
7046000034AAA
7046000034CCC
7046000034BBB
When I sorted on account numbers in ascending order, the values for account number 7046000034 is coming in order AAA, BBB and then CCC. I want to keep the order as (AAA,CCC,BBB). I am not sure if I can use ICETOOL with select option and then use the word keepbase. Please advise.
Regards,
Sandy. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Sandy,
Use OPTION EQUALS, it specifies that the original sequence must be preserved.
Code: |
OPTION EQUALS
SORT FIELDS=(1,7,ZD,A) |
Output
Code: |
7044444444DDD
7045555555FFF
7046000034AAA
7046000034CCC
7046000034BBB
|
Thanks, |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Frank/Kolusu,
if there is no sign-bits involved with numbers, I always define the field as CH.
I would have used the following:
SORT FIELDS=(1,7,CH,A)
is there any advantage to using a numeric unsigned datatype in the sort parm? i.e. UFF or BI over CH
is there any disadvantage to using numeric signed datatype for unsigned data? i.e. ZD when there is no sign? |
|
Back to top |
|
|
sandy0407
New User
Joined: 01 Aug 2010 Posts: 7 Location: Morley
|
|
|
|
I will try this option. Thank you.
Cheers,
Sandy. |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Dick Brenholtz,
Just for the clarification on my proposed solution, OP said
Quote: |
The first seven digits are account numbers. |
Since she/he mentioned digits, I have used ZD in solution.
Thanks, |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
is there any advantage to using a numeric unsigned datatype in the sort parm? i.e. UFF or BI over CH
is there any disadvantage to using numeric signed datatype for unsigned data? i.e. ZD when there is no sign? |
In general, for unsigned data, BI is the most efficient format. CH is equivalent to BI as long as options like LOCALE and CHALT are not in effect. ZD is not as efficient as BI or CH. UFF is not as efficient as ZD. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
thx Frank |
|
Back to top |
|
|
|