[Stackoverflow] [Progress OpenEdge ABL] What is the difference between &GLOBAL-DEFINE and &SCOPED-DEFINE in Progress 4gl?

Status
Not open for further replies.
J

Jeff Moorhead

Guest
I understand that both are preprocessor directives, but I am unable to figure out how they are different. All that is stated in the official Progress documentation is "The syntax of the &GLOBAL-DEFINE and &SCOPED-DEFINE directives are identical but these directives are used differently." which is not very helpful.

I found one source that says that &SCOPED-DEFINE variables remain defined until the compiler finishes the current file, while &GLOBAL-DEFINE variables remain defined until the compiler finishes the current program. However, I don't quite follow what that means. This source also states that &SCOPED-DEFINE variables are propagated down the include stack, but not up it (I assume &GLOBAL-DEFINE is bidirectional?). I have tried to create a simple example but no matter what, I can't figure out the difference.

File 1: test1.p

{test2.i}


File 2: test2.i

&GLOBAL-DEFINE HELLO "Hello world!"
{test3.i}


File 3: test3.i

MESSAGE {&HELLO} VIEW-AS ALERT-BOX.


Whether or not HELLO is &SCOPED-DEFINE or &GLOBAL-DEFINE, it's still defined in test3.i. So what exactly is the difference?

Continue reading...
 
Status
Not open for further replies.
Top