How to Replace the "bad" data with the '*" c

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What happened? The function as you posted will strip out all non-displayable characters and replace them (as well as the period) with stars.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

You can always use the CONVERT statement, which is rather cool. It takes a string of characters and changes the each value to a correlated value in another string.

Example:

Code: Select all

CONVERT "ABC" TO "123" IN yourstring
This would change all occurrences of "A" to a "1", "B" to a "2", and "C" to a "3".

So,

Code: Select all

CONVERT "ABC" TO "123" IN "CxBxA"
produces

Code: Select all

3x2x1
You can do something like write a custom function:

Code: Select all

changestr=CHAR(a):CHAR(b):CHAR(c):CHAR(d)
**where a,b,c and d are ASCII chart numbers for your bad chars
Ans=Arg1
CONVERT changestr TO STR("*",len(changestr)) in Ans
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
venugopal81
Participant
Posts: 49
Joined: Sat Mar 26, 2005 12:19 am

No change in output data

Post by venugopal81 »

Hi ArndW,

No change in output. I have checked with other function which you have suggested in previous posts that is
Convert(svControlSet0, svSpaces, inlink.Columnname)
Still we have received same data in output.

Thanks&regards
venu
venugopal81
Participant
Posts: 49
Joined: Sat Mar 26, 2005 12:19 am

No change in output data

Post by venugopal81 »

Hi ArndW,

No change in output. I have checked with other function which you have suggested in previous posts that is
Convert(svControlSet0, svSpaces, inlink.Columnname)
Still we have received same data in output.

Thanks&regards
venu
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I wrote a 1-liner with your code, replacing "Input Link" with my routine variable and it worked as expected. If you cut-and-pasted your original line then you have a problem with the embedded blank between Input and Link.
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi
You can also check with the following fucntion.

Since this type of data has char values greater than 122 and less than 65,
you may use condition as

if char(Arg1) < 65 or char(Arg1) > 122 then "****" else Arg1

Ketfos
Post Reply