Function to search a space character in the string

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
shivan
Participant
Posts: 70
Joined: Mon Jul 25, 2005 9:29 am

Function to search a space character in the string

Post by shivan »

HI All,
Is there any function in datastage that can be used to search a strange character that is ( ) in a string and then replace it with a space.

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

Post by ArndW »

Shivan, the OCONV(YourString,'MCP') function replaces all unprintable characters with a '.' (period). You can then convert all periods in that string to spaces using CONVERT() and you would be finished. There is an active thread from today describing how to do this.
shivan
Participant
Posts: 70
Joined: Mon Jul 25, 2005 9:29 am

Post by shivan »

thanxs for replying,
i couldnt find the thread with this information. i am using the oconv functions, it works fine. But it leaves a period. Is there a way to convert a period to a space.
thanks
shivan
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

ArndW wrote:...You can then convert all periods in that string to spaces using CONVERT()...
shivan
Participant
Posts: 70
Joined: Mon Jul 25, 2005 9:29 am

Post by shivan »

what is the correct syntax for convert because if i use
convert(onconv("string",'MCP')) it fails. I tried like this also
convert(onconv("string",'MCP'),' ')

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

Post by ArndW »

Shivan,

please, please, please RTFM! I have no problem pointing you in the correct direction but if you are not willing to look up the syntax yourself in the handbook or even do a search on this forum to see how it has been used then there is not a chance that I will do so for you.

(a) Convert() has 3 parameters according to the handbook and the online help.
(b) The function is 'oconv', not 'onconv'
shivan
Participant
Posts: 70
Joined: Mon Jul 25, 2005 9:29 am

Post by shivan »

i saw the thread which was started today. The error still exists. The way the convert function was used in the thread doesnt solve the problem. I tried to look at the tutorials also, couldnt find anything that will replace period to space. The information i am finding is changing hexadecimal to numeric, or something else.
thanks
ameyvaidya
Charter Member
Charter Member
Posts: 166
Joined: Wed Mar 16, 2005 6:52 am
Location: Mumbai, India

Post by ameyvaidya »

Shivan,

Are u working on a Server or a Parallel Job?

AFAIK Oconv cannot be used in a PX Transformer.
So if you are working in PX as the forum u've posted to would suggest, the second question would be: are you using a BASIC Transformer?

And finally in PX, the :evil: Box usually represents the (0x0) character.( the way DataStage pads CHAR fields by default).

The function we used to convert it to " " is

convert(char(000)," ", <In.CharField>)

If it is not a (0x0), then the number in the char() function will have to be replaced by the proper ascii value.

IHTH
Amey Vaidya<i>
I am rarely happier than when spending an entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand.</i>
<i>- Douglas Adams</i>
Post Reply