Page 1 of 2

How to Add seq as alphabetic

PostPosted: Thu Jul 30, 2015 2:51 pm
by pgkkreddy1
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

Re: How to Add seq as alphabetic

PostPosted: Thu Jul 30, 2015 9:36 pm
by pgkkreddy1
HI Billy,

Good morning!

Can you please help below one

Regards,
kk

Re: How to Add seq as alphabetic

PostPosted: Thu Jul 30, 2015 10:02 pm
by Robert Sample
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.

Re: How to Add seq as alphabetic

PostPosted: Thu Jul 30, 2015 10:13 pm
by pgkkreddy1
Sorry Robert. My intention is not that.

Regards,
kk

Re: How to Add seq as alphabetic

PostPosted: Fri Jul 31, 2015 12:55 am
by enrico-sorichetti
what if.. for the same <key> there are more than 26 records ???

Re: How to Add seq as alphabetic

PostPosted: Fri Jul 31, 2015 8:13 am
by pgkkreddy1
Thanks Enrico.No it will be less than 26 always..

Regards,
kk

Re: How to Add seq as alphabetic

PostPosted: Fri Jul 31, 2015 1:26 pm
by BillyBoyo
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.

Re: How to Add seq as alphabetic

PostPosted: Fri Jul 31, 2015 2:05 pm
by pgkkreddy1
Hi Billy,

Good morning!!

Working good..Thanks very much

Regards,
kk

Re: How to Add seq as alphabetic

PostPosted: Fri Jul 31, 2015 3:29 pm
by BillyBoyo
If you post the code you came up with, it can help others with similar requirements in the future.

Re: How to Add seq as alphabetic

PostPosted: Fri Jul 31, 2015 4:27 pm
by pgkkreddy1
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