| Author |
Message |
scognet
 since April 2006
Group memberships: Premium Members
Joined: 06 Apr 2006
Posts: 9
Location: MARSEILLE
Points: 87
|
|
| DataStage® Release: 5x |
| Job Type: Server |
| OS: Unix |
|
Hi,
I have a problem to make a SUBSTRING when i load a DOS file from my Unix Datastage.
I have a file that containt some lines like this one :
Str = "15 100.000000Goûter 1 Goû102093101020003810200013"
For example i would like to do a substrings(Str,21,20) but i have a problem with this specific "û" character that generate bad columns.
Do you know what function i have to use to resolve this problem ?
Thanks
|
|
|
|
|
 |
ArndW
Participant
Group memberships: Premium Members, Inner Circle, Australia Usergroup
Joined: 16 Nov 2004
Posts: 14022
Location: Germany
Points: 79230
|
|
|
|
|
|
|
You can use the convert() function to replace that character with some other one.
|
_________________
|
|
|
|
 |
DeepakCorning

Group memberships: Premium Members
Joined: 29 Jun 2005
Posts: 501
Points: 3171
|
|
|
|
|
|
When you say you have a problem , do you mean that you are getting some kind of warning while running the Job? If yes can you please let us know the warning/error message.
Usually you have to make changes in the NLS setting of the jobs to handle special character, but can not comment till I see the warnign message.
|
|
|
|
|
 |
scognet
 since April 2006
Group memberships: Premium Members
Joined: 06 Apr 2006
Posts: 9
Location: MARSEILLE
Points: 87
|
|
|
|
|
|
I have no good result with "Ereplace" or "Convert" function because i think i'm in front of difference between DOS and UNIX character.
In log of Director i ave just somme logs with "value too large" because i don't do correctly the substring.
Thanks
|
|
|
|
|
 |
DeepakCorning

Group memberships: Premium Members
Joined: 29 Jun 2005
Posts: 501
Points: 3171
|
|
|
|
|
|
| scognet wrote: |
In log of Director i ave just somme logs with "value too large" because i don't do correctly the substring.
Thanks |
Can you put a Seq or Hashed File and pull out this value in it. That will give an idea what exactly what is going in to the target.
|
|
|
|
|
 |
ArndW
Participant
Group memberships: Premium Members, Inner Circle, Australia Usergroup
Joined: 16 Nov 2004
Posts: 14022
Location: Germany
Points: 79230
|
|
|
|
|
|
|
if you don't care what you convert it to to then use OCONV(In.ColumnName,'MCP') to convert unprintable characters to a "." (period).
|
_________________
|
|
|
|
 |
scognet
 since April 2006
Group memberships: Premium Members
Joined: 06 Apr 2006
Posts: 9
Location: MARSEILLE
Points: 87
|
|
|
|
|
|
Ok with OCONV MCP
When i use Oconv(Str,'MCP') Datastage convert the caracter 'û' to '.'. So its good for me but my target is to have 'u'.
Thanks
|
|
|
|
|
 |
ArndW
Participant
Group memberships: Premium Members, Inner Circle, Australia Usergroup
Joined: 16 Nov 2004
Posts: 14022
Location: Germany
Points: 79230
|
|
|
|
|
|
|
Well, then you need to do a
convert('û' ,'u',In.Column)
|
_________________
|
|
|
|
 |
DeepakCorning

Group memberships: Premium Members
Joined: 29 Jun 2005
Posts: 501
Points: 3171
|
|
|
|
|
|
|
Just wanted to ask you that are you sure you will never have any other special cahracters other than what you specified here?? If yes then the above solution is perfect !!
|
|
|
|
|
 |
srinivas_dsx

Group memberships: Premium Members
Joined: 17 Nov 2005
Posts: 7
Points: 60
|
|
|
|
|
|
| DeepakCorning wrote: |
| Just wanted to ask you that are you sure you will never have any other special cahracters other than what you specified here?? If yes then the above solution is perfect !! |
Adding to Deepak comments...
Usually these characters are from European character set and are called "diacritic" characters. It is possible that if one creeps in other will follow. We had a similar issue, but our issue started when we converted from non-NLS to NLS. Deepak is right in pointing out that we need more information about your situation.
Assuming that you are using NLS, one cautious option would be to look at using Unicode character set/code page to resolve this issue. If your setup is non-NLS then it should be straight forward as others suggested.
Srinivas
|
|
|
|
|
 |
scognet
 since April 2006
Group memberships: Premium Members
Joined: 06 Apr 2006
Posts: 9
Location: MARSEILLE
Points: 87
|
|
|
|
|
|
Some answers to your questions.
I'm with Datastage server without NLS option. The customer doesn't want to implement it now. So i have to work with "exotic" solution.
I have a good result with Oconv(Str,"MCP"). It's good because it make "Converts unprintable characters". I can't use "convert" because when i try to convert 'û' Datastage not reconise 'û'.
Do you know if in Datastage is ther another function to detect all "unprintable characters" ?
Thanks
|
|
|
|
|
 |
ray.wurlod
Participant
Group memberships: Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group
Joined: 23 Oct 2002
Posts: 41076
Location: Canberra, Australia
Points: 228937
|
|
|
|
|
|
|
There is no out-of-the-box function for detecting non-printing characters unless NLS is enabled. But you could write your own.
Code:
FUNCTION IsPrintable(TheString)
* Returns 1 ( ...
|
_________________ Zenith Solutions (Australia) Pty Ltd
-- from obscurity to
clarity
|
|
|
|
 |
|
|