IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Group while keeping order same


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sandy0407

New User


Joined: 01 Aug 2010
Posts: 7
Location: Morley

PostPosted: Mon Aug 02, 2010 2:11 am
Reply with quote

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
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Aug 02, 2010 4:04 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 02, 2010 4:37 am
Reply with quote

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
View user's profile Send private message
sandy0407

New User


Joined: 01 Aug 2010
Posts: 7
Location: Morley

PostPosted: Mon Aug 02, 2010 5:46 am
Reply with quote

I will try this option. Thank you.

Cheers,
Sandy.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Aug 02, 2010 6:13 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 02, 2010 4:02 pm
Reply with quote

Commonly Used Data Formats
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Aug 02, 2010 10:57 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 02, 2010 11:29 pm
Reply with quote

thx Frank
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Rotate partition-logical & physic... DB2 0
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Splitting group records based on deta... DFSORT/ICETOOL 8
No new posts DB2 Load - Sort Or order BY DB2 1
Search our Forums:

Back to Top