IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Loading Current Date to DB2 table using Load Utility


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bibek24

New User


Joined: 14 Aug 2007
Posts: 35
Location: Hyderabad

PostPosted: Mon Dec 24, 2007 12:44 pm
Reply with quote

Hello,

How to load Current Date into one of the feilds of a table by using Load Utility?
Table feild - LOAD_DATE DATE EXTERNAL (10)
Currenty other feilds have input data to be loaded and LOAD_DATE has to be loaded with Current Date.

Thank You
Back to top
View user's profile Send private message
bibek24

New User


Joined: 14 Aug 2007
Posts: 35
Location: Hyderabad

PostPosted: Mon Dec 24, 2007 3:40 pm
Reply with quote

My Load Syntax is as follws:

LOAD DATA RESUME YES INDDN SYSREC00
INTO TABLE TABLENAME
(ACC_NUM_ID POSITION (1) CHAR(8) ,
ALT_BILL_ACC_NUMB POSITION (9) CHAR (8) ,
RELATIONSHIP_CODE POSITION (17) CHAR (3),
---------
---------
----------
LOAD_DATE POSITION (108) DATE EXTERNAL (10))

Except LOAD_DATE feild, I am accepting all other feild values from a dataset.
I want the Current Date to be loaded at the Position 108 which is not in the dataset.
So please help me with the syntax.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Dec 25, 2007 11:27 am
Reply with quote

Try this loadcard and let us know the results.


LOAD DATA RESUME YES INDDN SYSREC00
INTO TABLE TABLENAME
(ACC_NUM_ID POSITION (1) CHAR(8) ,
ALT_BILL_ACC_NUMB POSITION (9) CHAR (8) ,
RELATIONSHIP_CODE POSITION (17) CHAR (3),
---------
---------
----------
LOAD_DATE POSITION (108) DATE EXTERNAL (10)
DEFAULTIF (108:117) = ' '
VALUE(CURRENT_DATE))
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Dec 25, 2007 11:29 am
Reply with quote

DEFAULTIF (108:117) = ' '

In the above line give 10 spaces as the date length is of 10 bytes.
Back to top
View user's profile Send private message
bibek24

New User


Joined: 14 Aug 2007
Posts: 35
Location: Hyderabad

PostPosted: Wed Dec 26, 2007 4:22 pm
Reply with quote

No that didd't work.
Its showing - Invalid Keyword Value
Back to top
View user's profile Send private message
abhishekmdwivedi

New User


Joined: 22 Aug 2006
Posts: 95
Location: india

PostPosted: Wed Dec 26, 2007 4:53 pm
Reply with quote

Try changing ,

Quote:

LOAD_DATE POSITION (108) DATE EXTERNAL (10)
DEFAULTIF (108:117) = ' '
VALUE(CURRENT_DATE))


this to

Code:

LOAD_DATE POSITION (108) DATE EXTERNAL (10)
DEFAULTIF (108:117) = '         '
VALUE(CURRENT DATE))
Back to top
View user's profile Send private message
bibek24

New User


Joined: 14 Aug 2007
Posts: 35
Location: Hyderabad

PostPosted: Thu Dec 27, 2007 11:42 am
Reply with quote

Thanks for your replies.
I altered the table with LOAD_DATE set to Current Date.
Back to top
View user's profile Send private message
zero

New User


Joined: 01 Dec 2007
Posts: 21
Location: Hyderabad

PostPosted: Sat Dec 29, 2007 3:18 pm
Reply with quote

Hi,
i tried to load this field with

Code:
LOAD_DATE POSITION (108) DATE EXTERNAL (10)
DEFAULTIF (108:117) = '         '
VALUE(CURRENT DATE))


but, it gives error saying that "INVALID KEYWORD - VALUE".
Here, i guess, we cannot use VALUE clause.

The correct approach can be :

Code:
LOAD_DATE POSITION (108) DATE EXTERNAL (10)
DEFAULTIF (LOAD_DATE = '          ')
what DEFAULTIF does is, it checks the positions 108 to 117 in the input file. it they contain spaces, it loads the LOAD_DATA column with Default value (Generally, the dafault value for a Date field is Current date).

This will work only DEFAULT constraint is defined for the field LOAD_DATE, i guess.

Please correct if i am wrong.

thanks
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Pulling a fixed number of records fro... DB2 2
No new posts How to load to DB2 with column level ... DB2 6
No new posts To get the the current time DFSORT/ICETOOL 13
Search our Forums:

Back to Top