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
Woth
Participant
Posts: 24
Joined: Thu Mar 18, 2004 8:18 pm

Post by Woth »

for the first problem,

you could use the following functions

Code: Select all

Count(yourString,".IR")  -- gives you the number of occurences of ".IR" in your string
Right(yourString,3)=".IR" -- gives you the last 3 chars
for the second problem, you could use in a transformer

Code: Select all

index(yourString,"EXCH",1) 
- if the result is equal to 0 then yourString does not contain the token "EXCH" . if its not equal to 0 then the number returned by the function is actually where the "EXCH" token has been found in the string (ex. 7 would mean that the word "EXCH" starts at the 7th char in yourString


refer to the manuals for more info on how to use them

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

Post by ArndW »

The COUNT() function might not be the best since it finds any and all occurrences and not just those at the end of the string, but you can use the RIGHT() function to extract the last 2 or 3 characters in a string and do your comparison on that.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I think the best approach is pattern matching here.

Code: Select all

InLink.FirstCol Matches "0X'.IR'" : @VM : "0X'.P'" : @VM : "0X'.UN'"
For the second, Count() is probably the most efficient. Index() is valid too, as is pattern matching.

Code: Select all

InLink.SecondColumn Matches "0X'EXCH'0X"
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
narayana_382
Premium Member
Premium Member
Posts: 37
Joined: Wed Mar 23, 2005 5:20 am

Post by narayana_382 »

Ray,

Please let me know what does it mean by
Code: InLink.FirstCol Matches "0X'.IR'" : @VM : "0X'.P'" : @VM : "0X'.UN'"

Code logic indicates that we are appending the pattern matching characters.

Thnks in Advance,
Nari.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

"0X" in DataStage BASIC pattern matching is a wildcard. The value marks (indicated by system variable @VM) create a multi-valued pattern, so that the Matches operator is satisfied by a match against any of the individual patterns. So my expression is true if InLink.FirstCol has a value that ends in ".IR" or ends in ".P" or ends in ".UN".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ravindrag
Participant
Posts: 40
Joined: Wed Dec 14, 2005 3:22 am

Post by ravindrag »

Thanks
right function is working for .IR and .Un
count function is working for 'EXCH'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

And "*.P" ?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ravindrag
Participant
Posts: 40
Joined: Wed Dec 14, 2005 3:22 am

Post by ravindrag »

it also working
Post Reply