Strip Chars at the end and not in middle
Moderators: chulett, rschirm, roy
Strip Chars at the end and not in middle
Hi
I have a Material Number like 123AB456DFG, and I have to strip the chars at the End, so output should be like 123AB456. Previously I wrote a basic Routine and now we want it in Parallel transformer.
Can you guide me in doing this...
Thanks
I have a Material Number like 123AB456DFG, and I have to strip the chars at the End, so output should be like 123AB456. Previously I wrote a basic Routine and now we want it in Parallel transformer.
Can you guide me in doing this...
Thanks
If you can output the material number into a flat file in unix box, you can execute sed command to remove those characters.
suppose you have create a flat file (mat.txt) which contains only one column (material num)
using following command you can eliminate comma (,) and alpha.
e.g sed 's/,$//g' mat.txt | sed 's/[A-Z]*$//g' > new_mat.txt
First it will remove comma subsequently remove all alphabetic characters.
suppose you have create a flat file (mat.txt) which contains only one column (material num)
using following command you can eliminate comma (,) and alpha.
e.g sed 's/,$//g' mat.txt | sed 's/[A-Z]*$//g' > new_mat.txt
First it will remove comma subsequently remove all alphabetic characters.
Thanks,
Upul
Upul
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
... or just do the same in an External Filter stage.
In an expression or routine, you need to have a rule that specifies how many characters to remove.
You did not state such a rule. I hesitate to assume anything, but it would appear that you want the trailing non-numeric characters removed.
As requested earlier, please post your server routine code so we can be sure of the requirement.
In an expression or routine, you need to have a rule that specifies how many characters to remove.
You did not state such a rule. I hesitate to assume anything, but it would appear that you want the trailing non-numeric characters removed.
As requested earlier, please post your server routine code so we can be sure of the requirement.
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.
Reread the requirements - trailing alpha characters only. Apparently up to three max. As Ray noted, we really need a more complete specification.uegodawa wrote:First it will remove comma subsequently remove all alphabetic characters.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Thanks all for your help,This is the Server Routine
My solution to this in a Parallel Transformer(please ignore the syntax mistakes if any)
Code: Select all
PartNo = TrimB(Arg1)
MaxLen = Len(TrimB(PartNo))
AlphaCount = MaxLen
pos = 0
LOOP
WHILE pos < MaxLen
if Alpha(PartNo[(MaxLen-pos),1])=1
then
pos = pos + 1
AlphaCount = AlphaCount - 1
end
else
Goto EndofLoop
end
Repeat
EndofLoop:
Ans = PartNo[1,AlphaCount]
Code: Select all
Var1=Convert('1234567890','*', Matnr)
Var2 = Count('*',VAR1)
Var3 = Index(VAR1,'*',VAR2)
and finally in the Derivation
Matnr[1,VAR3]
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Server routine idea.
Test could be Until Ans Matches "0X1N"
Code: Select all
Ans = Arg1
Loop
While Ans Matches "0X1A"
Ans = Left(Ans, Len(Ans)-1)
Repeat
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.