February 09, 2006, 12:06 PM
Mike Johnsonis missing problem
I have the following define in my code. It always evaluates to 0. Does anyone know why?
DEFINE FILE TEROT001_RDWY_CNTRT
FLAG1/I1=IF KEY_DATE IS MISSING THEN 1 ELSE 0;
END
KEY_DATE is of format I8YYMD
February 09, 2006, 12:51 PM
Carol DobsonChange your define to
FLAG1/I1 MISSING ON =IF KEY_DATE IS MISSING THEN 1 ELSE 0;
and see what happens.
February 09, 2006, 01:36 PM
Mike JohnsonThanks, Carol. I gave that a try without success. I was getting the KEY_DATE value from a HOLD file. It turnout the HOLD file was returning no records. I used the following code to resolve my issue. If this can be done a better way I'm open to suggestions.
-IF &LINES EQ 0 GOTO FLAG1;
-IF &LINES GT 0 GOTO FLAG2;
-FLAG1
-SET &FLAG = 1;
-GOTO DONE
-FLAG2
-SET &FLAG = 0;
-DONE
-TYPE FLAG &FLAG
Then used the &FLAG VALUE IN MY MAIN REPORT TO DETERMINE IF SOMETHING SHOLD BE ON OR OFF. Thanks for your help.
February 09, 2006, 02:28 PM
Tony AOne thing on the missing front.
If you are going to use the MISSING attribute in your define then I would suggest that you set the alternate value to MISSING, otherwise there is no pointin the attribute.
FLAG1/I1 MISSING ON =IF KEY_DATE IS MISSING THEN 1 ELSE MISSING;
OR
FLAG1/I1 MISSING ON =IF KEY_DATE IS MISSING THEN 1;
T
February 10, 2006, 04:29 PM
TexasStingraySome Data sources are never missing like fix format master, hold files if missing was not set, etc. One way to code for all data type is to test like this.
FLAG1/I1 = IF KEY_DATE EQ '' THEN 1 ELSE IF KEY_DATE IS MISSING THEN 1 ELSE 0;