S
Stefan Drissen
Guest
DEFINED returns 0 (not defined), 1 (scoped) or 2 (global). &IF DEFINED (foo) &THEN without a comparison returns false if the value of DEFINED is 0, otherwise true - this short cut does shortly bite you if you want to add operators to the condition and you will need to add the 0 (I dislike when is sufficient). Depending on your actual case it can help to /not/ put the quotes around the defined value since you can then use it in more places - for example in the definition of a variable. &SCOPED-DEFINE test integer &IF "{&test}" = "integer" &THEN DEFINE VARIABLE foo AS {&test} NO-UNDO. &ENDIF &SCOPED-DEFINE datatype integer &IF DEFINED( datatype ) 0 &THEN DEFINE VARIABLE foo AS {&datatype} NO-UNDO. MESSAGE foo "{&datatype}". &ENDIF If you are only using the values as strings then definitely keep the quotes as you will trap typing errors in the preprocessor name with compile errors.
Continue reading...
Continue reading...