Spaces inbetween data getting trimmed off
Moderators: chulett, rschirm, roy
Spaces inbetween data getting trimmed off
Hi All,
I am loading the DB2 table with one of the extract files we get using the parallel jobs. The file has a character data with values like "ABC XYZ", when the data is loaded into the table the value becomes "ABC XYZ". The spaces inbetween are getting trimmed off. When we loaded the same data using DB2 Import it loads exactly as it is in the file like "ABC XYZ".
So I was wondering what could cause this,only thing we do in preprocessing is triming of the ^M characters before loading the files. We use sed to do trimming the ^M Characters.
Regards,
Chris
I am loading the DB2 table with one of the extract files we get using the parallel jobs. The file has a character data with values like "ABC XYZ", when the data is loaded into the table the value becomes "ABC XYZ". The spaces inbetween are getting trimmed off. When we loaded the same data using DB2 Import it loads exactly as it is in the file like "ABC XYZ".
So I was wondering what could cause this,only thing we do in preprocessing is triming of the ^M characters before loading the files. We use sed to do trimming the ^M Characters.
Regards,
Chris
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
This is the pipe delimited input file we get with four fields and the FIELD3 has spaces inbetween the data and End of the line we have the ^M Character (<CTRL>+V+M)
FIELD1|FIELD2|FIELD3|FIELD4
ABC|DEF|EFG<SPACE><SPACE><SPACE>IJK|123^M
XYZ|WYC|ABC<SPACE><SPACE>12|345^M
Its a simple pass through job with no transformations but when the data is loaded into the tables the table has
FIELD1|FIELD2|FIELD3|FIELD4
ABC|DEF|EFG<SPACE>IJK|123
XYZ|WYC|ABC<SPACE>12|345
which is, FIELD3 trims off multiple spaces into just one space in between the data.
We use sed 's/\^M//g' <oldfile>newfile to trim off the ^M character.
Let me know if any more detail is required.
FIELD1|FIELD2|FIELD3|FIELD4
ABC|DEF|EFG<SPACE><SPACE><SPACE>IJK|123^M
XYZ|WYC|ABC<SPACE><SPACE>12|345^M
Its a simple pass through job with no transformations but when the data is loaded into the tables the table has
FIELD1|FIELD2|FIELD3|FIELD4
ABC|DEF|EFG<SPACE>IJK|123
XYZ|WYC|ABC<SPACE>12|345
which is, FIELD3 trims off multiple spaces into just one space in between the data.
We use sed 's/\^M//g' <oldfile>newfile to trim off the ^M character.
Let me know if any more detail is required.
-
- Charter Member
- Posts: 64
- Joined: Sat Sep 17, 2005 10:42 am
what is happening if the field3 has only spaces, we had a similar issue while loading to Oracle using Load option ( bulk load). Whenever we have all spaces, it simply trims all spaces and loaded a NULL into Target. Can you confirm what is hapening with DB2 when you have all spaces in a field.
Thank You
Thank You
-
- Participant
- Posts: 57
- Joined: Sat Jun 09, 2007 1:14 am
- Location: chicago
My Load option is giving me a problem
Can we use a load option when loading data from file to table where the transformer in between is used to change the datatype
I have a problem,
like,
Hi Suresh Garu,
My source is file and target is oracle
when I am usng the upsert method
the records are getting populated in the target
but when I am using the load method
the job is getting aborted giving the following error
Oracle_Enterprise_2,2: sh: line 1: sqlldr: command not found
The call to sqlldr failed; the return code = 32,512;
Unable to access the log file.
Oracle_Enterprise_2,2: The runLocally() of the operator failed.
pls find the attachment also
thanks
I have a problem,
like,
Hi Suresh Garu,
My source is file and target is oracle
when I am usng the upsert method
the records are getting populated in the target
but when I am using the load method
the job is getting aborted giving the following error
Oracle_Enterprise_2,2: sh: line 1: sqlldr: command not found
The call to sqlldr failed; the return code = 32,512;
Unable to access the log file.
Oracle_Enterprise_2,2: The runLocally() of the operator failed.
pls find the attachment also
thanks
panchusrao2656 wrote:what is happening if the field3 has only spaces, we had a similar issue while loading to Oracle using Load option ( bulk load). Whenever we have all spaces, it simply trims all spaces and loaded a NULL into Target. Can you confirm what is hapening with DB2 when you have all spaces in a field.
Thank You
Hi I have experience in parallel extender datastage I am ready to give/take help from other
hope we all help each other hand in hand
hope we all help each other hand in hand
With Oracle loads the APT_ORACLE_LOAD_DELIMITED setting affects how spaces are automatically trimmed, but that doesn't happen in DB2
<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:
What happens if you run that sed command over the file in UNIX, without DataStage in the mix? Are the internal spaces trimmed or unaffected?
Trying to isolate the location of the problem.
Trying to isolate the location of the problem.
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.
Does that mean that the extra spaces didn't get trimmed out in the preprocessing?krishobby wrote:...I did the preprocessing outside Datastage in UNIX and no luck...
If you add another output to a stage right before the DB2 write and output your FIELD3 value does it still have duplicate spaces?
What stage and method are you using to load to DB2?
The problem is odd, as DB2 varchar() will autotrim trailing spaces but not remove duplicate internal ones.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>