Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Loading Current Date to DB2 table using Load Utility

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Loading Current Date to DB2 table using Load Utility
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    Post subject:
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    Post subject: Hi bibek24
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: Loading Current Date to DB2 table using Load Utili
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us