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

Regarding timestamp


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

Active User


Joined: 21 Aug 2008
Posts: 112
Location: hyd

PostPosted: Tue Nov 19, 2013 5:37 pm
Reply with quote

Hi All,

I'm updating few values from cics screen to db2 table one of which being updated is current_timestamp.

Code:

exec sql
        insert into db2table
        (cust_id,time) values (001,current timestamp):
end-exec


after insertying the values in the db2 table apparaently i have to populate into the cics screen the inserted time stamp that have been saved in db2 table. for that i have to take the current_timestamp that i have updated in table Only.How can i take the timestamp above into working storage variable and populate into the screen???? should i write another query with priomary key or is there any other way to do the same.

Please suggest frens....
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Tue Nov 19, 2013 6:05 pm
Reply with quote

After insert select the data and pass it
Back to top
View user's profile Send private message
Dhrubojoty mukherjee

New User


Joined: 23 Mar 2010
Posts: 14
Location: kolkata

PostPosted: Tue Nov 19, 2013 9:42 pm
Reply with quote

In your program select the data and take it into the host variable.Then move the data to the out-variable of the cics map...
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Nov 20, 2013 2:43 pm
Reply with quote

first of all : a TS column called "time" is a very bad idea
second : select the current timestamp while inserting :
Code:
SELECT TScol
  FROM FINAL TABLE (insert into db2table
        (cust_id,tscol) values (001,current timestamp));
Back to top
View user's profile Send private message
ram_vizag

Active User


Joined: 21 Aug 2008
Posts: 112
Location: hyd

PostPosted: Wed Nov 20, 2013 4:23 pm
Reply with quote

GuyC wrote:
first of all : a TS column called "time" is a very bad idea
second : select the current timestamp while inserting :
Code:
SELECT TScol
  FROM FINAL TABLE (insert into db2table
        (cust_id,tscol) values (001,current timestamp));


Hi GuyC,

I have taken as Current Timestamp only....Could you please have a look suggest for the solution. Thanks in Advance.The below query i have written

Code:

exec sql
        insert into db2table
        (cust_id,time) values (001,current timestamp):
end-exec
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Nov 20, 2013 7:25 pm
Reply with quote

my previous post was a suggestion of a solution :
You can select a generated column at the time of insert.
Google DB2 SELECT FROM INSERT , read and learn
publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z10.doc.apsg%2Fsrc%2Ftpc%2Fdb2z_selectvalueinsert.htm
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 To get the count of rows for every 1 ... DB2 3
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
No new posts Timestamp difference and its average ... DB2 11
No new posts To get previous month from current ti... SYNCSORT 7
No new posts Calculate with timestamp PL/I & Assembler 19
Search our Forums:

Back to Top