Does anyone have any examples of how to do a conditional include?

kckoll

New Member
Hi,

I'm trying to write a program that utilizes conditional includes, something similar to C includes. Is this possible in progress or am I just wasting my time?

Regards,

Kent
 

lord_icon

Member
Re: conditional include?

RE:
I'm trying to write a program that utilizes conditional includes, something similar to C includes. Is this possible in progress or am I just wasting my time?

>>Your objective is defined unclearly. Simply for a conditional include, place the include in a condition.
1)IF cVar = 'WhatEver' THEN
2) {&includeThis.i}
1 = The condition 2 = The include
 

kckoll

New Member
This thread is similar to the other thread I started, "Am I being stupid or what?" I have an include file that I want to pass paramaters to if the condition is meet. The problem I'm having, seems to be with the preprocessor evaluating both the include lines.

if infile = "F"
then do:
{lib/rpt-open.i &noheader=1 &page-size=0}.
end.

else
do:
{lib/rpt-open.i}.
end.

I've looked at the rpt-open.i file and it has a lot of preprocessor statements, i.e.
&IF ....
&THEN
....
&ENDIF

I believe this is what is causing me problems, because I'm referencing the same include file, only one has arguments passed in and the other doesn't. Individually, each line works, but put in to a conditional statement and I get the following error: Colon followed by white space terminates a statement.
 

richardparks

New Member
How about this approach?{lib/rpt-open.i &no-header=(IF infile="F" THEN 0 ELSE 1) &page-size=(IF infile="F" THEN 0 ELSE VALUE(symix.parms.max-line) ) }
 
Top