Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts TAPE VERIFY utility?? MrExtraordinare JCL & VSAM 3 Fri Dec 09, 2016 10:57 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us