GAMS [ Home | Downloads | Documentation | Solvers | APIs | Tools | Model Libraries | Resources | Sales | Support | Contact Us | Search ]


Table of Contents

The gdxrename program Rename the unique elements in a GDX file using the unique elements from second GDX file.


gdxrename data-file map-file {Options}


name of the file where the renaming is to be applied


name of the file where the map set appears containing the renaming tuples


-R or -Reverse

Reverse the direction of the rename operation; see below

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.


A simple example follows:

set c /r, g, b, y/;
parameter A(c);
A(c) = Ord(c);
execute_unload 'data.gdx', A;
execute 'gdxdump data.gdx';
set map(*,*) /,,, 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 /;