Include Files - Names Parameter

Posted by Saravanakumar Balasubramanian on 02-Jan-2017 19:30

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
-- ---- ---

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.

Is it a bug or am I missing something here?

Posted by ske on 03-Jan-2017 08:33

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.

All Replies

Posted by Simon L. Prinsloo on 02-Jan-2017 23:27

Looks like a bug. I would suggest logging it with tech support.

Posted by marian.edu on 03-Jan-2017 01:06

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 :)


Marian Edu

Acorn IT 
+40 740 036 212

Posted by Stefan Drissen on 03-Jan-2017 02:15
Posted by Jeroen Eeuwes on 03-Jan-2017 03:37

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.

Posted by ske on 03-Jan-2017 08:33

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.

This thread is closed