The GDXRENAME
program renames the unique elements in a GDX file using the unique elements from a second GDX file.
Usage
gdxrename data-file map-file {options}
The .gdx file extension can be omitted. Files without a full path name are assumed to be in the current directory when using a command prompt. When using the GAMS IDE, these files are assumed to be in the current project directory.
The GDXRENAME
utility renames the unique elements in the data-file
using a two dimensional set called map in the map-file
. The renaming of the unique elements only affects the string stored for each element, and does not change the data order for the symbols in the data-file. Because no data is changing in the data-file, only the strings for the unique elements, these changes are applied to the data-file directly and no new data-file is created.
data-file = fileName (default = none)
Name of the file where the renaming is to be applied.
map-file = fileName (default = none)
Name of the file where the map set appears containing the renaming tuples.
Options
-reverse (disabled by default)
Synonym: -r
Reverse the direction of the rename operation; see below
Example
A simple example, where the labels of the parameter A
are renamed according to the map specified.
Set c / r, g, b, y /;
Parameter A(c);
A(c) = ord(c);
execute_unload 'data.gdx', A;
execute 'gdxdump data.gdx';
Set map(*,*) / r.red, g.green, b.blue, y.yellow /;
execute_unload 'map.gdx' map;
execute 'gdxrename data map';
Scalar rc;
rc = errorLevel;
abort$(rc <> 0) 'GDXRENAME execution error';
execute 'gdxdump data.gdx';
Symbol A
before the rename:
Parameter A(*) /
'r' 1,
'g' 2,
'b' 3,
'y' 4 /;
Symbol A
after the rename:
Parameter A(*) /
'red' 1,
'green' 2,
'blue' 3,
'yellow' 4 /;