View previous topic :: View next topic
|
Author |
Message |
chandracdac
New User
Joined: 15 Jun 2007 Posts: 92 Location: bangalore
|
|
|
|
I want to insert data in to my DB2 table from my input file. This can be done easily using DB2 load utilities. But my problem is i want to add some more constant while loading the table.
let me give more details on the problem what i am facing. I have one table with say some 5 columns, But in my input file i have only data for 3 columns. The new two columns in a table are current timestamp and come constant. So i wanted to load these two columns with current timestamp and some other constant value. I guess we can do this Insert statement, But i don't have full JCL with me. Could anyone pass the JCL for this?? I checked all the manuals but couldn't able to find.
Thanks. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
JCL won't do it, of course; you'll also need a LOAD utility deck.
Depending on how the target table's columns are defined, you may be able to do what you want with the LOAD utility alone, or you may have to do some actual programming. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Why not use a program to achieve the same ? rather approaching the problem in circumloqutory manner??
Is there any sepecif reason it needs to be done using DB2 utility only |
|
Back to top |
|
|
chandracdac
New User
Joined: 15 Jun 2007 Posts: 92 Location: bangalore
|
|
|
|
JCL won't do it, of course; you'll also need a LOAD utility deck.
yes i meant this only..
I want to insert current time stamp and some constant value while loading the data. i can modify the file before loading and then i can load. But i dnt want this. i want the current stamp value while loading the table. |
|
Back to top |
|
|
chandracdac
New User
Joined: 15 Jun 2007 Posts: 92 Location: bangalore
|
|
|
|
Pandora-Box
i feel using JCL is the right option to do this. writing a program is not touch but it needs lot of other things like program name creation,approval etc etc in my installation.
Thanks |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Quote: |
Why not use a program to achieve the same ? rather approaching the problem in circumloqutory manner??
|
The reasons to use a db2 utility are:
Loading data are what the are designed to do
Easier to write than an entire program
Easier to execute than a program
More efficient, especially for large amounts of data
Note: I could not find the word circumloqutory in the dictionary. Please explain the meaning. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
chandracdac,
If you use utility DSNUTLIB:
You can do an Unload of the data one time. The purpose of this is to create the load cards which are written to DD SYSPRINT as part of the process.
You can then modify these load cards to use the current timestamp and a literal value for your desired columns.
You can then use your modified load cards to load your data.
Surely there is an example of PGM=DSNUTLIB somewhere on your system. Search there as it will be closest to what you will need. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
daveporcelan wrote: |
Quote: |
Quote:
Why not use a program to achieve the same ? rather approaching the problem in circumloqutory manner??
The reasons to use a db2 utility are:
Loading data are what the are designed to do
Easier to write than an entire program
Easier to execute than a program
More efficient, especially for large amounts of data
Note: I could not find the word circumloqutory in the dictionary. Please explain the meaning. |
|
I misspelled circumlocutory
Thanks and I have some knowledge the utility was trying to understand as TS would need the timestamp while load time which would be easier using a program and I am not sure if values could be passed against the fields in UTILITY LOAD like CURRENT TIMESTAMP |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Pandora-Box,
Inserting a timestamp can be done with a load utility.
For everyone: circumlocutory - a roundabout or indirect way of speaking; the use of more words than necessary to express an idea.
Ironically enough, writting a program to load data is the circumlocutory
method in my opinion. In fact the word is the defination of itself. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
ok thanks Dave :-) |
|
Back to top |
|
|
chandracdac
New User
Joined: 15 Jun 2007 Posts: 92 Location: bangalore
|
|
|
|
daveporcelan
Thanks for the solution... will try this.. i didn't get this idea.
Thanks
Chandra |
|
Back to top |
|
|
|