Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
sandy0407

New User

Joined: 01 Aug 2010
Posts: 7
Location: Morley

 Posted: Mon Aug 02, 2010 2:11 am    Post subject: Group while keeping order same 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.

sqlcode1

Active Member

Joined: 08 Apr 2010
Posts: 578
Location: USA

Posted: Mon Aug 02, 2010 4:04 am    Post subject:

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,
dbzTHEdinosauer

Global Moderator

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

 Posted: Mon Aug 02, 2010 4:37 am    Post subject: 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?
sandy0407

New User

Joined: 01 Aug 2010
Posts: 7
Location: Morley

 Posted: Mon Aug 02, 2010 5:46 am    Post subject: Reply to: Group while keeping order same I will try this option. Thank you. Cheers, Sandy.
sqlcode1

Active Member

Joined: 08 Apr 2010
Posts: 578
Location: USA

Posted: Mon Aug 02, 2010 6:13 am    Post subject:

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,
dbzTHEdinosauer

Global Moderator

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

 Posted: Mon Aug 02, 2010 4:02 pm    Post subject: Commonly Used Data Formats
Frank Yaeger

DFSORT Moderator

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

Posted: Mon Aug 02, 2010 10:57 pm    Post subject:

 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.
dbzTHEdinosauer

Global Moderator

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

 Posted: Mon Aug 02, 2010 11:29 pm    Post subject: thx Frank
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Group changes and numbering the groups Auryn DB2 2 Tue Mar 20, 2018 7:12 pm How to group and sum the decimal value sakrat DFSORT/ICETOOL 2 Tue Mar 06, 2018 9:13 pm Preserve order in Input File pshongal DFSORT/ICETOOL 13 Thu Dec 21, 2017 4:20 pm Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us