string replacement in mainframe job

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
kirankota79
Premium Member
Premium Member
Posts: 315
Joined: Tue Oct 31, 2006 3:38 pm

string replacement in mainframe job

Post 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.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What forum would that be, exactly? There's no dedicated MVS forum here.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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)]
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

If it really is a mainframe job. The OP has another duplicate post in the px forum.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Because of you, I would guess. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply