How to Add seq as alphabetic



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

How to Add seq as alphabetic

Postby pgkkreddy1 » Thu Jul 30, 2015 2:51 pm

Hi,
Good evening!
Please help me out to put the sequence as A,B,C..etc.is it possible to put sequence as Alphabetic using sort

I Have input like this.
=COLS> ----+----1----+----2----+----3----+----4----+-
****** ***************************** Top of Data ****
000001 50015662008              00001-IBW82U20150702
000002 50015662008              00001-IBVWME20150702
000003 50015662008              00001-IBVXME20150702
000004 50015662008              00001-IBVYME20150702
000005 50015662001              00001-IBVAME20150702
000006 50015662001              00001-IBVBME20150702
000007 50015662001              00001-IBVBME20150702
****** **************************** Bottom of Data **     

based on the first 11 digits i want to put the 25th position with sequence as A,B,C..

Output should be like below:

=
COLS> ----+----1----+----2----+----3----+----4----+----5-
****** ***************************** Top of Data *********
000001 50015662008             A00001-IBW82U20150702     
000002 50015662008             B00001-IBVWME20150702     
000003 50015662008             C00001-IBVXME20150702     
000004 50015662008             D00001-IBVYME20150702     
000005 50015662001             A00001-IBVAME20150702     
000006 50015662001             B00001-IBVBME20150702     
000007 50015662001             C00001-IBVBME20150702     


Please help me out sort systanx for the above case.
Regards,
kk
pgkkreddy1
 
Posts: 24
Joined: Wed May 13, 2015 8:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to Add seq as alphabetic

Postby pgkkreddy1 » Thu Jul 30, 2015 9:36 pm

HI Billy,

Good morning!

Can you please help below one

Regards,
kk
pgkkreddy1
 
Posts: 24
Joined: Wed May 13, 2015 8:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to Add seq as alphabetic

Postby Robert Sample » Thu Jul 30, 2015 10:02 pm

Pgkkreddy1: this forum's responders are volunteers and answer if they have time and interest. Nagging for responses will not get you faster replies and may keep people from responding at all.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: How to Add seq as alphabetic

Postby pgkkreddy1 » Thu Jul 30, 2015 10:13 pm

Sorry Robert. My intention is not that.

Regards,
kk
pgkkreddy1
 
Posts: 24
Joined: Wed May 13, 2015 8:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to Add seq as alphabetic

Postby enrico-sorichetti » Fri Jul 31, 2015 12:55 am

what if.. for the same <key> there are more than 26 records ???
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3002
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: How to Add seq as alphabetic

Postby pgkkreddy1 » Fri Jul 31, 2015 8:13 am

Thanks Enrico.No it will be less than 26 always..

Regards,
kk
pgkkreddy1
 
Posts: 24
Joined: Wed May 13, 2015 8:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to Add seq as alphabetic

Postby BillyBoyo » Fri Jul 31, 2015 1:26 pm

Use a SEQNUM with a one-byte binary count, and a RESTART for your key. Use CHANGE to convert your one-byte binary to a letter.

You should be able to get to that using INREC with OVERLAY.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to Add seq as alphabetic

Postby pgkkreddy1 » Fri Jul 31, 2015 2:05 pm

Hi Billy,

Good morning!!

Working good..Thanks very much

Regards,
kk
pgkkreddy1
 
Posts: 24
Joined: Wed May 13, 2015 8:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to Add seq as alphabetic

Postby BillyBoyo » Fri Jul 31, 2015 3:29 pm

If you post the code you came up with, it can help others with similar requirements in the future.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to Add seq as alphabetic

Postby pgkkreddy1 » Fri Jul 31, 2015 4:27 pm

Sure Billy.

Here is the code.

//SYSIN    DD *                                                         
   SORT FIELDS=COPY                                                     
   INREC IFTHEN=(WHEN=(581,2,CH,EQ,C'01'),OVERLAY=(581:C'A')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'02'),OVERLAY=(581:C'B')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'03'),OVERLAY=(581:C'C')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'04'),OVERLAY=(581:C'D')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'05'),OVERLAY=(581:C'E')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'06'),OVERLAY=(581:C'F')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'07'),OVERLAY=(581:C'G')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'08'),OVERLAY=(581:C'H')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'09'),OVERLAY=(581:C'I')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'10'),OVERLAY=(581:C'J')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'11'),OVERLAY=(581:C'K')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'12'),OVERLAY=(581:C'L')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'13'),OVERLAY=(581:C'M')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'14'),OVERLAY=(581:C'N')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'15'),OVERLAY=(581:C'O')),           
         IFTHEN=(WHEN=(581,2,CH,EQ,C'16'),OVERLAY=(581:C'P'))           
   OUTREC FIELDS=(1,581)                           


Regards,
kk
pgkkreddy1
 
Posts: 24
Joined: Wed May 13, 2015 8:08 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to DFSORT/ICETOOL/ICEGENER