Page 1 of 1

string replacement in mainframe job

Posted: Fri Mar 16, 2007 9:25 am
by kirankota79
can anybody tell me how you are doing string replacement in mainframe job?

for example....if a password column had six characters .....i need to replace it with 6 '*'s .



Thanks in advance.

Posted: Fri Mar 16, 2007 10:10 am
by DSguru2B
Are you using MVS version? If yes please post in that forum? If not then please explain.
If your using px then you can do replacement in the transformer using different functions.

Posted: Fri Mar 16, 2007 10:30 am
by chulett
What forum would that be, exactly? There's no dedicated MVS forum here.

Posted: Fri Mar 16, 2007 10:39 am
by DSguru2B
:oops: Thats right we dont. We only have MVS job type. Sorry, my bad.
If its a px job then there are certain ways this can be done.
For instance if your column is of type varchar, do

Code: Select all

StringToDate(in.PWD)
It will not fit the date format and hence give you stars. If the field can have less character then the length specified, you can do a substring of it using

Code: Select all

StringToDate(in.PWD)[1,LEN(in.PWD)]

Posted: Fri Mar 16, 2007 1:26 pm
by ray.wurlod
It's a mainframe job. Unfortunately there is no function such as the one you seek in mainframe jobs. You have Len() to determine the length, and I think - without checking - that you have Str() which can generate repeated strings. So something like Str("*",Len(MyString)) might do it for you.

Posted: Fri Mar 16, 2007 1:33 pm
by DSguru2B
If it really is a mainframe job. The OP has another duplicate post in the px forum.

Posted: Fri Mar 16, 2007 2:45 pm
by chulett
Because of you, I would guess. :wink:

Posted: Fri Mar 16, 2007 3:17 pm
by DSguru2B
Yea, that was my mistake assuming there is an MVS forum. The poor guy posted in the px forum and we continued with this post. O well.

Posted: Fri Mar 16, 2007 5:57 pm
by ray.wurlod
There is no STR function, alas.

Certainly you could do something like RPAD('', 6, '*') to generate six asterisk characters.

But I don't think the second argument can be an expression. That is, you could not use RPAD('', (CHARACTER_LENGTH(InLink.ColName)), '*')

Maybe that will give you some ideas, however.