problem in format checking

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
shaonli
Participant
Posts: 80
Joined: Tue Nov 28, 2006 6:52 am

problem in format checking

Post by shaonli »

I need to chek format of a field.If the format of the field is 99-999-9999 then one condition should satisfy.
Please suggest how to check the field format.
Mayur Dongaonkar
Participant
Posts: 20
Joined: Mon Dec 11, 2006 10:57 am
Location: Pune

Re: problem in format checking

Post by Mayur Dongaonkar »

Try using combination of following functions

1. Trim
2. Length

Trim function will return digits before occurance delimiter.
e.g. 99-999-9999
2 digits after first ocurance of delimiter -.
Mayur Dongaonkar.
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

First do a count(In.Col,"-") and check if it is 2. Then len(field[In.Col,"-", 1) and len(field[In.Col,"-", 2) should be 2 and 3 respectively. And then len(field[In.Col : "-","-",3) should be 4. Probably you can check to see if it is a number or not by using Alpha function. It returns a 1 if it is purely alphabetic. So Alpha(field(In.Col, "-", 1)) <> 1, Alpha(field(In.Col, "-", 2)) <> 1 and Alpha(field(In.Col : "-", "-", 3)) <> 1 should all be true.
shaonli
Participant
Posts: 80
Joined: Tue Nov 28, 2006 6:52 am

Post by shaonli »

Thank You for your suggestion.it worked fine.
Post Reply