Modify the 1st digit

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
arnie_nits
Participant
Posts: 101
Joined: Mon Aug 13, 2007 2:32 am

Modify the 1st digit

Post by arnie_nits »

Hi, I have requirement where if the record are 1,15,201...then the output should be 1,15,501....that is if the number is 3 digit then the 1st digit needs to be changed to 5.

Please suggest....

Thanks...
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Is this 3 different columns or one string of value "1,15,201"? or 3 different values for one column?

Assuming the latter, "IF LEN(In.Col)=3 THEN '5':In.Col[2,2] ELSE In.Col"
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Something like

Code: Select all

svYourNumLen = len(yourNum)
If svYourNumLen >= 3 Then yourNum[1,svYourNumLen-3] : '5' : yourNum[yourNumLen - 2, 2] Else yourNum
Post Reply