Increment a alphabet value to the next

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
lkganta
Participant
Posts: 21
Joined: Wed Feb 08, 2006 4:10 pm

Increment a alphabet value to the next

Post by lkganta »

Hi,
I have the situation where I need to increment my input value as per below in the datastage 7.5 PX


INPUT
------

1234
44346
656566
44346
656566
44346
44346

OUTPUT
----------
1234
44346
656566
44346A
656566A
44346B
44346C

Here I am adding the alphabet to the number incase it comes again by incrementing the alphabet value.
Can you please help to increment the alphabet value? How to implement this logic ?

Thank you,
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use a mix of Seq() and Char() functions in your stage variables.
Char(Seq(svPrevCharacter)+1) gives the next character, but what do you need to happen if the previous character is "Z"?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
lkganta
Participant
Posts: 21
Joined: Wed Feb 08, 2006 4:10 pm

Post by lkganta »

Thank you very much for the reply. If the previous values reaches Z then I need to put the value "AA" and then increment it to AB,AC,AD...etc
It is kind of implementing the recursion concept correct?



Thank you,
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I have no idea - it's your business rule. I merely felt compelled to point out how important it was for you to consider it.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

Can be done via div and mod

Div giving the number of times you repeat the letter and mod to identify which letter
Post Reply