How Do I Pre-compile Include Files?

garypope

New Member
I want to compile an include file depending on if it is a batch mode or not.

I.E.

IF SESSION:BATCH-MODE THEN DO:
{abc.i}
END.
ELSE DO:
{def.i}
END.


I only want the program to compile one of the include files as both have conflicting variables.

Thanks,
Gary
 

cecsno

Member
garypope said:
I want to compile an include file depending on if it is a batch mode or not.

I.E.

IF SESSION:BATCH-MODE THEN DO:
{abc.i}
END.
ELSE DO:
{def.i}
END.


I only want the program to compile one of the include files as both have conflicting variables.



Thanks,
Gary
You don't. You will need to turn the include files into procedures.
 
I don't think you can do this easily.

Conditional compilation is out because it will take the status when you compile (probably not on batch mode).

The only solution I can think of would be to have 2 versions of the object code (.r) and make sure that the correct one appears first in your PROPATH depending on whether you are in batch mode or not.

To prevent having 2 versions of the source code (.p), you would need to have 2 versions of the include file (.i) and compile with different PROPATHs.

/* progs/abc.i */
DEF VAR iBanana AS INT NO-UNDO INIT 1.

/* progs/batch/abc.i */
DEF VAR iBanana AS INT NO-UNDO INIT 2.

/* progs/banana.p */
DEF VAR iLoop AS INT NO-UNDO.
{abc.i}
DO iLoop = 1 TO iBanana:
......
END.

To compile the normal version your PROPATH should be "progs" and you want to COMPILE banana.p SAVE

To compile the batch version your PROPATH should be "progs/batch,progs" and you want to COMPILE banana.p SAVE INTO progs/batch

Thereafter, when running in normal mode, your PROPATH should be "progs" and when running in batch mode your PROPATH should be "progs/batch,progs" to ensure you pick up the correct version.
 
Top