Unable to trim leading zeroes using trim()
Moderators: chulett, rschirm, roy
I just wrote a 60-second PX job. Starts with a row generator that generates 100 rows with just one column called "Test" of type VarChar(32). The "edit row" sets the values to cycle between "00001" and "00000002". The transform does a simple "TRIM(DSLink2.Test,'0','L')" and the output goes to a PEEK stage. The job runs and the peek output shows that the leading '0' characters have been trimmed.
Are you using NLS in your project and could your zeroes be another glyph in the character space? You could add a SEQ(Test[1,1]) to your output to see if the returned value is 32 as expected.
Are you using NLS in your project and could your zeroes be another glyph in the character space? You could add a SEQ(Test[1,1]) to your output to see if the returned value is 32 as expected.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Yep - thanks for the correction.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Kumar - I don't understand what your post means. The point of my question was to make sure that the string contains a "0" character as we expect it - namely one which has ascii value of 48. If the string contains another glyph then then you would need to change the TRIM function to remove that. All the people here who have tested the TRIM() function have done so successfully, so the attempt is to look for some other explanation. My NLS conjecture is a stab in the dark.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Poster was not able to perform Trim('0001','0','L').ArndW wrote:Kumar - I don't understand what your post means. The point of my question was to make sure that the string contains a "0" character as we expect it - namely one which has ascii value of 48. If the string contains another glyph then then you would need to change the TRIM function to remove that. All the people here who have tested the
TRIM() function have done so successfully, so the attempt is to look for some other explanation. My NLS conjecture is a stab in the dark.
If seq('0') was not equal to 48, then value (0) in the '0001' should not also be equal to 48. ie., both underlying unicode should be equal (atlest with respect to datastage). For example, if seq('0') returns 50 unexpectedly, the '0' in '0001' should also return the same. And so, should trim. So i was under the impression that it could be of some other issue. Sorry if if i got it wrongly
-Kumar
Kumar - I see what you mean; I went back and saw that the poster did use a constant text, not data. So it really ought to have worked, regardless of any NLS setting!
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 49
- Joined: Fri Nov 11, 2005 10:19 am
Hi,
Iam facing a fatal error when Iam trimming white spaces. I have source file text file with material char(7) as a columm and Iam having a OSP in DB2 table with Varchar(7) as a key. Iam looking with Material to OSP . I used functions to trim whitespaces after material and I also had two Leading 00 before material.
Ex 00S0003X
I used TrimLeadingTrailing(Frm_src.Material) and I also tried with StripWhitespace(frm_src.Material). Iam getting an error showing....
main_program: Syntax error: Error in "lookup" operator: Error in input redirection: Error in input parameters: Error in view adapter: Error in binding: Expected '=', got: ")", line 43
Expected ';' or ']', got: "=", line 43; text: "=", line 43 [view()
Expected option or identifier, got: ")", line 44; text: [view()=OSP;
2. I have another doubt . In lookup stage. for Lookup key MANDT. Iam assigning Key expression as job parameter can I give like that
for ex :
lkuptable
Keyexpression . colummname
bbbb(from job parameter) . mandt
Thanks,
Somaraju
Iam facing a fatal error when Iam trimming white spaces. I have source file text file with material char(7) as a columm and Iam having a OSP in DB2 table with Varchar(7) as a key. Iam looking with Material to OSP . I used functions to trim whitespaces after material and I also had two Leading 00 before material.
Ex 00S0003X
I used TrimLeadingTrailing(Frm_src.Material) and I also tried with StripWhitespace(frm_src.Material). Iam getting an error showing....
main_program: Syntax error: Error in "lookup" operator: Error in input redirection: Error in input parameters: Error in view adapter: Error in binding: Expected '=', got: ")", line 43
Expected ';' or ']', got: "=", line 43; text: "=", line 43 [view()
Expected option or identifier, got: ")", line 44; text: [view()=OSP;
2. I have another doubt . In lookup stage. for Lookup key MANDT. Iam assigning Key expression as job parameter can I give like that
for ex :
lkuptable
Keyexpression . colummname
bbbb(from job parameter) . mandt
Thanks,
Somaraju
somaraju
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Please don't hijack threads. Neither of your questions relates to trimming leading zeroes from strings in parallel jobs. Please start a separate thread for each, to assist future searchers.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.