Extracting value from an input

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
sumesh.abraham
Participant
Posts: 153
Joined: Thu May 11, 2006 1:52 am
Location: Bangalore

Extracting value from an input

Post by sumesh.abraham »

Hi All,

I've an input value which is numeric. I want to check whether the third digit of the input is 1 or not using the derivation. Which DataStage function can be used for this. As per my knowledge, DataStage has many string functions, but how to work with a numeric input.

Thanks,
Sumesh
smrutiranjannayak
Participant
Posts: 22
Joined: Mon Apr 02, 2007 4:02 am
Location: MUMBAI
Contact:

You can use the below mentioned functions

Post by smrutiranjannayak »

Hi ,

Let suppose you have :

Columnname Data
Emp_id 1234567

As per ur qs you need the third number from left and want to check whther that is 3 or not ?

Use this :

If Substrings(Emp_id,3,1) = "3" Then x Else y .


Cheers
Smrutiranjan Nayak
sumesh.abraham
Participant
Posts: 153
Joined: Thu May 11, 2006 1:52 am
Location: Bangalore

Post by sumesh.abraham »

It worked!! Thanks Smruti.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It worked because everything is a string under the covers in Server. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
smrutiranjannayak
Participant
Posts: 22
Joined: Mon Apr 02, 2007 4:02 am
Location: MUMBAI
Contact:

Hey Hullett....

Post by smrutiranjannayak »

Can you just guide me how we can handle this scenarion in px since i worked in server only......


Thanks n cheers :lol:
Smrutiranjan Nayak
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Exactly the same logic, but you need to convert the integer to a string before using the substring function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply