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
 

 

Can we use Host variables in the Update staement?

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

New User


Joined: 24 Jan 2007
Posts: 28
Location: pune

PostPosted: Tue Apr 03, 2007 6:29 pm    Post subject: Can we use Host variables in the Update staement?
Reply with quote

Hi everybody

Can we move the updated field of the table into the host variables?means directly can we give "into :host-var" clause in teh updte stmt?
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Tue Apr 03, 2007 6:35 pm    Post subject:
Reply with quote

Hi There,

Yes we can directly use host variable as follows

Code:
UPDATE ILF006VW                               
  SET POLICY_CLASS   =
      :AIS-MIG-POLICY-HEADER-VIEW.POLICY-CLASS
  WHERE POLICY_NUMBER =                         
      :AIS-MIG-POLICY-HEADER-VIEW.POLICY-NUMBER
Back to top
View user's profile Send private message
poongs
Warnings : 1

New User


Joined: 24 Jan 2007
Posts: 28
Location: pune

PostPosted: Wed Apr 04, 2007 9:31 am    Post subject: Re: Can we use Host variables in the Update staement?
Reply with quote

Hi

thnx for the reply....i got an idea on that....but i'm not sure...whether we can use the "into :host-var" clause in the update stmt....an example wud be like the one below:


update date-1

set var1 = var1+1

into :ws-var

where var2 = 2


that is i'm upadating a field in the table as weel as i want to move the updated field into my host variable.is it possible...coz this may avoid another SQL stmt of selecting the updated filed....

thnx in advance.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Apr 04, 2007 10:03 am    Post subject:
Reply with quote

Hi poongs,

I think it would not work
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Wed Apr 04, 2007 11:37 am    Post subject:
Reply with quote

It violates the Update statement Syntax. It will not work
Back to top
View user's profile Send private message
poongs
Warnings : 1

New User


Joined: 24 Jan 2007
Posts: 28
Location: pune

PostPosted: Wed Apr 04, 2007 2:56 pm    Post subject: Re: Can we use Host variables in the Update staement?
Reply with quote

thnx everybody for clearing my doubt...
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Apr 05, 2007 2:24 am    Post subject:
Reply with quote

Hello,

Another way to think of it might be that we "read" into and we "write" from.
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 IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:23 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:21 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am


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