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

Can we use Host variables in the Update staement?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 1209
Location: Bangalore,India

PostPosted: Tue Apr 03, 2007 6:35 pm
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
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: 1209
Location: Bangalore,India

PostPosted: Wed Apr 04, 2007 10:03 am
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
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
Reply with quote

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

Moderator Emeritus


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

PostPosted: Thu Apr 05, 2007 2:24 am
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 All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Substitution of JCL variables CLIST & REXX 10
No new posts Can BPXBATCH update TAPE file COBOL Programming 3
No new posts Repeat n times by substuting SEQNUM i... DFSORT/ICETOOL 2
No new posts Preserve changes to ISPF Panel Variables TSO/ISPF 5
No new posts access the last host command CLIST & REXX 2
Search our Forums:


Back to Top