MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Evaluate with ANY for Nulls.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Wed Jan 28, 2004 12:27 pm    Post subject: Evaluate with ANY for Nulls. Reply with quote

Hi Friends,

I am using the following Evaluate in my code ...where
CLM-INTER-AGN-IND & CLM-INTER-LIAB-IND are DB2 Host variables with possible values of Yes, No or NULL.

EVALUATE CLM-INTER-AGN-IND ALSO CLM-INTER-LIAB-IND
WHEN WSV-YES ALSO ANY
WHEN ANY ALSO WSV-YES
MOVE '01' TO BOR010-INTER-STATE-CD
WHEN OTHER
MOVE '02' TO BOR010-INTER-STATE-CD
END-EVALUATE.

My concern :
1) If either of the Columns were to contain a NULL value would the ANY evaluate to a TRUE or would this result in a SOC7 Abend ?!!

Note :
1) I do have Null Indicator variables in the INTO of my Query such as CLM-INTER-LIAB-IND-NIND etc but have not included in the Evaluate assuming it would not be necessary and hoping the ANY is true.
2) Expeditor has been disabled here for a while .

Vini.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Jan 28, 2004 12:58 pm    Post subject: Reply with quote

Vini,

You cannot check a null in cobol as NULL in DB2 is when the value is unknown. I would set a default value for the columns when the DB2 query returns a NULL value. You can use functions like COALESCE or VALUE.


Code:

SELECT VALUE(COL1,'ANY')             
      ,VALUE(COL2,'ANY')
  FROM TABLE


Now it is easier to check for the values.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Wed Jan 28, 2004 1:27 pm    Post subject: Reply with quote

Kolusu,

That sure is a better alternative 8) .

If I have following in cobol , when COL1 has a NULL value at Run time ...would this goto the ELSE or would this result in an Abend ?

IF COL1 = 'YES'
MOVE ....
ELSE
MOVE ...
END-IF

My idea is it would abend.. so normally what I do is ...
IF COL1-NULL-IND NOT = -1 AND COL1= 'YES'

However ...by implementing the VALUE function in SELECT as u mention... does simplify the code .

Thnks~

Vini.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group