Validation

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
pandu80
Participant
Posts: 50
Joined: Fri Apr 08, 2005 5:56 pm

Validation

Post by pandu80 »

Hi,

Iam using the following code Numeric validation.

If Oconv(Trim(InputLink.Col),"MCN") = Trim(InputLink.Col) Or Index(InputLink.Col,'E',1) >=1 Or Index(InputLink.Col,'e',1) >=1 Or InputLink.Col <>'' Then InputLink.Col Else 'Error'

Is the right approach?.

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

Post by ArndW »

pandu80,

I think your approach is lacking a bit. For instance, the string 'Hello World' would be considered a number, as would any non-empty string (for different reasons).

I don't have a ds system to check right now, but I would use the NUM(<value>) function to start with. If you want a detailed check it is better to do this in a function, that way you can check the STATUS() return code when using ICONV or OCONV to check for different possibilities.

Perhaps you could state exactly what you want to check - with numbers you have integers, real number, floating point and exponential representations - do you want to cater to all of these at the same time?
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You can do a
if num(yourvalue) then 'number' else 'not number'
Post Reply