I am trying to find a pattern in the source column and return Null, if the pattern is found.
For Ex: Source Column Record 1 has : "TBADA'
Record 2 has : "ADTBAAD"
Finding Pattern: "TBA"
Result : @NULL
Any help is appreciated!
Using the "LIKE" operator in DS Routine
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 224
- Joined: Tue Sep 24, 2002 7:32 am
- Location: Denver, CO USA
I think I understand - you are currently getting a NULL (not found) and you should be getting a hit (found)?
I would use the Index function. Here is some documentation from BASIC.pdf:
Syntax
INDEX (string, substring, occurrence)
Description
Use the INDEX function to return the starting character position for the specified occurrence of substring in string.
Hope this helps,
John
I would use the Index function. Here is some documentation from BASIC.pdf:
Syntax
INDEX (string, substring, occurrence)
Description
Use the INDEX function to return the starting character position for the specified occurrence of substring in string.
Hope this helps,
John
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The operator in DataStage BASIC is MATCHES rather than LIKE, and it uses a more flexible pattern-matching capability. In your case, all you need is the wild-card pattern element, which is either "..." or "0X".
or, for case-insensitive matching
When you're ready, find MATCHES in the on-line help or BASIC manual and learn about the other pattern-matching components. For example you can match specific or arbitrary numbers alphabetic or numeric characters.
Code: Select all
InLink.ColumnName MATCHES "...TBA..."
Code: Select all
UpCase(InLink.ColumnName) MATCHES "...TBA..."
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.