Hi colleagues-
I have to implement the below requirement-
There is a file having column "AREA_CODE" which has values like
US929ABC
US12GH123
USA99CBH09
US999
I need to incorporate the below algorithm using DataStage functions on this column values- Check needs to be applied on 3rd,4th and 5th character..as given below
If AREA_CODE LIKE 'US[0-9][0-9][0-9]' Then "OK"
If AREA_CODE LIKE 'US[A-Z][0-9][0-9]' Then "OK"
Please advice how do we achieve this in DataStage Server jobs [7.1 edition]
Thanks,
Regards,
Suresh
How to check for numeric characters field by field
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 23
- Joined: Wed Apr 16, 2008 5:34 am
- Location: Prague,Cz
How to check for numeric characters field by field
Regards
DSExplorer
DSExplorer
I'm sure Ray will suggest using matches, hopefully this syntax is correct as I don't use it much:
I'm assuming you can't just substring out positions 3-5 and check for numeric as "US999ABC" would pass muster but would in fact be invalid.
Code: Select all
Link.AREA_CODE Matches "'US'3N"
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Craig is right, and you can do all the matches using a multi-valued second argument. Put the pattern in a stage variable for ease of maintenance.
Code: Select all
svAreaCodePattern <-- "'US'3N" : @VM : "'US'1A2N"
Link.AREA_CODE Matches svAreaCodePattern
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.