idir01.gms : Test including files from different locations

Description

The command line parameter inputDir (synonym: iDir) allows to include text
files (e.g. with $include) or load GDX files ($gdxIn) at compile time from
other directories than the working directory. This is a basic test for this
parameter.

Contributor: Lutz Westermann, June 2020


Small Model of Type : GAMS


Category : GAMS Test library


Main file : idir01.gms

$Title Test including files from different locations (idir01,SEQ=822)

$ontext
The command line parameter inputDir (synonym: iDir) allows to include text
files (e.g. with $include) or load GDX files ($gdxIn) at compile time from
other directories than the working directory. This is a basic test for this
parameter.

Contributor: Lutz Westermann, June 2020
$offtext

$if not dExist subDir%system.dirsep%subSubDir $call.checkErrorlevel mkdir -p subDir%system.dirsep%subSubDir

$echo Set i /i1*i3/; > subDir/set.inc

$onEchoV > main.gms
$include set.inc
Display i;
$offEcho

$call gams main.gms lo=%gams.lo%
$ifE errorlevel=0 $abort Expecting error

$call gams main.gms lo=%gams.lo% iDir subDir gdx=subDir%system.dirsep%subSubDir%system.dirsep%i.gdx
$ifE errorlevel<>0 $abort No error expected using iDir

$onEchoV > main2.gms
Set i,j;
$gdxIn subSubDir%system.dirsep%i.gdx
$load i
$gdxLoad subSubDir%system.dirsep%i.gdx j=i
$offEcho

$call gams main2.gms lo=%gams.lo%
$ifE errorlevel=0 $abort Expecting error

$call gams main2.gms lo=%gams.lo% iDir subDir
$ifE errorlevel<>0 $abort No error expected using iDir