GDX2ACCESSExample4.gms : Special Value Mapping

Description

This example demonstrates how the GAMS special values (EPS, INF, -INF, NA and
Undf) can be mapped to some user specified values in the database file. The
special values will be stored as scalars in order to demonstrate the scalarTable
option additionally.

This model is referenced in the "Special Value Mapping" example from the GDX2ACCESS
Documentation.

Keywords: GDX2ACCESS, data exchange, GAMS language features


Category : GAMS Data Utilities library


Main file : GDX2ACCESSExample4.gms   includes :  GDX2ACCESSExample4.gms

$title Special Value Mapping (GDX2ACCESSExample4,SEQ=128)

$onText
This example demonstrates how the GAMS special values (EPS, INF, -INF, NA and
Undf) can be mapped to some user specified values in the database file. The
special values will be stored as scalars in order to demonstrate the scalarTable
option additionally.

This model is referenced in the "Special Value Mapping" example from the GDX2ACCESS
Documentation.

Keywords: GDX2ACCESS, data exchange, GAMS language features
$offText

$if %system.filesys% == UNIX $abort.noError 'This model cannot run on a non-Windows platform';
$call msappavail -Access
$ifE errorLevel<>0 $abort.noError 'Microsoft Access is not available!';


* define an INI file here to active the scalarTable option and for defining
* the mapped values of the special values
$onEcho > howToWrite.ini
[settings]
inf=1
mininf=2
eps=3
na=4
undf=5
scalarTable=1
$offEcho

$onUndf
Scalar
   pInf      /  inf /
   mInf      / -inf /
   epsilon   /  eps /
   notAvail  /   na /
   undefined / undf /;

* display pInf, mInf, epsilon, notAvail, undefined;

* export the scalars to an Access database file into a single table named
* ScalarParameter by using the scalarTable option
* the special values are translated to the following values by default:
*  INF ->  1.0e100
* -INF -> -1.0e100
* EPS,NA,UNDF -> 0

execute_unload 'scalars.gdx', pInf, mInf, epsilon, notAvail, undefined;
execute 'gdx2access scalars.gdx @howToWrite.ini > %system.nullfile%';