OE 11.6 - Let's say I have a program sample.i with below code snippet;
&IF DEFINED(test) = 2 &THEN
message "{&test}" view-as alert-box.
&ENDIF.
Let's say I have the below code in test.p. Now when I run the below code I would expect the message statement not to be added to my .p file. to my surprise when I run I get the message with value 'yes' on message box.
{sample.i
&t2_lock = NO-LOCK
/* &test = yes */
}
Listing file looks weird too;
{} Line Blk
-- ---- ---
1
2 {sample2.i
3 &t2_lock = NO-LOCK
4 /* &test = yes */
5 }
1 1 &IF DEFINED(test) = 2 &THEN
1 2 message "{&test}yes" view-as alert-box.
1 3 &ENDIF.
5
6
Is it a bug or am I missing something here?
Comments are not parsed at all in include arguments. You can not comment out include arguments to stop them from being passed to the included file. A "/*" will be interpreted as a positional argument, and will be passed to the included file. If expanded in the included file, it may be interpreted as the start of a comment in that file. But not in the calling file.
Looks like a bug. I would suggest logging it with tech support.
Or most probably you have a .r hanging around somewhere, that would break so many things if it were a bug so I’m pretty sure it’s just another propath issue :)
I can confirm the behavior - see www.progresstalk.com/.../include-files-named-parameters.163766
I think the /* is parsed as a positional argument and that these are ignored because you have been using named arguments already and these can't be mixed.
E.g. if you try this
{sample.i
&t2_lock = NO-LOCK
please ignore the things I typed here
&var = abcdefg
}
this would still work but you'd only have the named arguments &t2_lock and &var and the other arguments are lost.
If you start with positional arguments you don't have any named-arguments anymore but you still have them as position arguments.
Something like this
{sample.i
/* &t2_lock = NO-LOCK */
&test = yes
}
doesn't have a named argument &test!
But it will have a positional argument 1 as /*, argument 2 as &t2_lock, 3 as =, 4 as NO-LOCK and so on.
Comments are not parsed at all in include arguments. You can not comment out include arguments to stop them from being passed to the included file. A "/*" will be interpreted as a positional argument, and will be passed to the included file. If expanded in the included file, it may be interpreted as the start of a comment in that file. But not in the calling file.