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
 

 

Using Work Variables in COALESCE

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

New User


Joined: 26 Nov 2008
Posts: 13
Location: UK

PostPosted: Wed Dec 17, 2008 8:31 pm    Post subject: Using Work Variables in COALESCE
Reply with quote

Hi,

I am trying to use COLAESCE in one of my select SQLs. I would explain the problem i am facing with an example,

Code:
SELECT COALESCE(MAX(MARK),100)           
FROM   <DB2TABLE>
WHERE  NAME = :WS_NAME


The above SQL would work fine. It would return either MAX(MARK) or 100.

My question is, if I have 100 in a working storage variable(e.g. WS_SCORE), would I be able to do something like,

Code:
SELECT COALESCE(MAX(MARK),:WS_SCORE)           
FROM   <DB2TABLE>
WHERE  NAME = :WS_NAME


I think the above SQL would not work, as I get SQLCODE -171. But can anyone let me know if I can pass :WS_SCORE like above or in any other way using COALESCE?

Thanks.
Back to top
View user's profile Send private message

ikumar

New User


Joined: 02 Aug 2005
Posts: 81

PostPosted: Thu Dec 18, 2008 11:15 am    Post subject: Reply to: Using Work Variables in COALESCE
Reply with quote

Why don't you try it using host variable instead of WS variable...
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 Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Is it possible to pass variables of s... Csongor CLIST & REXX 2 Fri Jun 10, 2016 7:33 pm
No new posts TWS 'global' or 'local' variables Steve Coalbran IBM Tools 2 Thu Mar 17, 2016 7:40 pm
No new posts What is the maximum number of sort wo... Pravina M SYNCSORT 2 Mon Mar 14, 2016 4:51 pm
No new posts Using different values for Skeleton d... venksiv CLIST & REXX 8 Thu Sep 03, 2015 5:28 pm


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