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

Update a column condidionally


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

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 22, 2007 6:47 pm
Reply with quote

Hi
I have a DB2 table . I want to update a column based on the value of a working-storage variable.

ie. If ws-var = "A", Set column = 'B'
else Set column = 'C'

Can I do this within a single update?..

Thanks,
Arun
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Fri Nov 23, 2007 9:37 am
Reply with quote

Handle this in your program
IF WS-VAR='A'
WS-COL='B'
ELSE
WS-COL='C'
ENDIF
and always update the table with value from WS-COL. So you will end up with single update statement.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Nov 23, 2007 1:22 pm
Reply with quote

Hi,

Thanks for your reply. I am doing in that way only...

Thanks,
Arun
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts first column truncated in search result IBM Tools 13
No new posts Split a record with data in a differe... DFSORT/ICETOOL 8
Search our Forums:

Back to Top