Same lookup on multiple rows

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Yarobi
Participant
Posts: 7
Joined: Sun May 05, 2019 8:37 pm

Same lookup on multiple rows

Post by Yarobi »

Hello all,

I have a sequential input file with + 100 lines.
But there are codes in these lines and I need to replace them with numbers.


Is there an easy way to do this?

Codes : MS = 8,1 / AS = 8,1 / N = 9 / WEN = 11 / WED = 11 / N-TW = 9

input:
ID 1 2 3 4 5 6 7
650692063 MS MS MS MS MS
780844037 WEN WEN AS AS AS
980657973 AS AS N
611016639 MS MS MS MS MS
640574862 AS AS AS AS AS
980407793 AWN AWN N N N N
790634771 MS MS MS MS MS
600471729 AS AS AS AS AS
931126541 MS MS MS MS MS
791051871 WED WED AS AS AS AS AS
680128937 MS MS MS
690981015 MS MS MS MS MS
620631662 AS AS AS AS AS
900351471 N-TW N-TW N-TW N-TW N-TW
750439183 AS AS AS AS AS
840596239 AWD AWD MS MS MS MS MS

Return should be like

ID 1 2 3 4 5 6 7
650692063 8,1 8,1 8,1 8,1 8,1
780844037 11 11 8,1 8,1 8,1
980657973 8,1 8,1 9
...
PaulVL
Premium Member
Premium Member
Posts: 1315
Joined: Fri Dec 17, 2010 4:36 pm

Re: Same lookup on multiple rows

Post by PaulVL »

Since it is a sequential file to begin with, I would do it from a command line and not DataStage logic.

https://stackoverflow.com/questions/132 ... ell-script

sed command for string replace and make it with the /g option
Post Reply