|
View previous topic :: View next topic
|
| Author |
Message |
vina2010
New User
Joined: 06 Sep 2010 Posts: 19 Location: Bangalore
|
|
|
|
Hi
I have CSV data coming from an external system which mainly puts quotes for those data which has comma(,) within it mainly to mask the commas as separate data columns.
For e.g.
Data has a layout as below
Emp id, Name , address Line 1 , Address Line 2 , Country, Pincode
Sample data may contain
123123, Abc, " Address Line 1, Street1",Street2,Bangalore, 575007
1234,sdcdfer,Address 1,"Street 2, Karnataka",Mangalore, 534
So quotes occur dynamically based on occurrence of comma as data and not as a delimiter. I am using DB2 utility to load the data on a table. But during loading few of the data are getting rejected due to delimiter mismatch or length exceeding. So I thought to use 'Trimming' option during loading. But I want to know is there any option to identify the data which has been trimmed during DB2 table loading. As down the line I need to separate the erroneous data from correct ones.
Can you please help?
Thanks, |
|
| Back to top |
|
 |
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
In order to load the data which are enclosed with codes please use below mentioned load card
Sample Load Card:
| Code: |
LOAD DATA
FORMAT DELIMITED COLDEL ',' CHARDEL '"'
INTO TABLE TABLE_NAME
(EMP_ID DECIMAL,
EMP_NAME CHAR,
EMP_ADDR1 CHAR,
EMP_ADDR2 CHAR,
CITY CHAR,
ZIP_CODE INTEGER )
//SYSREC DD *
123123, Abc, " Address Line 1, Street1",Street2,Bangalore, 575007
1234,sdcdfer,Address 1,"Street 2, Karnataka",Mangalore, 534
/* |
|
|
| Back to top |
|
 |
vina2010
New User
Joined: 06 Sep 2010 Posts: 19 Location: Bangalore
|
|
|
|
As mentiioned earlier, the same load utility as below has been used, but I want to know, is there any option which can help me to find which data are trimmed and which data are loaded as it is?
LOAD DATA
FORMAT DELIMITED COLDEL ',' CHARDEL '"' DECPT '.'
INTO TABLE TABLE_NAME
(EMP_ID CHAR STRIP BOTH TRUNCATE,
EMP_NAME CHAR STRIP BOTH TRUNCATE,
EMP_ADDR1 CHAR STRIP BOTH TRUNCATE,
EMP_ADDR2 CHAR STRIP BOTH TRUNCATE,
CITY CHAR STRIP BOTH TRUNCATE,
ZIP_CODE CHAR STRIP BOTH TRUNCATE ) |
|
| Back to top |
|
 |
senthilnathanj
New User
Joined: 31 Jul 2007 Posts: 47 Location: chennai
|
|
|
|
Hi,
When I saw first post, EMP_ID is numeric and last Post EMP_ID is char data type. which one is correct? |
|
| Back to top |
|
 |
vina2010
New User
Joined: 06 Sep 2010 Posts: 19 Location: Bangalore
|
|
|
|
| the data type is not the problem here, basically the table is a temorary one, and all the fields are CHAR type. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| If no other way, compare the data after it is in the database to the original source. |
|
| Back to top |
|
 |
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
if you load without truncate , but with DISCARDDN ddname
I believe the ddname will contain all rows that would have been truncated. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|