MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DB2 table load

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
20cents
Beginner


Joined: 26 Oct 2005
Posts: 25
Topics: 7
Location: Between Heaven and Hell

PostPosted: Mon Jan 16, 2006 10:38 pm    Post subject: DB2 table load Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Tue Jan 17, 2006 12:03 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
haree_amrid
Beginner


Joined: 21 Dec 2005
Posts: 9
Topics: 3
Location: INDIA

PostPosted: Tue Jan 17, 2006 1:27 am    Post subject: Reply with quote

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
View user's profile Send private message
20cents
Beginner


Joined: 26 Oct 2005
Posts: 25
Topics: 7
Location: Between Heaven and Hell

PostPosted: Tue Jan 17, 2006 6:02 am    Post subject: Thanks all Reply with quote

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
View user's profile Send private message Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Tue Jan 17, 2006 8:13 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
20cents
Beginner


Joined: 26 Oct 2005
Posts: 25
Topics: 7
Location: Between Heaven and Hell

PostPosted: Wed Jan 18, 2006 12:20 am    Post subject: Reply with quote

Big Tango to all.

Very Happy
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group