DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
Author Message
satheesh_color
Participant



Joined: 16 Jun 2005
Posts: 178

Points: 2104

Post Posted: Fri Sep 21, 2018 6:07 pm Reply with quote    Back to top    

DataStage® Release: 11x
Job Type: Parallel
OS: Unix
Hi All,

I am finding difficulty while converting the below case statement into the IF else logic to use it into a constaraint while calculation the below scenario..especially with huge amount of data. I tried implemented at source query level, it work for minimal amount of data.

Code:
CASE   WHEN a.Id=2   THEN
            COUNT(DISTINCT   CASE
                  WHEN b.code IN ('A','B','C','D') THEN c.item
                  ELSE NULL
               END
            ) else 0 END as CNT1,
CASE WHEN a.Id=2   THEN             
            SUM(CASE
                  WHEN b.code IN ('A','B','C','D') AND c.item IS NULL THEN 1
                  ELSE 0
               END
            )    ELSE 0 END as CNT2


SUM(CNT1) + SUM(CNT2) AS TOTAL_CNT

Kindly throw some light on the same if you have any thoughts.

Thanks,
S.R
ray.wurlod

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 54407
Location: Sydney, Australia
Points: 295092

Post Posted: Fri Sep 21, 2018 7:07 pm Reply with quote    Back to top    

Replace CASE WHEN with IF and insert THEN after the first condition. Replace every remaining WHEN with ELSE IF. Remove the END. You will need to have the results of the COUNT and SUM queries ...

_________________
RXP Services Ltd
Melbourne | Canberra | Sydney | Hong Kong | Hobart | Brisbane
currently hiring: Canberra, Sydney and Melbourne (especially seeking good business analysts)
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours