unload15.gms : Test $gdxUnload

Description

GAMS 35 introduced $gdxUnload as alternative to $gdxOut ... $unload ... $gdxOut.
It is a single statement to open a GDX file and unload symbols to it and does not
interfere with other $unload operations to another file opened via $gdxOut before.

Contributor: Lutz Westermann, February 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : unload15.gms

$title 'Test $gdxUnload' (UNLOAD15,SEQ=850)

$ontext
GAMS 35 introduced $gdxUnload as alternative to $gdxOut ... $unload ... $gdxOut.
It is a single statement to open a GDX file and unload symbols to it and does not
interfere with other $unload operations to another file opened via $gdxOut before.

Contributor: Lutz Westermann, February 2021
$offtext

Set i / i1*i3 /
    j / j1*j3 /;
    
Parameter a(i) / #i 1 /
          b(j) / #j 2 /;
          
* Make sure that in general $gdxUnload does the same as $gdxOut .. $unload .. $gdxOut
$gdxUnload ia1.gdx i a

$gdxOut ia2.gdx
$unload i a
$gdxOut

$call.checkErrorLevel gdxdiff ia1.gdx ia2.gdx > %system.nullfile%


$gdxUnload all1.gdx

$gdxOut all2.gdx
$unload
$gdxOut

$call.checkErrorLevel gdxdiff all1.gdx all2.gdx > %system.nullfile%


* Make sure that $gdxUnload can be called between two $unload calls w/o interfering with the operations for the file opened with $gdxOut

$gdxOut ia3.gdx
$unload i

$gdxUnload jb1.gdx j b

$unload a

$gdxOut jb2
$unload j b
$gdxOut

$call.checkErrorLevel gdxdiff ia1.gdx ia3.gdx > %system.nullfile%
$call.checkErrorLevel gdxdiff jb1.gdx jb2.gdx > %system.nullfile%