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
 

 

Inserting Data Into DB2 table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 87
Location: bangalore

PostPosted: Wed May 30, 2012 4:27 pm    Post subject: Inserting Data Into DB2 table
Reply with quote

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

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Wed May 30, 2012 4:40 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed May 30, 2012 4:43 pm    Post subject:
Reply with quote

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

New User


Joined: 15 Jun 2007
Posts: 87
Location: bangalore

PostPosted: Wed May 30, 2012 4:46 pm    Post subject: Reply to: Inserting Data Into DB2 table
Reply with quote

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

New User


Joined: 15 Jun 2007
Posts: 87
Location: bangalore

PostPosted: Wed May 30, 2012 4:48 pm    Post subject: Reply to: Inserting Data Into DB2 table
Reply with quote

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

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Wed May 30, 2012 4:54 pm    Post subject:
Reply with 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.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Wed May 30, 2012 5:07 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed May 30, 2012 5:19 pm    Post subject:
Reply with quote

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

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Wed May 30, 2012 6:09 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed May 30, 2012 6:42 pm    Post subject:
Reply with quote

ok thanks Dave :-)
Back to top
View user's profile Send private message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 87
Location: bangalore

PostPosted: Mon Jun 04, 2012 10:16 am    Post subject: Reply to: Inserting Data Into DB2 table
Reply with quote

daveporcelan
Thanks for the solution... will try this.. i didn't get this idea.

Thanks
Chandra
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 Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
No new posts How to move a long alphanumeric data ... lind sh COBOL Programming 6 Mon Dec 05, 2016 7:51 pm
No new posts ODPP(Optim Data privacy Provider) Iss... Rama kishore IBM Tools 1 Mon Nov 07, 2016 5:46 pm
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm


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