View previous topic :: View next topic |
Author |
Message |
vini Intermediate
Joined: 12 Jan 2004 Posts: 240 Topics: 48 Location: Maryland
|
Posted: Wed Jan 28, 2004 12:27 pm Post subject: Evaluate with ANY for Nulls. |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Jan 28, 2004 12:58 pm Post subject: |
|
|
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 |
|
 |
vini Intermediate
Joined: 12 Jan 2004 Posts: 240 Topics: 48 Location: Maryland
|
Posted: Wed Jan 28, 2004 1:27 pm Post subject: |
|
|
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 |
|
 |
|
|