View previous topic :: View next topic |
Author |
Message |
20cents Beginner

Joined: 26 Oct 2005 Posts: 25 Topics: 7 Location: Between Heaven and Hell
|
Posted: Mon Jan 16, 2006 10:38 pm Post subject: DB2 table load |
|
|
Here's the scenario:
1. I got a file (FILE1) which contains the account numbers (column 20-38 )
2. I need to load these account numbers into a table (TABLE1), such that
the table fields would contain:
ACCT_NUM - PIC X(19) - will be from FILE1
DATE_OPN - PIC X(10) - will be "02/28/2004"
ACCT_BAL - PIC 9(9)V9(2) - will be zeroes
ACCT_STAT - PIC X(10) - will be spaces
How will I do it? Any help is greatly appreciated. |
|
Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Tue Jan 17, 2006 12:03 am Post subject: |
|
|
You have 2 options:
1. Alter your input file (using editor, or programmatically) to containd the desired values.
2. CREATE your table with defaults equivalent to your values.
O.
________
volcano digital vaporizer
Last edited by ofer71 on Sat Feb 05, 2011 11:29 am; edited 1 time in total |
|
Back to top |
|
 |
haree_amrid Beginner
Joined: 21 Dec 2005 Posts: 9 Topics: 3 Location: INDIA
|
Posted: Tue Jan 17, 2006 1:27 am Post subject: |
|
|
Hi 20 cents,
First you load the table for the cloumn ACCT_NUM from the Input file using load utility. Other two columns(ACCT_BAL , ACCT_STAT) you can set the value using the default statement while creation of the table. The column DATE_OPN can be put the value through Update stmt. _________________ With Regards,
Hareesh Amrideswaran |
|
Back to top |
|
 |
20cents Beginner

Joined: 26 Oct 2005 Posts: 25 Topics: 7 Location: Between Heaven and Hell
|
Posted: Tue Jan 17, 2006 6:02 am Post subject: Thanks all |
|
|
Thanks all.
My LOAD is working fine now. But, I do have another query:
I need to add into my job to load NULL value to a DATE field. How do I tackle this?
my Input file:
000010038010000000002/28/200602/28/2006TESTTM08
000010038010000000102/28/200602/28/2006TESTTM08
000010038010000000202/28/200602/28/2006TESTTM08
My load command:
LOAD DATA RESUME YES
INTO TABLE IN1VG.TBC_ACCT_CONV
(NBR_CARDH_ACCT POSITION( 1) CHAR(19),
DATE_ACCT_CONV POSITION(20) DATE EXTERNAL(10),
DATE_LEGCY_LST_CYC POSITION(30) DATE EXTERNAL(10),
TECH_COL_USER_ID POSITION(40) CHAR(8))
what if I want to add another column DATE_DLNQ_STR_LEND, such that
LOAD DATA RESUME YES
INTO TABLE IN1VG.TBC_ACCT_CONV
(NBR_CARDH_ACCT POSITION( 1) CHAR(19),
DATE_ACCT_CONV POSITION(20) DATE EXTERNAL(10),
DATE_LEGCY_LST_CYC POSITION(30) DATE EXTERNAL(10),
TECH_COL_USER_ID POSITION(40) CHAR(8)
DATE_DLNQ_STR_LEND POSITION(48) DATE EXTERNAL(10))
I want DATE_DLNQ_STR_LEND to load in NULL values. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
Posted: Tue Jan 17, 2006 8:13 am Post subject: |
|
|
20cents,
create a 58 byte lrecl file with low-values x'00' at pos 48 for a length of 10 and put a question mark('?') at pos 58 and use the following load card to load the table.
Code: |
LOAD DATA RESUME YES INTO TABLE IN1VG.TBC_ACCT_CONV
(
NBR_CARDH_ACCT POSITION( 1 )
CHAR( 19) ,
DATE_ACCT_CONV POSITION( 20 )
DATE EXTERNAL( 10) ,
DATE_LEGCY_LST_CYC POSITION( 30 )
DATE EXTERNAL( 10) ,
TECH_COL_USER_ID POSITION( 40 )
CHAR( 8) ,
DATE_DLNQ_STR_LEND POSITION( 48 )
DATE EXTERNAL( 10)
NULLIF( 58)='?'
)
|
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
20cents Beginner

Joined: 26 Oct 2005 Posts: 25 Topics: 7 Location: Between Heaven and Hell
|
Posted: Wed Jan 18, 2006 12:20 am Post subject: |
|
|
Big Tango to all.
 |
|
Back to top |
|
 |
|
|