I have a requirement like this:
The input file has one column called code whose value is 7878D0990.
In that I need to search from backward and get the alphabet found i.e D.
The value changes in every run.
I am thinking to use stage variables but not sure how to perform looping using stage variables.
Any help will be appreciated.
Thanks in advance.
Looping Using Stage Variable
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Given that you've marked this as a server job:
Code: Select all
MatchField(InLink.Code, "0N1A0N", 2)
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.
Thanks Ray.
This is working if one string is there before the numbers from back word.
for e.g if the string is 5656D09 then MatchField("5656D09", "0N1A0N", 2)is returning the correct vale D.
But ,if the string is 5656ID09 then MatchField("5656ID09", "0N1A0N", 2)is returning null where result should be D?
Any sugesstions?
Thanks,
SJ.
This is working if one string is there before the numbers from back word.
for e.g if the string is 5656D09 then MatchField("5656D09", "0N1A0N", 2)is returning the correct vale D.
But ,if the string is 5656ID09 then MatchField("5656ID09", "0N1A0N", 2)is returning null where result should be D?
Any sugesstions?
Thanks,
SJ.
I don't see how 'matches' can get you the last occurance, at least not easily. Perhaps Ray knows some magic for that.
Me, I would build a routine that does the 'looping' you asked about. Check the length of the string, execute a For loop stepping from that to 1 step -1, use substring at that position to check for Alpha() and exit the first time time returns true.
![Confused :?](./images/smilies/icon_confused.gif)
Me, I would build a routine that does the 'looping' you asked about. Check the length of the string, execute a For loop stepping from that to 1 step -1, use substring at that position to check for Alpha() and exit the first time time returns true.
-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:
Code: Select all
Right(MatchField(InLink.Code, "0N0A0N", 2), 1)
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.