help on transformer logic

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
paddu
Premium Member
Premium Member
Posts: 232
Joined: Tue Feb 22, 2005 11:14 am
Location: California

help on transformer logic

Post by paddu »

i have a CHAR field , but i need to pull only numeric values or values with hypens only.

It is a zipcode field ,so i need to pull values something like this
90062 or values with hypen like 90062-3214 .
sometimes this field has values like , "extra","exist" etc...

Zipcode field length 10 datatype CHAR

can anyone help me to pull only zipcodes and not other values(i need to pull zipcode with 10 characters which has hypen also as i mentioned)

Thanks
Paddu
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

You can check if ascii value for each character lies under the range of nubmers or '-'.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You can use the DS/Basic "MATCHFIELD" function. If I remember correctly it even has an example on how to parse a ZIP code or SSN from a string. Look it up in the BASIC Programmer' Guide
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

InLink.ZipCode Matches "5N" : @VM : "5N'-'4N" 
used as a constraint expression or in an If..Then..Else expression
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
paddu
Premium Member
Premium Member
Posts: 232
Joined: Tue Feb 22, 2005 11:14 am
Location: California

Post by paddu »

[quote="ray.wurlod"][code]InLink.ZipCode Matches "5N" : @VM : "5N'-'4N" [/code]
used as a constraint expression or in an If..Then..Else expression ...[/quote


Ray,

thank you very much. i used the expression as constraint and it worked.


Thank You
paddu
Post Reply