Welcome

Gams Data Exchange API Documentation
Welcome to the Gams Data Exchange API Documentation documentation. This documentation system was automatically generated using Doc-O-Matic 2. To learn more about Doc-O-Matic click here. To purchase a commercial version of Doc-O-Matic 2 click here.


GDX GAMS Data Exchange

Content | Index | Reference
GDX GAMS Data Exchange
Group Topics
This document describes the Application Programmers Interface (API) for the GDX library. The GDX library is used to read or write GDX files. A GDX file is a file that stores the values of one or more GAMS symbols such as sets, parameters variables and equations. GDX files can be used to prepare data for a GAMS model, present results of a GAMS model, store results of the same model using different parameters etc. A GDX file does not store a model formulation or executable statements.

GDX files are binary files that are portable between different platforms. They are written using the byte ordering native to the hardware platform they are created on, but can be read on a platform using a different byte ordering.

To read or write data, we need to be able to reference the set elements used to represent the index space for symbols with one or more dimensions. The API provides three interface models for this purpose:

  1. The String based interface. An n dimensional element is represented as an array of strings.

  2. The Raw integer interface. An n dimensional element is represented as an array of integers. The integer used for each index position is obtained from the API after registering the string representation with the API.

  3. The Mapped integer interface. An n dimensional element is represented as an array of integers. The integer used for each index position is defined by the user. Before such an element can be used, its value and string has to be registered.

Next: Writing Data or Reading Data
Gams Data Exchange API Documentation


Writing data to a GDX file

Writing data to a GDX file
Group Topics, GDX GAMS Data Exchange
Creating a GDX file and writing one or more symbols to the file requires a number of steps:

  1. Load the GDX library

  2. Open a file for writing

  3. Register unique elements

  4. Start writing a symbol

  5. Write the data

  6. Finish writing for the symbol

  7. Close the file

  8. Unload the GDX library
Steps 3 - 6 can be repeated to write any number of symbols to the file. Once a symbol has been written to the file, it cannot be replaced. Currently, there are no facilities to overwrite a symbol or append data to an existing file.

The following sections illustrate the basic steps for each type of interface. The method of writing (string, raw or mapped) can be selected for each symbol; it cannot be changed while writing a symbol.

Next: Write Using Strings or Write Using Integers or Write Using User Defined Integers


Writing data using strings

Writing data using strings
Writing data to a GDX file
The String based interface is suitable when we want to use a string based index and do not want to maintain a mapping from strings to integers.

Before writing data using a string based interface we can register strings for the unique elements, but this step is optional. The only reason to register the strings beforehand is to enter the strings in a given order which may have advantages later in the modelling stage.

if not GDXDataWriteStrStart(PGX,'Demand','Demand data',1,Ord(dt_par),0)
then
   ReportGDXError(PGX);

IndxS[1] := 'New-York';
Values[1] := 324.0;
GDXDataWriteStr(PGX,IndxS,Values);

IndxS[1] := 'Chicago';
Values[1] := 299.0;
GDXDataWriteStr(PGX,IndxS,Values);

if not GDXDataWriteDone(PGX)
then
    ReportGDXError(PGX);
In this example we write two records for a parameter that has a dimension of one.


Writing data using integers (Raw)

Writing data using integers (Raw)
Writing data to a GDX file
The Raw interface is suitable when we want to manage our own list of unique elements, and use an integer based index. The Raw interface assumes that the integers assigned to the strings range from one to the number of strings registered.

Before we can write data using the Raw interface, we have to register the strings for the unique elements. The GDX routines will assign an integer to the string that increases by one for every string registered.

if not GDXUELRegisterRawStart(PGX)
then
   ReportGDXError(PGX);
GDXUELRegisterRaw(PGX,'New-York');
GDXUELRegisterRaw(PGX,'Chicago');
if not GDXUelRegisterDone(PGX)
then
   ReportGDXError(PGX);

if not GDXDataWriteRawStart(PGX,'Demand','Demand data',1,Ord(dt_par),0)
then
   ReportGDXError(PGX);

IndxI[1] := 1;
Values[1] := 324.0;
GDXDataWriteRaw(PGX,IndxI,Values);

IndxI[1] := 2;
Values[1] := 299.0;
GDXDataWriteRaw(PGX,IndxS,Values);

if not GDXDataWriteDone(PGX)
then
    ReportGDXError(PGX);


Writing data using integers (Mapped)

Writing data using integers (Mapped)
Writing data to a GDX file
The Mapped interface is suitable when we want to manage our own list of unique elements, and use an integer based index. The mapped interface lets us select our own mapping between strings for the unique elements and their integer equivalent. The integers assigned to the unique elements should be greater equal one, and be unique for each element.

Before we can write data using the Mapped interface, we have to register the strings for the unique elements.

if not GDXUELRegisterMapStart(PGX)
then
   ReportGDXError(PGX);
GDXUELRegisterMap(PGX,1000,'New-York');
GDXUELRegisterMap(PGX,2000,'Chicago');
if not GDXUelRegisterDone(PGX)
then
   ReportGDXError(PGX);

if not GDXDataWriteMapStart(PGX,'Demand','Demand data',1,Ord(dt_par),0)
then
   ReportGDXError(PGX);

IndxI[1] := 1000;
Values[1] := 324.0;
GDXDataWriteRaw(PGX,IndxI,Values);

IndxI[1] := 2000;
Values[1] := 299.0;
GDXDataWriteRaw(PGX,IndxS,Values);

if not GDXDataWriteDone(PGX)
then
    ReportGDXError(PGX);
In this example we register two unique elements, and write a parameter of dimension one.


Reading data from a GDX file

Reading data from a GDX file
Group Topics, GDX GAMS Data Exchange
Opening an existing GDX file and reading one or more symbols from the file requires a number of steps:

  1. Load the GDX library

  2. Open a file for reading

  3. Register unique elements

  4. Start reading a symbol

  5. Read the data

  6. Finish reading for the symbol

  7. Close the file

  8. Unload the GDX library
Steps 3 - 6 can be repeated to read any number of symbols from the file.

The following sections illustrate the basic steps for each type of interface. The method of writing (string, raw or mapped) can be selected for each symbol; it cannot be changed while writing a symbol.

Next: Read Using Strings or Read Using Integers or Read Using User Defined Integers


Reading data using strings

Reading data using strings
Reading data from a GDX file
Reading data using strings does not require any unique element registration.

if not GDXFindSymbol(PGX,'x',SyNr)
then
   begin
   WriteLn('**** Could not find symbol X');
   halt;
   end;

GDXSymbolInfo(PGX,SyNr,SyName,SyDim,SyTyp);
if (SyDim <> 1) or (SyTyp <> Ord(dt_par))
then
   begin
   WriteLn('**** X is not a one dimensional parameter');
   halt;
   end;

if not GDXDataReadStrStart(PGX,SyNr,NrRecs)
then
   ReportGDXError(PGX);

WriteLn('Parameter X has ',NrRecs,' records');

while GDXDataReadStr(PGX,IndxS,Values,N)
do WriteLn('Record = ',IndxS[1],' ',Values[1]);

if not GDXDataReadDone(PGX)
then
   ReportGDXError(PGX);
In this example we find the symbol by its name, and before reading the data we verify that the symbol represents a one dimensional parameter.


Reading data using integers (Raw)

Reading data using integers (Raw)
Reading data from a GDX file
Reading data using integers in Raw mode does not require the registration of unique elements. The read routine returns an integer for which we can find the string representation.

if not GDXFindSymbol(PGX,'x',SyNr)
then
   begin
   WriteLn('**** Could not find symbol X');
   halt;
   end;

GDXSymbolInfo(PGX,SyNr,SyName,SyDim,SyTyp);
if (SyDim <> 1) or (SyTyp <> Ord(dt_par))
then
   begin
   WriteLn('**** X is not a one dimensional parameter');
   halt;
   end;

if not GDXDataReadRawStart(PGX,SyNr,NrRecs)
then
   ReportGDXError(PGX);

WriteLn('Parameter X has ',NrRecs,' records');

while GDXDataReadRaw(PGX,IndxI,Values,N)
do begin
   Write('Record = ',IndxI[1],' = ',Values[1]);
   GDXUMUelGet(PGX,IndxI[1],S,UsrMap);
   WriteLn(' with string = ',S);
   end;

if not GDXDataReadDone(PGX)
then
   ReportGDXError(PGX);
In this example we find the symbol by its name, and before reading the data we verify that the symbol represents a one dimensional parameter. When reading the data, we get a unique element as an integer. The integer value is used to get the corresponding string for the unique element.


Reading data using integers (Mapped)

Reading data using integers (Mapped)
Reading data from a GDX file
Reading data using integers in Mapped mode requires the registration of unique elements. The read routine returns an integer for which we can find the string representation.

When the gdx file contains data elements that we never registered, the read function will not return these elements, they will be added to an internal list of error records instead. The next topic, Reading data using a filter shows a more detailed example.

if not GDXUELRegisterMapStart(PGX)
then
   ReportGDXError(PGX);
GDXUELRegisterMap(PGX,1000,'New-York');
GDXUELRegisterMap(PGX,2000,'Chicago');
if not GDXUelRegisterDone(PGX)
then
   ReportGDXError(PGX);

if not GDXFindSymbol(PGX,'x',SyNr)
then
   begin
   WriteLn('**** Could not find symbol X');
   halt;
   end;

GDXSymbolInfo(PGX,SyNr,SyName,SyDim,SyTyp);
if (SyDim <> 1) or (SyTyp <> Ord(dt_par))
then
   begin
   WriteLn('**** X is not a one dimensional parameter');
   halt;
   end;

if not GDXDataReadMapStart(PGX,SyNr,NrRecs)
then
   ReportGDXError(PGX);

WriteLn('Parameter X has ',NrRecs,' records');

for N := 1 to NrRecs
do begin
   if GDXDataReadMap(PGX,N,IndxI,Values,N)
   then
      begin
      Write('Record = ',N,'  ',IndxI[1],' = ',Values[1]);
      GetUEL(PGX,IndxI[1],S);
      WriteLn(' with string = ',S);
      end;
   end;

if not GDXDataReadDone(PGX)
then
   ReportGDXError(PGX);

NrRecs := GDXDataErrorCount(PGX);
if NrRecs > 0
then
   WriteLn(NrRecs,' records were skipped');
In this example we register a few unique elements using our own integer values. After verifying that we can find the symbol and that the symbol represents a one dimensional parameter we can read the data. The index for the parameter is returned using the integers we used when registering our elements. When we read the records in sequence, the index returned will be sorted with the first index position the most significant.

After reading the data, we print the number of records that were skipped in the read routine.

.


Reading data using a filter

Reading data using a filter
Reading data from a GDX file
Reading data using a filter allows us to control the action for every index position. The type of action is specified using action codes and needs to be specified for every index position. The actual reading of the records is done with the GDXDataReadMap function.

Action code |
UnMapped (-2) | No mapping is performed; the value of the unique element is the value as stored in the GDX file. Use GDXUMUelGet to get the string representation.
Checked (0) | Map the unique element value to the user defined value. Use GDXGetUEL to get the string representation. If a user mapping was not defined for this element , the record is flagged as an error record and the record will be skipped.
Expand (-1) | Map the unique element value to the user defined value. Use GDXGetUEL to get the string representation. If a user mapping was not defined for this element, define a user mapping automatically using the next higher user map value.
Filter Number (>0) | Map the unique element value to the user defined value. Use GDXGetUEL to get the string representation. If the element is not enabled in the filter for this index position, the record is flagged as an error record and it will be skipped. The filter number is specified using the GDXFilterRegisterStart function.
Refering to the following GAMS fragment, we want to read the parameter A. The set I is the domain for the first index; there is no domain for the second index position:

Set I /.../;
Parameter A(I,*);
Assuming we have read set I already, the following code snapshot illustrates how to read parameter A.

// Register the filter for set I; reference this filter with integer 123
if not GDXFilterRegisterStart(PGX,123)
then
   ReportGDXError(PGX);
GDXFilterRegister(PGX,1000);
GDXFilterRegister(PGX,2000);
if not GDXFilterRegisterDone(PGX)
then
   ReportGDXError(PGX);

// set the filter
Filt[1] := 123; //filter for I
Filt[2] := -1; // expand

// Remember highest mapped value in variable LastMapped
GDXUMUelInfo(PGX,NrUnMapped,LastMapped);

// Read parameter A as a 2 dimensional parameter
if not GDXFindSymbol(PGX,'A',SyNr)
then
   begin
   WriteLn('**** Could not find symbol A');
   halt;
   end;

GDXSymbolInfo(PGX,SyNr,SyName,SyDim,SyTyp);
if (SyDim <> 2) or (SyTyp <> Ord(dt_par))
then
   begin
   WriteLn('**** A is not a two dimensional parameter');
   halt;
   end;

if not GDXReadFilteredStart(PGX,SyNr,Filt,NrRecs);
then
   ReportGDXError(PGX);

for N := 1 to NrRecs
do begin
   if GDXDataReadMap(PGX,N,IndxI,Values)
   then
      begin
      //do something with the record read
      end;
   end;
if not GDXDataReadDone(PGX)
then
   ReportGDXError(PGX);

// see if there are new unique elements
GDXUMUelInfo(PGX,NrUnMapped,NewLastMapped);
if NewLastMapped > LastMapped
then
   begin
   for N := LastMapped + 1 to NewLastMapped
   do begin
      GDXGetUel(PGX,N,S);
      WriteLn('New element ',N,' = ',S);
      end;
   end;


Functions by Category

Functions by Category
Group Topics, GDX GAMS Data Exchange
The following table organizes the functions by category:

File Open/Close | GDXOpenRead GDXOpenWrite GDXClose
System/Symbol Information | GDXSystemInfo GDXSymbolInfo GDXSymbolInfoX GDXFindSymbol GDXGetUEL
Unique elements | GDXUELRegisterRawStart GDXUELRegisterMapStart GDXUELRegisterStrStart GDXUELRegisterRaw GDXUELRegisterMap GDXUELRegisterStr GDXUELRegisterDone GDXGetUEL GDXUMUelInfo GDXUMUelGet GDXUMFindUEL
Write Data | GDXDataWriteRawStart GDXDataWriteMapStart GDXDataWriteStrStart GDXDataWriteRaw GDXDataWriteMap GDXDataWriteStr GDXDataWriteDone
Read Data | GDXDataReadRawStart GDXDataReadMapStart GDXDataReadStrStart GDXDataReadRaw GDXDataReadMap GDXDataReadStr GDXDataReadFilteredStart GDXDataReadDone GDXDataErrorCount GDXDataErrorRecord
Text for unique elements | GDXAddSetText GDXSetTextNodeNr GDXGetElemText GDXSetHasText
Filters | GDXFilterRegisterStart GDXFilterRegister GDXFilterRegisterDone GDXFilterExists
Special Values | GDXResetSpecialValues GDXSetSpecialValues GDXGetSpecialValues GDXMapValue
Errors | GDXGetLastError GDXErrorCount GDXErrorStr
Version Information | GDXSetTraceLevel GDXFileVersion GDXDLLVersion


Transition diagram

Transition diagram
Group Topics, GDX GAMS Data Exchange
The routines documented below follow certain input / output state transitions. Routines not documented below have no special state requirements.
Routine | Input State | Output State | Notes
GDXOpenRead | f_notopen | fr_init |
GDXOpenWrite | f_notopen | fw_init |
GDXClose | fr_init, fw_init | f_notopen |
GDXDataWriteRawStart | fw_init | fw_raw_data |
GDXDataWriteMapStart | fw_init | fw_map_data |
GDXDataWriteStrStart | fw_init | fw_str_data |
GDXDataWriteRaw | fw_raw_data | N/C |
GDXDataWriteMap | fw_map_data | N/C |
GDXDataWriteStr | fw_str_data | N/C |
GDXDataWriteDone | fw_raw_data, fw_map_data, fw_str_data, fw_init | fw_init |
GDXDataReadRawStart | fr_init | fr_raw_data | Note1
GDXDataReadMapStart | fr_init | fr_map_data | Note1
GDXDataReadStrStart | fr_init | fr_str_data | Note1
GDXDataReadFilteredStart | fr_init | fr_map_data | Note1
GDXDataReadRaw | fr_raw_data | N/C, fr_init | Note2
GDXDataReadMap | fr_map_data | N/C, fr_init | Note2
GDXDataReadStr | fr_str_data | N/C, fr_init | Note2
GDXDataReadDone | fr_raw_data, fr_map_data, fr_str_data, fr_init |  |
GDXDataErrorRecord | fr_init, fr_map_data, fw_raw_data, fw_map_data, fw_str_data |  |
GDXFilterRegisterStart | fr_init | fr_filter |
GDXFilterRegister | fr_filter | N/C |
GDXFilterRegisterDone | fr_filter | fr_init |
GDXFilterExists | fr_init | N/C |
GDXUELRegisterRawStart | fr_init | f_raw_elem |
GDXUELRegisterRaw | f_raw_elem | N/C |
GDXUELRegisterMapStart | fr_init | f_map_elem |
GDXUELRegisterMap | f_map_elem | N/C |
GDXUELRegisterStrStart | fr_init | f_str_elem |
GDXUELRegisterStr | f_str_elem | N/C |
GDXUELRegisterDone | f_raw_elem, f_map_elem, f_str_elem | fr_init |

Note1: New state assumes there is data; when the symbol is empty, the state will be fr_init.

Note2: No change in state when there is still data; when we reach the end of the data the new state will be fr_init.


Example programs

Example programs
Group Topics, GDX GAMS Data Exchange
Some complete example programs are illustrated in the following topics. Currently the examples are written in Delphi and C; other language examples will be provided as they become available.


Example 1

Example 1
Group Topics, Example programs
In this modified version of the trnsport.gms model, we use an external program to generate data for the demand parameter. After we solve the model, we write the solution to a GDX file, and call the external program again to read the variable from the GDX file.

The modified trnsport.gms model:

$Title trnsport model using gdx files
$EOLCOM //
  Sets
       i   canning plants   / seattle, san-diego /
       j   markets          / new-york, chicago, topeka / ;

  Parameters

       a(i)  capacity of plant i in cases
         /    seattle     350
              san-diego   600  /

       b(j)  demand at market j in cases ;

  Table d(i,j)  distance in thousands of miles
                    new-york       chicago      topeka
      seattle          2.5           1.7          1.8
      san-diego        2.5           1.8          1.4  ;

  Scalar f  freight in dollars per case per thousand miles  /90/ ;

  Parameter c(i,j)  transport cost in thousands of dollars per case ;

            c(i,j) = f * d(i,j) / 1000 ;

  Variables
       x(i,j)  shipment quantities in cases
       z       total transportation costs in thousands of dollars ;

  Positive Variable x ;

  Equations
       cost        define objective function
       supply(i)   observe supply limit at plant i
       demand(j)   satisfy demand at market j ;

// These lines execute during the compilation phase
// The GAMS system directory is passed the the program so it knows where
// to look for the gdxio.dll
// Note that we pass the GAMS system directory in double-quotes to
// avoid problems with blanks in file names.

$call 'example1.exe "%gams.sysdir%"'   // create demand data
$GDXIN demanddata.gdx                  // open data file
$LOAD  b=demand                        // load parameter b (named 'demand' in file)
$GDXIN                                 // close data file

  cost ..        z  =e=  sum((i,j), c(i,j)*x(i,j)) ;

  supply(i) ..   sum(j, x(i,j))  =l=  a(i) ;

  demand(j) ..   sum(i, x(i,j))  =g=  b(j) ;

  Model transport /all/ ;

  Solve transport using lp minimizing z ;

  Display b,x.l, x.m ;

// These lines execute during the execution phase
execute_unload 'results.gdx',x;                     // write variable x to the gdx file
execute 'example1.exe "%gams.sysdir%" results.gdx'; // do something with the solution

The external program is illustrated in Delphi and C


Example 1 in Delphi

Example 1 in Delphi
Example 1
program example1;
///////////////////////////////////////////////////////////////
// This program generates demand data for a modified version //
// of the trnsport model or reads the solution back from a   //
// gdx file.                                                 //
//                                                           //
// Calling convention:                                       //
// Case 1:                                                   //
//    Parameter 1: GAMS system directory                     //
// The program creates a GDX file with demand data           //
// Case 2:                                                   //
//    Parameter 1: GAMS system directory                     //
//    Parameter 2: gdxfile                                   //
// The program reads the solution from the GDX file          //
// Paul van der Eijk Jun-12, 2002                            //
///////////////////////////////////////////////////////////////

{$APPTYPE CONSOLE}
{$H- short strings}

uses
  sysutils,
  gxdefs,
  gxpas_d;

{$R *.RES}

procedure ReportGDXError(PGX: PGXFile);
var
   S: ShortString;
begin
WriteLn('**** Fatal GDX Error');
GetErrorStr(GDXGetLastError(PGX),S);
WriteLn('**** ',S);
Halt(1);
end;

procedure ReportIOError(N: integer);
begin
WriteLn('**** Fatal I/O Error = ',N);
Halt(1);
end;

var
   PGX  : PGXFile;

procedure WriteData(const s: string; V: double);
var
   Indx  : TgdxStrIndex;
   Values: TgdxValues;
begin
Indx[1] := s;
Values[1] := V;
GDXDataWriteStr(PGX,Indx,Values);
end;

var
   Msg     : string;
   Sysdir  : string;
   Producer: string;
   ErrNr   : integer;
   Indx    : TgdxStrIndex;
   Values  : TgdxValues;
   VarNr   : integer;
   NrRecs  : integer;
   N       : integer;
   Dim     : integer;
   VarName : TgdxNameStr;
   VarTyp  : integer;
   D       : integer;

begin
if not(ParamCount in [1,2])
then
   begin
   WriteLn('**** Example1: incorrect number of parameters');
   Halt(1);
   end;

sysdir := ParamStr(1);
WriteLn('Example1 using GAMS system directory: ',sysdir);

if not LoadGDXLibrary(sysdir + 'gdxio',Msg)
then
   begin
   WriteLn('**** Could not load GDX library');
   WriteLn('**** ',Msg);
   exit;
   end;

GDXDLLVersion(Msg);
WriteLn('Using GDX DLL version: ',Msg);

if ParamCount = 1
then
   begin
   //write demand data
   ErrNr := GDXOpenWrite(PGX,'demanddata.gdx','example1');
   if ErrNr <> 0
   then
      ReportIOError(ErrNr);

   if not GDXDataWriteStrStart(PGX,'Demand','Demand data',1,Ord(dt_par),0)
   then
      ReportGDXError(PGX);
   WriteData('New-York',324.0);
   WriteData('Chicago' ,299.0);
   WriteData('Topeka'  ,274.0);
   if not GDXDataWriteDone(PGX)
   then
      ReportGDXError(PGX);

   WriteLn('Demand data written by example1');
   end
else
   begin
   //read x variable back (non-default level values only)
   ErrNr := GDXOpenRead(PGX,ParamStr(2));
   if ErrNr <> 0
   then
      ReportIOError(ErrNr);

   GDXFileVersion(PGX,Msg,Producer);
   WriteLn('GDX file written using version: ',Msg);
   WriteLn('GDX file written by: ',Producer);

   if not GDXFindSymbol(PGX,'x',VarNr)
   then
      begin
      WriteLn('**** Could not find variable X');
      Halt(1);
      end;

   GDXSymbolInfo(PGX,VarNr,VarName,Dim,VarTyp);
   if (Dim <> 2) or (VarTyp <> Ord(dt_var))
   then
      begin
      WriteLn('**** X is not a two dimensional variable');
      Halt(1);
      end;

   if not GDXDataReadStrStart(PGX,VarNr,NrRecs)
   then
      ReportGDXError(PGX);

   WriteLn('Variable X has ',NrRecs,' records');
   while GDXDataReadStr(PGX,Indx,Values,N)
   do begin
      if Values[1] = 0.0       //skip level = 0.0 is default
      then
         continue;
      for D := 1 to Dim
      do begin
         Write(Indx[D]);
         if D < Dim
         then
            Write('.');
         end;
      WriteLn(' = ',Values[1]:7:2);
      end;
   WriteLn('All solution values shown');
   end;

ErrNr := GDXClose(PGX);
if ErrNr <> 0
then
   ReportIOError(ErrNr);
end.


Example 1 in C

Example 1 in C
Example 1
To be provided:


Symbol Reference

Symbol Reference
These are all symbols available in this documentation.
Classes | Records, Enums | Functions | Types | Constants | Units
Classes
TGXFile
Records, Enums
TgdxDataType
TgdxSpecialValue
Functions
GDXAddSetText
GDXClose
GDXDataErrorCount
GDXDataErrorRecord
GDXDataReadDone
GDXDataReadFilteredStart
GDXDataReadMap
GDXDataReadMapStart
GDXDataReadRaw
GDXDataReadRawStart
GDXDataReadStr
GDXDataReadStrStart
GDXDataWriteDone
GDXDataWriteMap
GDXDataWriteMapStart
GDXDataWriteRaw
GDXDataWriteRawStart
GDXDataWriteStr
GDXDataWriteStrStart
GDXDLLVersion
GDXErrorCount
GDXErrorStr
GDXFileVersion
GDXFilterExists
GDXFilterRegister
GDXFilterRegisterDone
GDXFilterRegisterStart
GDXFindSymbol
GDXGetElemText
GDXGetLastError
GDXGetSpecialValues
GDXGetUEL
GDXMapValue
GDXOpenRead
GDXOpenWrite
GDXResetSpecialValues
GDXSetHasText
GDXSetSpecialValues
GDXSetTextNodeNr
GDXSetTraceLevel
GDXSymbolInfo
GDXSymbolInfoX
GDXSystemInfo
GDXUELRegisterAll
GDXUELRegisterDone
GDXUELRegisterMap
GDXUELRegisterMapStart
GDXUELRegisterNone
GDXUELRegisterRaw
GDXUELRegisterRawStart
GDXUELRegisterStr
GDXUELRegisterStrStart
GDXUMFindUEL
GDXUMUelGet
GDXUMUelInfo
GetDLLVersion
Types
PGXFile
TgdxDataSize
TgdxDimension
TgdxNameStr
TgdxStrIndex
TgdxSVals
TgdxUELIndex
TgdxValues
Constants
DataTypSize
DOMC_EXPAND
DOMC_STRICT
DOMC_UNMAPPED
fmode_str
GDXHeaderNr
gdxMAXDATASIZE
gdxMAXDIM
gdxMaxNameLen
SYSVER
VERSION
Units
gdxio.dpr
gxdefs.pas
gxfile.pas


Classes

Classes
These are all classes that are contained in this documentation.


TGXFile

TGXFile
Hierarchy, Members, Methods, Unit: gxfile
TGXFile = class(TMiBufferedStream)
Unit
gxfile
Description
The text for this class has been generated automatically. This means that it is not documented.


TGXFile.AddSetText

TGXFile.AddSetText
TGXFile
Register a string to be used as text associated with a unique element
function AddSetText(const s: ShortString; var N: integer): boolean;
function GDXAddSetText(Ap: PGxFile; const s: ShortString; var N: integer): boolean; stdcall;
Parameters
const s: ShortString
The string to be registered
var N: integer
The index number assigned to this string
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
Register a string and return the index assigned to this string. The string must follow the GAMS syntax rules for explanatory text
See Also
TGXFile.GetElemText, TGXFile.SetTextNodeNr


TGXFile.DataErrorCount

TGXFile.DataErrorCount
TGXFile
The number of error records
function DataErrorCount: integer;
function GDXDataErrorCount(Ap: PGxFile): integer; stdcall;
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
The number of error records available.
Description
After a write operation is finished (DataWriteDone), the data is sorted and written to the GDX file. If there are duplicate records, the first record is written to the file and the duplicates are added to the error list.

When reading data using a filtered read operation, data records that were filtered out because an index is not in the user index space or not in a filter are added the error list.

See Also
TGXFile.DataErrorRecord


TGXFile.DataErrorRecord

TGXFile.DataErrorRecord
TGXFile
Retrieve an error record
function DataErrorRecord(Rn: integer; var AElements: TgdxUELIndex; var AVals: TgdxValues): boolean;
function GDXDataErrorRecord(Ap: PGxFile; Rn: integer; var AElements: TgdxUELIndex; var AVals: TgdxValues): boolean; stdcall;
Parameters
Rn: integer
The number of the record to be retrieved, range = 1..NrErrorRecords
var AElements: TgdxUELIndex
Index for the record
var AVals: TgdxValues
Values for the record
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the record number is valid, False otherwise
See Also
TGXFile.DataErrorCount


TGXFile.DataReadDone

TGXFile.DataReadDone
TGXFile
Finish reading of a symbol in any mode(raw, mapped, string)
function DataReadDone: boolean;
function GDXDataReadDone(Ap: PGxFile): boolean; stdcall;
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataReadRawStart, TGXFile.DataReadMapStart, TGXFile.DataReadStrStart


TGXFile.DataReadFilteredStart

TGXFile.DataReadFilteredStart
TGXFile
Initialize the reading of a symbol in filtered mode
function DataReadFilteredStart(SyNr: integer; const ADomainNrs: TgdxUELIndex; var NrRecs: integer): boolean;
function GDXDataReadFilteredStart(Ap: PGxFile; SyNr: integer; const AFilters: TgdxUELIndex; var NrRecs: integer): boolean; stdcall;
Parameters
SyNr: integer
The index number of the symbol, range 1..NrSymbols
var NrRecs: integer
The number of records available for reading
Ap: PGxFile
Pointer to GDX structure
const AFilters: TgdxUELIndex
Array of filter actions for each index position
Return Value
True if the operation is possible, false otherwise
Description
Start reading data for a symbol in filtered mode. Each filter action (1..Dimension) describes how each index should be treated when reading a data record. When new unique elements are returned, they are added to the user index space automatically. The actual reading of records is done with DataReadMap.

The action codes are as follows:

Action code | Result
DOMC_UNMAPPED | The index is not mapped into user space
DOMC_EXPAND | New unique elements encountered will be be mapped into the user space
DOMC_STRICT | If the unique element in this position does not map into user space, the record will not be available and is added to the error list instead
FilterNumber | If the unique element in this position does not map into user space or is not enabled in this filter, the record will not be available and is added to the error list instead
See Also
TGXFile.FilterRegisterStart, TGXFile.DataReadMap, TGXFile.DataReadRawStart, TGXFile.DataReadStrStart, TGXFile.DataReadDone


TGXFile.DataReadMap

TGXFile.DataReadMap
TGXFile
Read the next record in mapped mode
function DataReadMap(Rn: integer; var AElements: TgdxUELIndex; var AVals: TgdxValues; var AFDim: integer): boolean;
function GDXDataReadMap(Ap: PGxFile; Rn: integer; var AElements: TgdxUELIndex; var AVals: TgdxValues; var AFDim: integer): boolean; stdcall;
Parameters
var AElements: TgdxUELIndex
The index of the record
var AVals: TgdxValues
The data of the record
var AFDim: integer
The first index position in AElements that changed
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataReadMapStart, TGXFile.DataReadFilteredStart, TGXFile.DataReadDone


TGXFile.DataReadMapStart

TGXFile.DataReadMapStart
TGXFile
Initialize the reading of a symbol in mapped mode
function DataReadMapStart(SyNr: integer; var NrRecs: integer): boolean;
function GDXDataReadMapStart(Ap: PGxFile; SyNr: integer; var NrRecs: integer): boolean; stdcall;
Parameters
SyNr: integer
The index number of the symbol, range 1..NrSymbols
var NrRecs: integer
The number of records available for reading
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataReadMap, TGXFile.DataReadRawStart, TGXFile.DataReadStrStart, TGXFile.DataReadDone


TGXFile.DataReadRaw

TGXFile.DataReadRaw
TGXFile
Read the next record in raw mode
function DataReadRaw(var AElements: TgdxUELIndex; var AVals: TgdxValues; var AFDim: integer): boolean;
function GDXDataReadRaw(Ap: PGxFile; var AElements: TgdxUELIndex; var AVals: TgdxValues; var AFDim: integer): boolean; stdcall;
Parameters
var AElements: TgdxUELIndex
The index of the record
var AVals: TgdxValues
The data of the record
var AFDim: integer
The first index position in AElements that changed
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataReadRawStart, TGXFile.DataReadDone


TGXFile.DataReadRawStart

TGXFile.DataReadRawStart
TGXFile
Initialize the reading of a symbol in raw mode
function DataReadRawStart(SyNr: integer; var NrRecs: integer): boolean;
function GDXDataReadRawStart(Ap: PGxFile; SyNr: integer; var NrRecs: integer): boolean; stdcall;
Parameters
SyNr: integer
The index number of the symbol, range 1..NrSymbols
var NrRecs: integer
The number of records available for reading
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataReadRaw, TGXFile.DataReadMapStart, TGXFile.DataReadStrStart, TGXFile.DataReadDone


TGXFile.DataReadStr

TGXFile.DataReadStr
TGXFile
Read the next record in string mode
function DataReadStr(var AStrElements: TgdxStrIndex; var AVals: TgdxValues; var AFDim: integer): boolean;
function GDXDataReadStr(Ap: PGxFile; var AStrElements: TgdxStrIndex; var AVals: TgdxValues; var AFDim: integer): boolean; stdcall;
Parameters
var AStrElements: TgdxStrIndex
The index of the record as strings for the unique elements
var AVals: TgdxValues
The data of the record
var AFDim: integer
The first index position in AElements that changed
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible; return False if there is no more data or the operation is not possible
Description
not for the time being function DataReadScalar(SyNr: integer): boolean; function DataReadSet1Start(SyNr: integer; var NrRecs: integer): boolean; function DataReadSet2Start(SyNr: integer; var NrRecs: integer): boolean; function DataReadPar1Start(SyNr: integer; var NrRecs: integer): boolean; function DataReadPar2Start(SyNr: integer; var NrRecs: integer): boolean; function DataReadSet1(var indx: TgdxNameStr; var ElemText: ShortString): boolean; function DataReadSet2(var indx1,indx2: TgdxNameStr; var ElemText: ShortString): boolean; function DataReadPar1(var indx: TgdxNameStr; var Value: double): boolean; function DataReadPar2(var indx1,indx2: TgdxNameStr; var Value: double): boolean; Read the next record using strings for the unique elements. The reading should be initialized by calling DataReadStrStart
See Also
TGXFile.DataReadStrStart, TGXFile.DataReadDone


TGXFile.DataReadStrStart

TGXFile.DataReadStrStart
TGXFile, Example
Initialize the reading of a symbol in string mode
function DataReadStrStart(SyNr: integer; var NrRecs: integer): boolean;
function GDXDataReadStrStart(Ap: PGxFile; SyNr: integer; var NrRecs: integer): boolean; stdcall;
Parameters
SyNr: integer
The index number of the symbol, range 1..NrSymbols
var NrRecs: integer
The number of records available for reading
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
Reading data using strings is the simplest way to read data. Every record read using DataReadStr will return the strings for the unique elements. Internal mapping is not affected by this function.
See Also
TGXFile.DataReadStr, TGXFile.DataReadRawStart, TGXFile.DataReadMapStart, TGXFile.DataReadDone


TGXFile.DataWriteDone

TGXFile.DataWriteDone
TGXFile
Finish a write operation
function DataWriteDone: boolean;
function GDXDataWriteDone(Ap: PGxFile): boolean; stdcall;
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataErrorCount, TGXFile.DataWriteRawStart, TGXFile.DataWriteMapStart, TGXFile.DataWriteStrStart


TGXFile.DataWriteMap

TGXFile.DataWriteMap
TGXFile
Write a data element in mapped mode
function DataWriteMap(const AElements: TgdxUELIndex; const AVals: TgdxValues): boolean;
function GDXDataWriteMap(Ap: PGxFile; const AElements: TgdxUELIndex; const AVals: TgdxValues): boolean; stdcall;
Parameters
const AElements: TgdxUELIndex
The index for this element using mapped values
const AVals: TgdxValues
The values for this element
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataWriteMapStart, TGXFile.DataWriteDone


TGXFile.DataWriteMapStart

TGXFile.DataWriteMapStart
TGXFile
Start writing a new symbol in mapped mode
function DataWriteMapStart(const AName: TgdxNameStr; const AText: ShortString; ADim: integer; AType: TgdxDataType; AUserInfo: integer): boolean;
function GDXDataWriteMapStart(Ap: PGxFile; const AName: TgdxNameStr; const AText: ShortString; ADim: integer; IAType: integer; AUserInfo: integer): boolean; stdcall;
Parameters
const AName: TgdxNameStr
Name of the symbol
const AText: ShortString
Explanatory text for the symbol
ADim: integer
Dimension of the symbol
AType: TgdxDataType
Type of the symbol
AUserInfo: integer
Any integer value
Ap: PGxFile
Pointer to GDX structure
IAType: integer
Type (as integer) of the symbol
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataWriteMap, TGXFile.DataWriteDone


TGXFile.DataWriteRaw

TGXFile.DataWriteRaw
TGXFile
Write a data element in raw mode
function DataWriteRaw(const AElements: TgdxUELIndex; const AVals: TgdxValues): boolean;
function GDXDataWriteRaw(Ap: PGxFile; const AElements: TgdxUELIndex; const AVals: TgdxValues): boolean; stdcall;
Parameters
const AElements: TgdxUELIndex
The index for this element
const AVals: TgdxValues
The values for this element
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
When writing data in raw mode, the index space used is based on the internal index space. The indices used are in the range 1..NrUels. Before we can write in raw mode, the unique elements (strings) should be registered first.

For performance reasons, the index is not checked for valid values, and it is assumed that the records are written in increasing order without any duplicates.

See Also
TGXFile.DataWriteRawStart, TGXFile.DataWriteDone


TGXFile.DataWriteRawStart

TGXFile.DataWriteRawStart
TGXFile
Start writing a new symbol in raw mode
function DataWriteRawStart(const AName: TgdxNameStr; const AText: ShortString; ADim: integer; AType: TgdxDataType; AUserInfo: integer): boolean;
function GDXDataWriteRawStart(Ap: PGxFile; const AName: TgdxNameStr; const AText: ShortString; ADim: integer; IAType: integer; AUserInfo: integer): boolean; stdcall;
Parameters
const AName: TgdxNameStr
Name of the symbol
const AText: ShortString
Explanatory text for the symbol
ADim: integer
Dimension of the symbol
AType: TgdxDataType
Type of the symbol
AUserInfo: integer
Any integer value
Ap: PGxFile
Pointer to GDX structure
IAType: integer
Type (as integer) of the symbol
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataWriteRaw, TGXFile.DataWriteDone


TGXFile.DataWriteStr

TGXFile.DataWriteStr
TGXFile
Write a data element in string mode
function DataWriteStr(const AStrElements: TgdxStrIndex; const AVals: TgdxValues): boolean;
function GDXDataWriteStr(Ap: PGxFile; const AStrElements: TgdxStrIndex; const AVals: TgdxValues): boolean; stdcall;
Parameters
const AStrElements: TgdxStrIndex
The index for this element using strings for the unique elements
const AVals: TgdxValues
The values for this element
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
When writing data using string elements, each string element is added to the internal unique element table and assigned an index. Writing using strings does not add the unique elements to the user mapped space. Each element string must follow the GAMS rules for unique elements.
See Also
TGXFile.DataWriteMapStart, TGXFile.DataWriteDone


TGXFile.DataWriteStrStart

TGXFile.DataWriteStrStart
TGXFile
Start writing a new symbol in string mode
function DataWriteStrStart(const AName: TgdxNameStr; const AText: ShortString; ADim: integer; AType: TgdxDataType; AUserInfo: integer): boolean;
function GDXDataWriteStrStart(Ap: PGxFile; const AName: TgdxNameStr; const AText: ShortString; ADim: integer; IAType: integer; AUserInfo: integer): boolean; stdcall;
Parameters
const AName: TgdxNameStr
Name of the symbol
const AText: ShortString
Explanatory text for the symbol
ADim: integer
Dimension of the symbol
AType: TgdxDataType
Type of the symbol
AUserInfo: integer
Any integer value
Ap: PGxFile
Pointer to GDX structure
IAType: integer
Type (as integer) of the symbol
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataWriteStr, TGXFile.DataWriteDone


TGXFile.Destroy

TGXFile.Destroy
TGXFile
Close a GDX file
function GDXClose(var Ap: PGXFile): integer; stdcall;
destructor Destroy; override;
Parameters
var Ap: PGXFile
Pointer to GDX structure
Return Value
Zero if GDX file was closed successfully, an error code otherwise.
Description
Close a GDX file that was previously opened for reading or writing. Before the file is closed, any pending write operations will be finished. The pointer to the GDX structure will be set to nil.
See Also
TGXFile.OpenRead, TGXFile.OpenWrite


TGXFile.ErrorCount

TGXFile.ErrorCount
TGXFile
Returns the number of errors
function GDXErrorCount(Ap: PGxFile): integer; stdcall;
function ErrorCount: integer;
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
Total number of errors encountered
See Also
TGXFile.GetLastError


TGXFile.FileVersion

TGXFile.FileVersion
TGXFile
Return strings for file version and file producer
function FileVersion(var FileStr: ShortString; var ProduceStr: ShortString): boolean;
function GDXFileVersion(Ap: PGxFile; var FileStr: ShortString; var ProduceStr: ShortString): boolean; stdcall;
Parameters
var FileStr: ShortString
Version string
var ProduceStr: ShortString
Producer string
Ap: PGxFile
Pointer to GDX structure
Return Value
Always True
See Also
TGXFile.OpenWrite


TGXFile.FilterExists

TGXFile.FilterExists
TGXFile
Check if there is a filter defined based on its number
function FilterExists(N: integer): boolean;
function GDXFilterExists(Ap: PGxFile; N: integer): boolean; stdcall;
Parameters
N: integer
Filter number as used in FilterRegisterStart
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the filter exists; False otherwise
See Also
TGXFile.FilterRegisterStart


TGXFile.FilterRegister

TGXFile.FilterRegister
TGXFile
Add a unique element to the current filter definition
function FilterRegister(V: integer): boolean;
function GDXFilterRegister(Ap: PGxFile; V: integer): boolean; stdcall;
Parameters
V: integer
Unique element number in the user index space
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
Register a unique element as part of the current filter. The function returns false if the index number is out of range of valid user indices or the index was never mapped into the user index space.
See Also
TGXFile.FilterRegisterStart, TGXFile.FilterRegisterDone


TGXFile.FilterRegisterDone

TGXFile.FilterRegisterDone
TGXFile
Finish registration of unique elements for a filter
function FilterRegisterDone: boolean;
function GDXFilterRegisterDone(Ap: PGxFile): boolean; stdcall;
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.FilterRegisterStart, TGXFile.FilterRegister


TGXFile.FilterRegisterStart

TGXFile.FilterRegisterStart
TGXFile
Define a unique element filter
function FilterRegisterStart(Nr: integer): boolean;
function GDXFilterRegisterStart(Ap: PGxFile; Nr: integer): boolean; stdcall;
Parameters
Nr: integer
Filter number to be assigned
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.FilterRegister, TGXFile.FilterRegisterDone, TGXFile.DataReadFilteredStart


TGXFile.FindSymbol

TGXFile.FindSymbol
TGXFile
Find symbol by name
function GDXFindSymbol(Ap: PGxFile; const AName: TgdxNameStr; var AIx: integer): boolean; stdcall;
function FindSymbol(const AName: TgdxNameStr; var AIx: integer): boolean;
Parameters
Ap: PGxFile
Pointer to GDX structure
const AName: TgdxNameStr
Name of the symbol
var AIx: integer
Symbol number
Return Value
True if symbol found, False otherwise.
Description
Search for a symbol by name; the search is not case sensitive. When the symbol is found, Aix contains the symbol number and the function returns true. When the symbol is not found, the function returns false.
See Also
TGXFile.SymbolInfo, TGXFile.SymbolInfoX


TGXFile.GetElemText

TGXFile.GetElemText
TGXFile
Retrieve the string and node number for an entry in the string table
function GetElemText(N: integer; var s: ShortString; var Node: integer): boolean;
function GDXGetElemText(Ap: PGxFile; N: integer; var S: ShortString; var Node: integer): boolean; stdcall;
Parameters
N: integer
String table index
var s: ShortString
Text found for the entry
var Node: integer
Node number found for the entry
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
Retrieve a string based on the string table index previously obtained by calling AddSetText. If a node number was never specified for this index using SetTextNodeNr, the node number returned will be zero
See Also
TGXFile.AddSetText, TGXFile.SetTextNodeNr


TGXFile.GetLastError

TGXFile.GetLastError
TGXFile
Return the last error
function GDXGetLastError(Ap: PGxFile): integer; stdcall;
function GetLastError: integer;
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
The error number, or zero if there was no error
Description
When an error is encountered, an error code is stored which can be retrieved with this function. If subsequent errors occur before this function is called, the first error code will be maintained
See Also
TGXFile.ErrorCount


TGXFile.GetSpecialValues

TGXFile.GetSpecialValues
TGXFile
Retrieve the internal values for special values
function GetSpecialValues(var Avals: TgdxSVals): boolean;
function GDXGetSpecialValues(Ap: PGxFile; var AVals: TgdxSVals): boolean; stdcall;
Parameters
var Avals: TgdxSVals
array of special values used for Eps, +Inf, -Inf, NA and Undef
Ap: PGxFile
Pointer to GDX structure
Return Value
Always True
See Also
TGXFile.ResetSpecialValues, TGXFile.SetSpecialValues


TGXFile.GetUEL

TGXFile.GetUEL
TGXFile
Get the string for a unique element using a mapped index
function GDXGetUEL(Ap: PGxFile; UelNr: integer; var S: TgdxNameStr): boolean; stdcall;
function GetUEL(UelNr: integer; var S: TgdxNameStr): boolean;
Parameters
Ap: PGxFile
Pointer to GDX structure
UelNr: integer
Index number in user space (1..NrUserElem)
var S: TgdxNameStr
String for the unique element
Return Value
Return true if the index is in a valid range, false otherwise
Description
Retrieve the string for an unique element based on a mapped index number.
See Also
TGXFile.UMUelGet


TGXFile.MapValue

TGXFile.MapValue
TGXFile
Classify a value as a potential special value
function MapValue(const D: double; var sv: TgdxSpecialValue): boolean;
function GDXMapValue(Ap: PGxFile; const D: double; var isv: integer): boolean; stdcall;
Parameters
const D: double
Value to classify
var sv: TgdxSpecialValue
Classification
Ap: PGxFile
Pointer to GDX structure
Return Value
Returns True if D is a special value, False otherwise
See Also
TGXFile.GetSpecialValues, TGXFile.SetSpecialValues


TGXFile.OpenRead

TGXFile.OpenRead
TGXFile, Example
Open a GDX file for reading
function GDXOpenRead(var Ap: PGXFile; const Afn: ShortString): integer; stdcall;
constructor OpenRead(const fn: ShortString);
Parameters
var Ap: PGXFile
Contains pointer to the new GDX structure, or is set to nil when the open failed
const Afn: ShortString
file name of the gdx file to be opened
Return Value
Zero if GDX file was opened successfully, an error code otherwise
Description
Open an existing GDX file for input. If a file extension is not supplied, the extension '.gdx' will be used. The return code is a system dependent I/O error. If the file was found, but is not a valid GDX file, the function GetLastError can be used to handle these type of errors.
See Also
TGXFile.OpenWrite, TGXFile.Destroy, TGXFile.GetLastError


TGXFile.OpenWrite

TGXFile.OpenWrite
TGXFile, Example
Create a GDX file for writing
function GDXOpenWrite(var Ap: PGXFile; const Afn: ShortString; const AProducer: ShortString): integer; stdcall;
constructor OpenWrite(const Afn: ShortString; const AProducer: ShortString);
Parameters
var Ap: PGXFile
Contains pointer to the new GDX structure, or is set to nil when the open failed
const Afn: ShortString
File name of the gdx file to be created
const AProducer: ShortString
Name of program that creates the GDX file
Return Value
Zero if GDX file was opened successfully, an error code otherwise;
Description
Open a new GDX file for output. If a file extension is not supplied, the extension '.gdx' will be used. The return code is a system dependent I/O error.
See Also
TGXFile.OpenRead, TGXFile.Destroy


TGXFile.ResetSpecialValues

TGXFile.ResetSpecialValues
TGXFile
Reset the internal values for special values
function ResetSpecialValues: boolean;
function GDXResetSpecialValues(Ap: PGxFile): boolean; stdcall;
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
Always True
See Also
TGXFile.SetSpecialValues, TGXFile.GetSpecialValues


TGXFile.SetHasText

TGXFile.SetHasText
TGXFile
Test if any of the unique elements in a set has associated text
function SetHasText(N: integer): boolean;
function GDXSetHasText(Ap: PGxFile; N: integer): boolean; stdcall;
Parameters
N: integer
Symbol number (1..NrSymbols)
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the Set contains at least one unique element that has associated text, false otherwise
See Also
TGXFile.SystemInfo, TGXFile.SymbolInfo


TGXFile.SetSpecialValues

TGXFile.SetSpecialValues
TGXFile
Set the internal values for special values
function SetSpecialValues(const AVals: TgdxSVals): boolean;
function GDXSetSpecialValues(Ap: PGxFile; const AVals: TgdxSVals): boolean; stdcall;
Parameters
const AVals: TgdxSVals
array of special values to be used for Eps, +Inf, -Inf, NA and Undef
Ap: PGxFile
Pointer to GDX structure
Return Value
Always True
See Also
TGXFile.ResetSpecialValues, TGXFile.GetSpecialValues


TGXFile.SetTextNodeNr

TGXFile.SetTextNodeNr
TGXFile
Set the Node number for an entry in the string table
function SetTextNodeNr(N: integer; Node: integer): boolean;
function GDXSetTextNodeNr(Ap: PGxFile; N: integer; Node: integer): boolean; stdcall;
Parameters
N: integer
Index number of the entry to be modified
Node: integer
The new Node value for the entry
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
After registering a string with AddSetText, we can assign a node number for later retrieval. The node number is any integer which is stored without further restrictions.
See Also
TGXFile.AddSetText, TGXFile.GetElemText


TGXFile.SetTraceLevel

TGXFile.SetTraceLevel
TGXFile
Set the amount of trace (debug) information generated
function SetTraceLevel(N: integer; const s: ShortString): boolean;
function GDXSetTraceLevel(Ap: PGxFile; N: integer; const S: ShortString): boolean; stdcall;
Parameters
N: integer
Tracing level N <= 0 no tracing N >= 3 maximum tracing
const s: ShortString
A string to be included in the trace output
Ap: PGxFile
Pointer to GDX structure
Return Value
Always True


TGXFile.SymbolInfo

TGXFile.SymbolInfo
TGXFile
Returns information about a symbol
function GDXSymbolInfo(Ap: PGxFile; SyNr: integer; var AName: TgdxNameStr; var ADim: integer; var IATyp: integer): boolean; stdcall;
function SymbolInfo(SyNr: integer; var AName: TgdxNameStr; var ADim: integer; var ATyp: TgdxDataType): boolean;
Parameters
Ap: PGxFile
Pointer to GDX structure
SyNr: integer
The symbol number (range 1..NrSymbols)
var AName: TgdxNameStr
Name of the symbol
var ADim: integer
Dimension of the symbol
var IATyp: integer
Symbol type
Return Value
False if the symbol number is not in the correct range, True otherwise
See Also
TGXFile.SystemInfo, TGXFile.SymbolInfoX, TGXFile.FindSymbol


TGXFile.SymbolInfoX

TGXFile.SymbolInfoX
TGXFile
Returns additional information about a symbol
function GDXSymbolInfoX(Ap: PGxFile; SyNr: integer; var ACount: integer; var AUserInfo: integer; var AExplTxt: ShortString): boolean; stdcall;
function SymbolInfoX(SyNr: integer; var ACount: integer; var AUserInfo: integer; var AExplTxt: ShortString): boolean;
Parameters
Ap: PGxFile
Pointer to GDX structure
SyNr: integer
The symbol number (range 1..NrSymbols)
var ACount: integer
Total number of records stored (unmapped)
var AUserInfo: integer
User field value
var AExplTxt: ShortString
Expanatory text for the symbol
Return Value
False if the symbol number is not in the correct range, True otherwise
See Also
TGXFile.SystemInfo, TGXFile.SymbolInfo, TGXFile.FindSymbol


TGXFile.SystemInfo

TGXFile.SystemInfo
TGXFile
Returns the number of symbols and unique elements
function GDXSystemInfo(Ap: PGxFile; var NrSy: integer; var NrUel: integer): boolean; stdcall;
function SystemInfo(var NrSy: integer; var NrUel: integer): boolean;
Parameters
Ap: PGxFile
Pointer to GDX structure
var NrSy: integer
Number of symbols available in the GDX file
var NrUel: integer
Number of unique elements stored in the GDX file
Return Value
Always true


TGXFile.UELRegisterDone

TGXFile.UELRegisterDone
TGXFile
Finish registration of unique elements
function UELRegisterDone: boolean;
function GDXUELRegisterDone(Ap: PGxFile): boolean; stdcall;
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.UELRegisterRawStart, TGXFile.UELRegisterMapStart, TGXFile.UELRegisterStrStart


TGXFile.UELRegisterMap

TGXFile.UELRegisterMap
TGXFile
Register an unique elements in mapped mode
function UELRegisterMap(UelNr: integer; const elem: TgdxNameStr): boolean;
function GDXUELRegisterMap(Ap: PGxFile; UelNr: integer; const Elem: TgdxNameStr): boolean; stdcall;
Parameters
UelNr: integer
User index number to be assigned to the unique element
const elem: TgdxNameStr
String for unique element
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
Register an unique element in mapped space; Index is the user assigned index for the element. Registering an element a second time is not considered an error as long as the same Index is used. Assigning different elements with the same Index value is an error. An unique element must follow the GAMS rules when it contains quote characters.
See Also
TGXFile.UELRegisterMapStart, TGXFile.UELRegisterDone


TGXFile.UELRegisterMapStart

TGXFile.UELRegisterMapStart
TGXFile
Start registering unique elements in mapped mode
function GDXUELRegisterMapStart(Ap: PGxFile): boolean; stdcall;
function UELRegisterMapStart: boolean;
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.UELRegisterMap, TGXFile.UELRegisterDone


TGXFile.UELRegisterRaw

TGXFile.UELRegisterRaw
TGXFile
Register an unique elements in raw mode
function GDXUELRegisterRaw(Ap: PGxFile; const Elem: TgdxNameStr): boolean; stdcall;
function UELRegisterRaw(const elem: TgdxNameStr): boolean;
Parameters
Ap: PGxFile
Pointer to GDX structure
const Elem: TgdxNameStr
String for unique element
Return Value
True if the operation is possible, False otherwise
Description
The unique element is registered in raw mode, i.e. the internally assigned integer index is determined by the system Can only be used while writing to a GDX file
See Also
TGXFile.UELRegisterMap, TGXFile.UELRegisterDone


TGXFile.UELRegisterRawStart

TGXFile.UELRegisterRawStart
TGXFile
Start registering unique elements in raw mode
function GDXUELRegisterRawStart(Ap: PGxFile): boolean; stdcall;
function UELRegisterRawStart: boolean;
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.UELRegisterRaw, TGXFile.UELRegisterDone


TGXFile.UELRegisterStr

TGXFile.UELRegisterStr
TGXFile
Register an unique elements in string mode
function GDXUELRegisterStr(Ap: PGxFile; const Elem: TgdxNameStr; var UelNr: integer): boolean; stdcall;
function UELRegisterStr(const elem: TgdxNameStr; var UelNr: integer): boolean;
Parameters
Ap: PGxFile
Pointer to GDX structure
const Elem: TgdxNameStr
String for unique element
var UelNr: integer
Index number assigned to this unique element in user space
Return Value
True if element was registered, False otherwise.
Description
The unique element is registered in user mapped space. The returned index is the next higher value. Registering an element a second time is not considered an error and the same index position will be returned. An unique element must follow the GAMS rules when it contains quote characters.
See Also
TGXFile.UELRegisterStrStart, TGXFile.UELRegisterDone


TGXFile.UELRegisterStrStart

TGXFile.UELRegisterStrStart
TGXFile
Start registering unique elements in string mode
function GDXUELRegisterStrStart(Ap: PGxFile): boolean; stdcall;
function UELRegisterStrStart: boolean;
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, False otherwise
See Also
TGXFile.UELRegisterStr, TGXFile.UELRegisterDone


TGXFile.UMFindUEL

TGXFile.UMFindUEL
TGXFile
Search for unique element by its string
function UMFindUEL(const s: ShortString; var EN: integer; var UMap: integer): boolean;
function GDXUMFindUEL(Ap: PGxFile; const S: ShortString; var EN: integer; var UMap: integer): boolean; stdcall;
Parameters
const s: ShortString
String to be searched
var EN: integer
Internal unique element number or -1 if not found
var UMap: integer
User mapping for the element or -1 if not found or the element was never mapped
Ap: PGxFile
Pointer to GDX structure
Return Value
True if element was found, false otherwise


TGXFile.UMUelGet

TGXFile.UMUelGet
TGXFile
Get a unique element using an unmapped index
function UMUelGet(N: integer; var s: TgdxNameStr; var UMap: integer): boolean;
function GDXUMUelGet(Ap: PGxFile; N: integer; var S: TgdxNameStr; var UMap: integer): boolean; stdcall;
Parameters
N: integer
Element number (unmapped) in the range 1..NrElem
var s: TgdxNameStr
String for unique element
var UMap: integer
User mapping for this element or -1 if element was never mapped
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.UMUelInfo, TGXFile.GetUEL


TGXFile.UMUelInfo

TGXFile.UMUelInfo
TGXFile
Return information about the unique elements
function UMUelInfo(var NrElem: integer; var HighMap: integer): boolean;
function GDXUMUelInfo(Ap: PGxFile; var NrElem: integer; var HighMap: integer): boolean; stdcall;
Parameters
var NrElem: integer
Total number of unique elements
var HighMap: integer
Highest user mapping index used
Ap: PGxFile
Pointer to GDX structure
Return Value
Always returns True
See Also
TGXFile.UMUelGet


Structs and Records

Structs and Records
These are all structs and records that are contained in this documentation.


TgdxDataType

TgdxDataType
Unit: gxdefs
Enumerated type for GAMS data types
TgdxDataType = (dt_set, dt_par, dt_var, dt_equ);
Unit
gxdefs
Members
dt_set
0: Set
dt_par
1: Parameter
dt_var
2: Variable
dt_equ
3: Equation
Description
This enumerated type can be used in a Delphi program directly; Programs using the DLL should use the integer values instead This avoids passing enums


TgdxSpecialValue

TgdxSpecialValue
Unit: gxdefs
Enumerated type for special values
TgdxSpecialValue = (sv_valund, sv_valna, sv_valpin, sv_valmin, sv_valeps, sv_normal);
Unit
gxdefs
Members
sv_valund
0: Undefined
sv_valna
1: Not Available
sv_valpin
2: Positive Infinity
sv_valmin
3: Negative Infinity
sv_valeps
4: Epsilon
sv_normal
5: Normal Value
Description
This enumerated type can be used in a Delphi program directly; Programs using the DLL should use the integer values instead This avoids passing enums


Functions

Functions
These are all functions that are contained in this documentation.


GDXAddSetText

GDXAddSetText
Unit: gdxio
Register a string to be used as text associated with a unique element
function AddSetText(const s: ShortString; var N: integer): boolean;
function GDXAddSetText(Ap: PGxFile; const s: ShortString; var N: integer): boolean; stdcall;
Unit
gdxio
Parameters
const s: ShortString
The string to be registered
var N: integer
The index number assigned to this string
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
Register a string and return the index assigned to this string. The string must follow the GAMS syntax rules for explanatory text
See Also
TGXFile.GetElemText, TGXFile.SetTextNodeNr


GDXClose

GDXClose
Unit: gdxio
Close a GDX file
function GDXClose(var Ap: PGXFile): integer; stdcall;
destructor Destroy; override;
Unit
gdxio
Parameters
var Ap: PGXFile
Pointer to GDX structure
Return Value
Zero if GDX file was closed successfully, an error code otherwise.
Description
Close a GDX file that was previously opened for reading or writing. Before the file is closed, any pending write operations will be finished. The pointer to the GDX structure will be set to nil.
See Also
TGXFile.OpenRead, TGXFile.OpenWrite


GDXDataErrorCount

GDXDataErrorCount
Unit: gdxio
The number of error records
function DataErrorCount: integer;
function GDXDataErrorCount(Ap: PGxFile): integer; stdcall;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
The number of error records available.
Description
After a write operation is finished (DataWriteDone), the data is sorted and written to the GDX file. If there are duplicate records, the first record is written to the file and the duplicates are added to the error list.

When reading data using a filtered read operation, data records that were filtered out because an index is not in the user index space or not in a filter are added the error list.

See Also
TGXFile.DataErrorRecord


GDXDataErrorRecord

GDXDataErrorRecord
Unit: gdxio
Retrieve an error record
function DataErrorRecord(Rn: integer; var AElements: TgdxUELIndex; var AVals: TgdxValues): boolean;
function GDXDataErrorRecord(Ap: PGxFile; Rn: integer; var AElements: TgdxUELIndex; var AVals: TgdxValues): boolean; stdcall;
Unit
gdxio
Parameters
Rn: integer
The number of the record to be retrieved, range = 1..NrErrorRecords
var AElements: TgdxUELIndex
Index for the record
var AVals: TgdxValues
Values for the record
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the record number is valid, False otherwise
See Also
TGXFile.DataErrorCount


GDXDataReadDone

GDXDataReadDone
Unit: gdxio
Finish reading of a symbol in any mode(raw, mapped, string)
function DataReadDone: boolean;
function GDXDataReadDone(Ap: PGxFile): boolean; stdcall;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataReadRawStart, TGXFile.DataReadMapStart, TGXFile.DataReadStrStart


GDXDataReadFilteredStart

GDXDataReadFilteredStart
Unit: gdxio
Initialize the reading of a symbol in filtered mode
function DataReadFilteredStart(SyNr: integer; const ADomainNrs: TgdxUELIndex; var NrRecs: integer): boolean;
function GDXDataReadFilteredStart(Ap: PGxFile; SyNr: integer; const AFilters: TgdxUELIndex; var NrRecs: integer): boolean; stdcall;
Unit
gdxio
Parameters
SyNr: integer
The index number of the symbol, range 1..NrSymbols
var NrRecs: integer
The number of records available for reading
Ap: PGxFile
Pointer to GDX structure
const AFilters: TgdxUELIndex
Array of filter actions for each index position
Return Value
True if the operation is possible, false otherwise
Description
Start reading data for a symbol in filtered mode. Each filter action (1..Dimension) describes how each index should be treated when reading a data record. When new unique elements are returned, they are added to the user index space automatically. The actual reading of records is done with DataReadMap.

The action codes are as follows:

Action code | Result
DOMC_UNMAPPED | The index is not mapped into user space
DOMC_EXPAND | New unique elements encountered will be be mapped into the user space
DOMC_STRICT | If the unique element in this position does not map into user space, the record will not be available and is added to the error list instead
FilterNumber | If the unique element in this position does not map into user space or is not enabled in this filter, the record will not be available and is added to the error list instead
See Also
TGXFile.FilterRegisterStart, TGXFile.DataReadMap, TGXFile.DataReadRawStart, TGXFile.DataReadStrStart, TGXFile.DataReadDone


GDXDataReadMap

GDXDataReadMap
Unit: gdxio
Read the next record in mapped mode
function DataReadMap(Rn: integer; var AElements: TgdxUELIndex; var AVals: TgdxValues; var AFDim: integer): boolean;
function GDXDataReadMap(Ap: PGxFile; Rn: integer; var AElements: TgdxUELIndex; var AVals: TgdxValues; var AFDim: integer): boolean; stdcall;
Unit
gdxio
Parameters
var AElements: TgdxUELIndex
The index of the record
var AVals: TgdxValues
The data of the record
var AFDim: integer
The first index position in AElements that changed
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataReadMapStart, TGXFile.DataReadFilteredStart, TGXFile.DataReadDone


GDXDataReadMapStart

GDXDataReadMapStart
Unit: gdxio
Initialize the reading of a symbol in mapped mode
function DataReadMapStart(SyNr: integer; var NrRecs: integer): boolean;
function GDXDataReadMapStart(Ap: PGxFile; SyNr: integer; var NrRecs: integer): boolean; stdcall;
Unit
gdxio
Parameters
SyNr: integer
The index number of the symbol, range 1..NrSymbols
var NrRecs: integer
The number of records available for reading
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataReadMap, TGXFile.DataReadRawStart, TGXFile.DataReadStrStart, TGXFile.DataReadDone


GDXDataReadRaw

GDXDataReadRaw
Unit: gdxio
Read the next record in raw mode
function DataReadRaw(var AElements: TgdxUELIndex; var AVals: TgdxValues; var AFDim: integer): boolean;
function GDXDataReadRaw(Ap: PGxFile; var AElements: TgdxUELIndex; var AVals: TgdxValues; var AFDim: integer): boolean; stdcall;
Unit
gdxio
Parameters
var AElements: TgdxUELIndex
The index of the record
var AVals: TgdxValues
The data of the record
var AFDim: integer
The first index position in AElements that changed
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataReadRawStart, TGXFile.DataReadDone


GDXDataReadRawStart

GDXDataReadRawStart
Unit: gdxio
Initialize the reading of a symbol in raw mode
function DataReadRawStart(SyNr: integer; var NrRecs: integer): boolean;
function GDXDataReadRawStart(Ap: PGxFile; SyNr: integer; var NrRecs: integer): boolean; stdcall;
Unit
gdxio
Parameters
SyNr: integer
The index number of the symbol, range 1..NrSymbols
var NrRecs: integer
The number of records available for reading
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataReadRaw, TGXFile.DataReadMapStart, TGXFile.DataReadStrStart, TGXFile.DataReadDone


GDXDataReadStr

GDXDataReadStr
Unit: gdxio
Read the next record in string mode
function DataReadStr(var AStrElements: TgdxStrIndex; var AVals: TgdxValues; var AFDim: integer): boolean;
function GDXDataReadStr(Ap: PGxFile; var AStrElements: TgdxStrIndex; var AVals: TgdxValues; var AFDim: integer): boolean; stdcall;
Unit
gdxio
Parameters
var AStrElements: TgdxStrIndex
The index of the record as strings for the unique elements
var AVals: TgdxValues
The data of the record
var AFDim: integer
The first index position in AElements that changed
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible; return False if there is no more data or the operation is not possible
Description
not for the time being function DataReadScalar(SyNr: integer): boolean; function DataReadSet1Start(SyNr: integer; var NrRecs: integer): boolean; function DataReadSet2Start(SyNr: integer; var NrRecs: integer): boolean; function DataReadPar1Start(SyNr: integer; var NrRecs: integer): boolean; function DataReadPar2Start(SyNr: integer; var NrRecs: integer): boolean; function DataReadSet1(var indx: TgdxNameStr; var ElemText: ShortString): boolean; function DataReadSet2(var indx1,indx2: TgdxNameStr; var ElemText: ShortString): boolean; function DataReadPar1(var indx: TgdxNameStr; var Value: double): boolean; function DataReadPar2(var indx1,indx2: TgdxNameStr; var Value: double): boolean; Read the next record using strings for the unique elements. The reading should be initialized by calling DataReadStrStart
See Also
TGXFile.DataReadStrStart, TGXFile.DataReadDone


GDXDataReadStrStart

GDXDataReadStrStart
Example, Unit: gdxio
Initialize the reading of a symbol in string mode
function DataReadStrStart(SyNr: integer; var NrRecs: integer): boolean;
function GDXDataReadStrStart(Ap: PGxFile; SyNr: integer; var NrRecs: integer): boolean; stdcall;
Unit
gdxio
Parameters
SyNr: integer
The index number of the symbol, range 1..NrSymbols
var NrRecs: integer
The number of records available for reading
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
Reading data using strings is the simplest way to read data. Every record read using DataReadStr will return the strings for the unique elements. Internal mapping is not affected by this function.
See Also
TGXFile.DataReadStr, TGXFile.DataReadRawStart, TGXFile.DataReadMapStart, TGXFile.DataReadDone


GDXDataWriteDone

GDXDataWriteDone
Unit: gdxio
Finish a write operation
function DataWriteDone: boolean;
function GDXDataWriteDone(Ap: PGxFile): boolean; stdcall;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataErrorCount, TGXFile.DataWriteRawStart, TGXFile.DataWriteMapStart, TGXFile.DataWriteStrStart


GDXDataWriteMap

GDXDataWriteMap
Unit: gdxio
Write a data element in mapped mode
function DataWriteMap(const AElements: TgdxUELIndex; const AVals: TgdxValues): boolean;
function GDXDataWriteMap(Ap: PGxFile; const AElements: TgdxUELIndex; const AVals: TgdxValues): boolean; stdcall;
Unit
gdxio
Parameters
const AElements: TgdxUELIndex
The index for this element using mapped values
const AVals: TgdxValues
The values for this element
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataWriteMapStart, TGXFile.DataWriteDone


GDXDataWriteMapStart

GDXDataWriteMapStart
Unit: gdxio
Start writing a new symbol in mapped mode
function DataWriteMapStart(const AName: TgdxNameStr; const AText: ShortString; ADim: integer; AType: TgdxDataType; AUserInfo: integer): boolean;
function GDXDataWriteMapStart(Ap: PGxFile; const AName: TgdxNameStr; const AText: ShortString; ADim: integer; IAType: integer; AUserInfo: integer): boolean; stdcall;
Unit
gdxio
Parameters
const AName: TgdxNameStr
Name of the symbol
const AText: ShortString
Explanatory text for the symbol
ADim: integer
Dimension of the symbol
AType: TgdxDataType
Type of the symbol
AUserInfo: integer
Any integer value
Ap: PGxFile
Pointer to GDX structure
IAType: integer
Type (as integer) of the symbol
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataWriteMap, TGXFile.DataWriteDone


GDXDataWriteRaw

GDXDataWriteRaw
Unit: gdxio
Write a data element in raw mode
function DataWriteRaw(const AElements: TgdxUELIndex; const AVals: TgdxValues): boolean;
function GDXDataWriteRaw(Ap: PGxFile; const AElements: TgdxUELIndex; const AVals: TgdxValues): boolean; stdcall;
Unit
gdxio
Parameters
const AElements: TgdxUELIndex
The index for this element
const AVals: TgdxValues
The values for this element
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
When writing data in raw mode, the index space used is based on the internal index space. The indices used are in the range 1..NrUels. Before we can write in raw mode, the unique elements (strings) should be registered first.

For performance reasons, the index is not checked for valid values, and it is assumed that the records are written in increasing order without any duplicates.

See Also
TGXFile.DataWriteRawStart, TGXFile.DataWriteDone


GDXDataWriteRawStart

GDXDataWriteRawStart
Unit: gdxio
Start writing a new symbol in raw mode
function DataWriteRawStart(const AName: TgdxNameStr; const AText: ShortString; ADim: integer; AType: TgdxDataType; AUserInfo: integer): boolean;
function GDXDataWriteRawStart(Ap: PGxFile; const AName: TgdxNameStr; const AText: ShortString; ADim: integer; IAType: integer; AUserInfo: integer): boolean; stdcall;
Unit
gdxio
Parameters
const AName: TgdxNameStr
Name of the symbol
const AText: ShortString
Explanatory text for the symbol
ADim: integer
Dimension of the symbol
AType: TgdxDataType
Type of the symbol
AUserInfo: integer
Any integer value
Ap: PGxFile
Pointer to GDX structure
IAType: integer
Type (as integer) of the symbol
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataWriteRaw, TGXFile.DataWriteDone


GDXDataWriteStr

GDXDataWriteStr
Unit: gdxio
Write a data element in string mode
function DataWriteStr(const AStrElements: TgdxStrIndex; const AVals: TgdxValues): boolean;
function GDXDataWriteStr(Ap: PGxFile; const AStrElements: TgdxStrIndex; const AVals: TgdxValues): boolean; stdcall;
Unit
gdxio
Parameters
const AStrElements: TgdxStrIndex
The index for this element using strings for the unique elements
const AVals: TgdxValues
The values for this element
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
When writing data using string elements, each string element is added to the internal unique element table and assigned an index. Writing using strings does not add the unique elements to the user mapped space. Each element string must follow the GAMS rules for unique elements.
See Also
TGXFile.DataWriteMapStart, TGXFile.DataWriteDone


GDXDataWriteStrStart

GDXDataWriteStrStart
Unit: gdxio
Start writing a new symbol in string mode
function DataWriteStrStart(const AName: TgdxNameStr; const AText: ShortString; ADim: integer; AType: TgdxDataType; AUserInfo: integer): boolean;
function GDXDataWriteStrStart(Ap: PGxFile; const AName: TgdxNameStr; const AText: ShortString; ADim: integer; IAType: integer; AUserInfo: integer): boolean; stdcall;
Unit
gdxio
Parameters
const AName: TgdxNameStr
Name of the symbol
const AText: ShortString
Explanatory text for the symbol
ADim: integer
Dimension of the symbol
AType: TgdxDataType
Type of the symbol
AUserInfo: integer
Any integer value
Ap: PGxFile
Pointer to GDX structure
IAType: integer
Type (as integer) of the symbol
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.DataWriteStr, TGXFile.DataWriteDone


GDXDLLVersion

GDXDLLVersion
Unit: gdxio
Return string for library version
function GDXDLLVersion(var DLLStr: ShortString): boolean; stdcall;
Unit
gdxio
Parameters
var DLLStr: ShortString
Version string for the library
Return Value
Always True


GDXErrorCount

GDXErrorCount
Unit: gdxio
Returns the number of errors
function GDXErrorCount(Ap: PGxFile): integer; stdcall;
function ErrorCount: integer;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
Total number of errors encountered
See Also
TGXFile.GetLastError


GDXErrorStr

GDXErrorStr
Unit: gdxio
Return string for an error number
function GDXErrorStr(N: integer; var Msg: ShortString): boolean; stdcall;
Unit
gdxio
Parameters
N: integer
Error number from GDXGetLastError
var Msg: ShortString
Text for error
Return Value
Always True
See Also
TGXFile.GetLastError


GDXFileVersion

GDXFileVersion
Unit: gdxio
Return strings for file version and file producer
function FileVersion(var FileStr: ShortString; var ProduceStr: ShortString): boolean;
function GDXFileVersion(Ap: PGxFile; var FileStr: ShortString; var ProduceStr: ShortString): boolean; stdcall;
Unit
gdxio
Parameters
var FileStr: ShortString
Version string
var ProduceStr: ShortString
Producer string
Ap: PGxFile
Pointer to GDX structure
Return Value
Always True
See Also
TGXFile.OpenWrite


GDXFilterExists

GDXFilterExists
Unit: gdxio
Check if there is a filter defined based on its number
function FilterExists(N: integer): boolean;
function GDXFilterExists(Ap: PGxFile; N: integer): boolean; stdcall;
Unit
gdxio
Parameters
N: integer
Filter number as used in FilterRegisterStart
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the filter exists; False otherwise
See Also
TGXFile.FilterRegisterStart


GDXFilterRegister

GDXFilterRegister
Unit: gdxio
Add a unique element to the current filter definition
function FilterRegister(V: integer): boolean;
function GDXFilterRegister(Ap: PGxFile; V: integer): boolean; stdcall;
Unit
gdxio
Parameters
V: integer
Unique element number in the user index space
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
Register a unique element as part of the current filter. The function returns false if the index number is out of range of valid user indices or the index was never mapped into the user index space.
See Also
TGXFile.FilterRegisterStart, TGXFile.FilterRegisterDone


GDXFilterRegisterDone

GDXFilterRegisterDone
Unit: gdxio
Finish registration of unique elements for a filter
function FilterRegisterDone: boolean;
function GDXFilterRegisterDone(Ap: PGxFile): boolean; stdcall;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.FilterRegisterStart, TGXFile.FilterRegister


GDXFilterRegisterStart

GDXFilterRegisterStart
Unit: gdxio
Define a unique element filter
function FilterRegisterStart(Nr: integer): boolean;
function GDXFilterRegisterStart(Ap: PGxFile; Nr: integer): boolean; stdcall;
Unit
gdxio
Parameters
Nr: integer
Filter number to be assigned
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.FilterRegister, TGXFile.FilterRegisterDone, TGXFile.DataReadFilteredStart


GDXFindSymbol

GDXFindSymbol
Unit: gdxio
Find symbol by name
function GDXFindSymbol(Ap: PGxFile; const AName: TgdxNameStr; var AIx: integer): boolean; stdcall;
function FindSymbol(const AName: TgdxNameStr; var AIx: integer): boolean;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
const AName: TgdxNameStr
Name of the symbol
var AIx: integer
Symbol number
Return Value
True if symbol found, False otherwise.
Description
Search for a symbol by name; the search is not case sensitive. When the symbol is found, Aix contains the symbol number and the function returns true. When the symbol is not found, the function returns false.
See Also
TGXFile.SymbolInfo, TGXFile.SymbolInfoX


GDXGetElemText

GDXGetElemText
Unit: gdxio
Retrieve the string and node number for an entry in the string table
function GetElemText(N: integer; var s: ShortString; var Node: integer): boolean;
function GDXGetElemText(Ap: PGxFile; N: integer; var S: ShortString; var Node: integer): boolean; stdcall;
Unit
gdxio
Parameters
N: integer
String table index
var s: ShortString
Text found for the entry
var Node: integer
Node number found for the entry
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
Retrieve a string based on the string table index previously obtained by calling AddSetText. If a node number was never specified for this index using SetTextNodeNr, the node number returned will be zero
See Also
TGXFile.AddSetText, TGXFile.SetTextNodeNr


GDXGetLastError

GDXGetLastError
Unit: gdxio
Return the last error
function GDXGetLastError(Ap: PGxFile): integer; stdcall;
function GetLastError: integer;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
The error number, or zero if there was no error
Description
When an error is encountered, an error code is stored which can be retrieved with this function. If subsequent errors occur before this function is called, the first error code will be maintained
See Also
TGXFile.ErrorCount


GDXGetSpecialValues

GDXGetSpecialValues
Unit: gdxio
Retrieve the internal values for special values
function GetSpecialValues(var Avals: TgdxSVals): boolean;
function GDXGetSpecialValues(Ap: PGxFile; var AVals: TgdxSVals): boolean; stdcall;
Unit
gdxio
Parameters
var Avals: TgdxSVals
array of special values used for Eps, +Inf, -Inf, NA and Undef
Ap: PGxFile
Pointer to GDX structure
Return Value
Always True
See Also
TGXFile.ResetSpecialValues, TGXFile.SetSpecialValues


GDXGetUEL

GDXGetUEL
Unit: gdxio
Get the string for a unique element using a mapped index
function GDXGetUEL(Ap: PGxFile; UelNr: integer; var S: TgdxNameStr): boolean; stdcall;
function GetUEL(UelNr: integer; var S: TgdxNameStr): boolean;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
UelNr: integer
Index number in user space (1..NrUserElem)
var S: TgdxNameStr
String for the unique element
Return Value
Return true if the index is in a valid range, false otherwise
Description
Retrieve the string for an unique element based on a mapped index number.
See Also
TGXFile.UMUelGet


GDXMapValue

GDXMapValue
Unit: gdxio
Classify a value as a potential special value
function MapValue(const D: double; var sv: TgdxSpecialValue): boolean;
function GDXMapValue(Ap: PGxFile; const D: double; var isv: integer): boolean; stdcall;
Unit
gdxio
Parameters
const D: double
Value to classify
var sv: TgdxSpecialValue
Classification
Ap: PGxFile
Pointer to GDX structure
Return Value
Returns True if D is a special value, False otherwise
See Also
TGXFile.GetSpecialValues, TGXFile.SetSpecialValues


GDXOpenRead

GDXOpenRead
Example, Unit: gdxio
Open a GDX file for reading
function GDXOpenRead(var Ap: PGXFile; const Afn: ShortString): integer; stdcall;
constructor OpenRead(const fn: ShortString);
Unit
gdxio
Parameters
var Ap: PGXFile
Contains pointer to the new GDX structure, or is set to nil when the open failed
const Afn: ShortString
file name of the gdx file to be opened
Return Value
Zero if GDX file was opened successfully, an error code otherwise
Description
Open an existing GDX file for input. If a file extension is not supplied, the extension '.gdx' will be used. The return code is a system dependent I/O error. If the file was found, but is not a valid GDX file, the function GetLastError can be used to handle these type of errors.
See Also
TGXFile.OpenWrite, TGXFile.Destroy, TGXFile.GetLastError


GDXOpenWrite

GDXOpenWrite
Example, Unit: gdxio
Create a GDX file for writing
function GDXOpenWrite(var Ap: PGXFile; const Afn: ShortString; const AProducer: ShortString): integer; stdcall;
constructor OpenWrite(const Afn: ShortString; const AProducer: ShortString);
Unit
gdxio
Parameters
var Ap: PGXFile
Contains pointer to the new GDX structure, or is set to nil when the open failed
const Afn: ShortString
File name of the gdx file to be created
const AProducer: ShortString
Name of program that creates the GDX file
Return Value
Zero if GDX file was opened successfully, an error code otherwise;
Description
Open a new GDX file for output. If a file extension is not supplied, the extension '.gdx' will be used. The return code is a system dependent I/O error.
See Also
TGXFile.OpenRead, TGXFile.Destroy


GDXResetSpecialValues

GDXResetSpecialValues
Unit: gdxio
Reset the internal values for special values
function ResetSpecialValues: boolean;
function GDXResetSpecialValues(Ap: PGxFile): boolean; stdcall;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
Always True
See Also
TGXFile.SetSpecialValues, TGXFile.GetSpecialValues


GDXSetHasText

GDXSetHasText
Unit: gdxio
Test if any of the unique elements in a set has associated text
function SetHasText(N: integer): boolean;
function GDXSetHasText(Ap: PGxFile; N: integer): boolean; stdcall;
Unit
gdxio
Parameters
N: integer
Symbol number (1..NrSymbols)
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the Set contains at least one unique element that has associated text, false otherwise
See Also
TGXFile.SystemInfo, TGXFile.SymbolInfo


GDXSetSpecialValues

GDXSetSpecialValues
Unit: gdxio
Set the internal values for special values
function SetSpecialValues(const AVals: TgdxSVals): boolean;
function GDXSetSpecialValues(Ap: PGxFile; const AVals: TgdxSVals): boolean; stdcall;
Unit
gdxio
Parameters
const AVals: TgdxSVals
array of special values to be used for Eps, +Inf, -Inf, NA and Undef
Ap: PGxFile
Pointer to GDX structure
Return Value
Always True
See Also
TGXFile.ResetSpecialValues, TGXFile.GetSpecialValues


GDXSetTextNodeNr

GDXSetTextNodeNr
Unit: gdxio
Set the Node number for an entry in the string table
function SetTextNodeNr(N: integer; Node: integer): boolean;
function GDXSetTextNodeNr(Ap: PGxFile; N: integer; Node: integer): boolean; stdcall;
Unit
gdxio
Parameters
N: integer
Index number of the entry to be modified
Node: integer
The new Node value for the entry
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
After registering a string with AddSetText, we can assign a node number for later retrieval. The node number is any integer which is stored without further restrictions.
See Also
TGXFile.AddSetText, TGXFile.GetElemText


GDXSetTraceLevel

GDXSetTraceLevel
Unit: gdxio
Set the amount of trace (debug) information generated
function SetTraceLevel(N: integer; const s: ShortString): boolean;
function GDXSetTraceLevel(Ap: PGxFile; N: integer; const S: ShortString): boolean; stdcall;
Unit
gdxio
Parameters
N: integer
Tracing level N <= 0 no tracing N >= 3 maximum tracing
const s: ShortString
A string to be included in the trace output
Ap: PGxFile
Pointer to GDX structure
Return Value
Always True


GDXSymbolInfo

GDXSymbolInfo
Unit: gdxio
Returns information about a symbol
function GDXSymbolInfo(Ap: PGxFile; SyNr: integer; var AName: TgdxNameStr; var ADim: integer; var IATyp: integer): boolean; stdcall;
function SymbolInfo(SyNr: integer; var AName: TgdxNameStr; var ADim: integer; var ATyp: TgdxDataType): boolean;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
SyNr: integer
The symbol number (range 1..NrSymbols)
var AName: TgdxNameStr
Name of the symbol
var ADim: integer
Dimension of the symbol
var IATyp: integer
Symbol type
Return Value
False if the symbol number is not in the correct range, True otherwise
See Also
TGXFile.SystemInfo, TGXFile.SymbolInfoX, TGXFile.FindSymbol


GDXSymbolInfoX

GDXSymbolInfoX
Unit: gdxio
Returns additional information about a symbol
function GDXSymbolInfoX(Ap: PGxFile; SyNr: integer; var ACount: integer; var AUserInfo: integer; var AExplTxt: ShortString): boolean; stdcall;
function SymbolInfoX(SyNr: integer; var ACount: integer; var AUserInfo: integer; var AExplTxt: ShortString): boolean;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
SyNr: integer
The symbol number (range 1..NrSymbols)
var ACount: integer
Total number of records stored (unmapped)
var AUserInfo: integer
User field value
var AExplTxt: ShortString
Expanatory text for the symbol
Return Value
False if the symbol number is not in the correct range, True otherwise
See Also
TGXFile.SystemInfo, TGXFile.SymbolInfo, TGXFile.FindSymbol


GDXSystemInfo

GDXSystemInfo
Unit: gdxio
Returns the number of symbols and unique elements
function GDXSystemInfo(Ap: PGxFile; var NrSy: integer; var NrUel: integer): boolean; stdcall;
function SystemInfo(var NrSy: integer; var NrUel: integer): boolean;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
var NrSy: integer
Number of symbols available in the GDX file
var NrUel: integer
Number of unique elements stored in the GDX file
Return Value
Always true


GDXUELRegisterAll

GDXUELRegisterAll
Unit: gdxio
This function is now obsolete
function GDXUELRegisterAll(Ap: PGxFile): boolean; stdcall;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure


GDXUELRegisterDone

GDXUELRegisterDone
Unit: gdxio
Finish registration of unique elements
function UELRegisterDone: boolean;
function GDXUELRegisterDone(Ap: PGxFile): boolean; stdcall;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.UELRegisterRawStart, TGXFile.UELRegisterMapStart, TGXFile.UELRegisterStrStart


GDXUELRegisterMap

GDXUELRegisterMap
Unit: gdxio
Register an unique elements in mapped mode
function UELRegisterMap(UelNr: integer; const elem: TgdxNameStr): boolean;
function GDXUELRegisterMap(Ap: PGxFile; UelNr: integer; const Elem: TgdxNameStr): boolean; stdcall;
Unit
gdxio
Parameters
UelNr: integer
User index number to be assigned to the unique element
const elem: TgdxNameStr
String for unique element
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
Description
Register an unique element in mapped space; Index is the user assigned index for the element. Registering an element a second time is not considered an error as long as the same Index is used. Assigning different elements with the same Index value is an error. An unique element must follow the GAMS rules when it contains quote characters.
See Also
TGXFile.UELRegisterMapStart, TGXFile.UELRegisterDone


GDXUELRegisterMapStart

GDXUELRegisterMapStart
Unit: gdxio
Start registering unique elements in mapped mode
function GDXUELRegisterMapStart(Ap: PGxFile): boolean; stdcall;
function UELRegisterMapStart: boolean;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.UELRegisterMap, TGXFile.UELRegisterDone


GDXUELRegisterNone

GDXUELRegisterNone
Unit: gdxio
This function is now obsolete
function GDXUELRegisterNone(Ap: PGxFile): boolean; stdcall;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure


GDXUELRegisterRaw

GDXUELRegisterRaw
Unit: gdxio
Register an unique elements in raw mode
function GDXUELRegisterRaw(Ap: PGxFile; const Elem: TgdxNameStr): boolean; stdcall;
function UELRegisterRaw(const elem: TgdxNameStr): boolean;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
const Elem: TgdxNameStr
String for unique element
Return Value
True if the operation is possible, False otherwise
Description
The unique element is registered in raw mode, i.e. the internally assigned integer index is determined by the system Can only be used while writing to a GDX file
See Also
TGXFile.UELRegisterMap, TGXFile.UELRegisterDone


GDXUELRegisterRawStart

GDXUELRegisterRawStart
Unit: gdxio
Start registering unique elements in raw mode
function GDXUELRegisterRawStart(Ap: PGxFile): boolean; stdcall;
function UELRegisterRawStart: boolean;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.UELRegisterRaw, TGXFile.UELRegisterDone


GDXUELRegisterStr

GDXUELRegisterStr
Unit: gdxio
Register an unique elements in string mode
function GDXUELRegisterStr(Ap: PGxFile; const Elem: TgdxNameStr; var UelNr: integer): boolean; stdcall;
function UELRegisterStr(const elem: TgdxNameStr; var UelNr: integer): boolean;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
const Elem: TgdxNameStr
String for unique element
var UelNr: integer
Index number assigned to this unique element in user space
Return Value
True if element was registered, False otherwise.
Description
The unique element is registered in user mapped space. The returned index is the next higher value. Registering an element a second time is not considered an error and the same index position will be returned. An unique element must follow the GAMS rules when it contains quote characters.
See Also
TGXFile.UELRegisterStrStart, TGXFile.UELRegisterDone


GDXUELRegisterStrStart

GDXUELRegisterStrStart
Unit: gdxio
Start registering unique elements in string mode
function GDXUELRegisterStrStart(Ap: PGxFile): boolean; stdcall;
function UELRegisterStrStart: boolean;
Unit
gdxio
Parameters
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, False otherwise
See Also
TGXFile.UELRegisterStr, TGXFile.UELRegisterDone


GDXUMFindUEL

GDXUMFindUEL
Unit: gdxio
Search for unique element by its string
function UMFindUEL(const s: ShortString; var EN: integer; var UMap: integer): boolean;
function GDXUMFindUEL(Ap: PGxFile; const S: ShortString; var EN: integer; var UMap: integer): boolean; stdcall;
Unit
gdxio
Parameters
const s: ShortString
String to be searched
var EN: integer
Internal unique element number or -1 if not found
var UMap: integer
User mapping for the element or -1 if not found or the element was never mapped
Ap: PGxFile
Pointer to GDX structure
Return Value
True if element was found, false otherwise


GDXUMUelGet

GDXUMUelGet
Unit: gdxio
Get a unique element using an unmapped index
function UMUelGet(N: integer; var s: TgdxNameStr; var UMap: integer): boolean;
function GDXUMUelGet(Ap: PGxFile; N: integer; var S: TgdxNameStr; var UMap: integer): boolean; stdcall;
Unit
gdxio
Parameters
N: integer
Element number (unmapped) in the range 1..NrElem
var s: TgdxNameStr
String for unique element
var UMap: integer
User mapping for this element or -1 if element was never mapped
Ap: PGxFile
Pointer to GDX structure
Return Value
True if the operation is possible, false otherwise
See Also
TGXFile.UMUelInfo, TGXFile.GetUEL


GDXUMUelInfo

GDXUMUelInfo
Unit: gdxio
Return information about the unique elements
function UMUelInfo(var NrElem: integer; var HighMap: integer): boolean;
function GDXUMUelInfo(Ap: PGxFile; var NrElem: integer; var HighMap: integer): boolean; stdcall;
Unit
gdxio
Parameters
var NrElem: integer
Total number of unique elements
var HighMap: integer
Highest user mapping index used
Ap: PGxFile
Pointer to GDX structure
Return Value
Always returns True
See Also
TGXFile.UMUelGet


GetDLLVersion

GetDLLVersion
Unit: gxfile
Get version string from DLL
function GetDLLVersion(var V: ShortString): boolean;
Unit
gxfile
Parameters
var V: ShortString
Contains version string on return
Return Value
Always returns true


Types

Types
These are all types that are contained in this documentation.


PGXFile

PGXFile
Unit: gxdefs
PGXFile = pointer;
Unit
gxdefs
Description
Pointer to a GDX data structure


TgdxDataSize

TgdxDataSize
Unit: gxdefs
TgdxDataSize = 1..gdxMAXDATASIZE;
Unit
gxdefs
Description
Index for passing values


TgdxDimension

TgdxDimension
Unit: gxdefs
TgdxDimension = 1..gdxMAXDIM;
Unit
gxdefs
Description
GAMS dimension


TgdxNameStr

TgdxNameStr
Unit: gxdefs
TgdxNameStr = string[gdxMaxNameLen];
Unit
gxdefs
Description
Array type for passing an identifier or an unique element


TgdxStrIndex

TgdxStrIndex
Unit: gxdefs
TgdxStrIndex = array[TgdxDimension] of TgdxNameStr;
Unit
gxdefs
Description
Array type for an index using strings


TgdxSVals

TgdxSVals
Unit: gxdefs
TgdxSVals = array[TgdxSpecialValue] of double;
Unit
gxdefs
Description
Array type for passing special values


TgdxUELIndex

TgdxUELIndex
Unit: gxdefs
TgdxUELIndex = array[TgdxDimension] of integer;
Unit
gxdefs
Description
Array type for an index using integers


TgdxValues

TgdxValues
Unit: gxdefs
TgdxValues = array[TgdxDataSize] of double;
Unit
gxdefs
Description
Array type for passing values


Constants

Constants
These are all constants that are contained in this documentation.


DataTypSize

DataTypSize
Unit: gxfile
DataTypSize: array[TgdxDataType] of integer  = (1,1,5,5);
Unit
gxfile
Description
USER Errors


DOMC_EXPAND

DOMC_EXPAND
Unit: gxdefs
DOMC_EXPAND = -1;
Unit
gxdefs
Description
Indicator for a growing index position


DOMC_STRICT

DOMC_STRICT
Unit: gxdefs
DOMC_STRICT = 0;
Unit
gxdefs
Description
Indicator for a mapped index position


DOMC_UNMAPPED

DOMC_UNMAPPED
Unit: gxdefs
DOMC_UNMAPPED = -2;
Unit
gxdefs
Description
Indicator for an unmapped index position


fmode_str

fmode_str
Unit: gxfile
fmode_str: array[TgxFileMode] of string[12]  = ( 'FileNotOpen' , 'ReadCommand' , 'WriteCommand' , 'Write-Raw' , 'Write-Map' , 'Write-Str' , 'Regis-Raw' , 'Regis-Map' , 'Regis-Str' , 'Read-Raw' , 'Read-Map' , 'Read-Str' , 'Regis-Filter' );
Unit
gxfile
Description
fr_filter


GDXHeaderNr

GDXHeaderNr
Unit: gxfile
GDXHeaderNr = 123;
Unit
gxfile
Description
patterns to recognize


gdxMAXDATASIZE

gdxMAXDATASIZE
Unit: gxdefs
gdxMAXDATASIZE = 5;
Unit
gxdefs
Description
Only used to declare Values array


gdxMAXDIM

gdxMAXDIM
Unit: gxdefs
gdxMAXDIM = 10;
Unit
gxdefs
Description
Based on GAMS max dimensions


gdxMaxNameLen

gdxMaxNameLen
Unit: gxdefs
gdxMaxNameLen = 31;
Unit
gxdefs
Description
Based on GAMS max namelen


SYSVER

SYSVER
Unit: gxfile
SYSVER = '_GAMS_GDX_V225_2002-05-20';
Unit
gxfile
Description
used for file and dll version stuff for license information


VERSION

VERSION
Unit: gxfile
VERSION = 5;
Unit
gxfile
Description
file version


Files

Files
These are all files that are contained in this documentation.


gdxio.dpr

gdxio.dpr
Functions
This unit is the main source for building the GDXIO.DLL . It relies heavily on gxfile.pas which implements the actual GDX object


gxdefs.pas

gxdefs.pas
Classes, Types, Constants
used by gxfile.pas and any program needing the constants and types for using the gdxio.dll


gxfile.pas

gxfile.pas
Classes, Functions, Constants
This unit defines the GDX Object as a Delphi object. This unit is used by GDXIO.DPR which is used to build the GDXIO.DLL


GDX GAMS Data Exchange

GDX GAMS Data Exchange
GDX GAMS Data Exchange
The following topics belong to this group:
Writing data to a GDX file
Reading data from a GDX file
Functions by Category
Transition diagram
Example programs


Writing data to a GDX file

Writing data to a GDX file
Writing data to a GDX file
The following topics belong to this group:
Writing data using strings
Writing data using integers (Raw)
Writing data using integers (Mapped)


Reading data from a GDX file

Reading data from a GDX file
Reading data from a GDX file
The following topics belong to this group:
Reading data using strings
Reading data using integers (Raw)
Reading data using integers (Mapped)
Reading data using a filter


Functions by Category

Functions by Category
Functions by Category
The following topics belong to this group:


Transition diagram

Transition diagram
Transition diagram
The following topics belong to this group:


Example programs

Example programs
Example programs
The following topics belong to this group:
Example 1


Example 1

Example 1
Example 1
The following topics belong to this group:
Example 1 in Delphi
Example 1 in C


Class Hierarchy

Class Hierarchy
TMiBufferedStream
|
TGXFile


TGXFile Members

TGXFile Members
TGXFile | Legend

Methods
AddSetText

DataErrorCount

DataErrorRecord

DataReadDone

DataReadFilteredStart

DataReadMap

DataReadMapStart

DataReadRaw

DataReadRawStart

DataReadStr

DataReadStrStart

DataWriteDone

DataWriteMap

DataWriteMapStart

DataWriteRaw

DataWriteRawStart

DataWriteStr

DataWriteStrStart

virtual Destroy

ErrorCount

FileVersion

FilterExists

FilterRegister

FilterRegisterDone

FilterRegisterStart

FindSymbol

GetElemText

GetLastError

GetSpecialValues

GetUEL

MapValue

OpenRead

OpenWrite

ResetSpecialValues

SetHasText

SetSpecialValues

SetTextNodeNr

SetTraceLevel

SymbolInfo

SymbolInfoX

SystemInfo

UELRegisterDone

UELRegisterMap

UELRegisterMapStart

UELRegisterRaw

UELRegisterRawStart

UELRegisterStr

UELRegisterStrStart

UMFindUEL

UMUelGet

UMUelInfo


TGXFile Methods

TGXFile Methods
TGXFile | Legend

TGXFile
AddSetText

DataErrorCount

DataErrorRecord

DataReadDone

DataReadFilteredStart

DataReadMap

DataReadMapStart

DataReadRaw

DataReadRawStart

DataReadStr

DataReadStrStart

DataWriteDone

DataWriteMap

DataWriteMapStart

DataWriteRaw

DataWriteRawStart

DataWriteStr

DataWriteStrStart

virtual Destroy

ErrorCount

FileVersion

FilterExists

FilterRegister

FilterRegisterDone

FilterRegisterStart

FindSymbol

GetElemText

GetLastError

GetSpecialValues

GetUEL

MapValue

OpenRead

OpenWrite

ResetSpecialValues

SetHasText

SetSpecialValues

SetTextNodeNr

SetTraceLevel

SymbolInfo

SymbolInfoX

SystemInfo

UELRegisterDone

UELRegisterMap

UELRegisterMapStart

UELRegisterRaw

UELRegisterRawStart

UELRegisterStr

UELRegisterStrStart

UMFindUEL

UMUelGet

UMUelInfo


Example

Example
TGXFile.DataReadStrStart
if DataReadStrStart(PGX,1,NrRecs)

then

begin

while DataReadStr(PGX,Uels,Vals)

do [...]

DataReadDone(PGX)

end;


Example

Example
TGXFile.OpenRead
  var
     ErrNr: integer;
     PGX  : PGXFile;
  begin
  ErrNr := GDXOpenRead(PGX,'c:\mydata\file1.gdx');
  if ErrNr <> 0
  then
     begin
     [...]


Example

Example
TGXFile.OpenWrite
  var
     ErrNr: integer;
     PGX  : PGXFile;
  begin
  ErrCode := GDXOpenWrite(PGX,'c:\mydata\file1.gdx','Examples');
  if ErrCode <> 0
  then
     [ ... ]


TGXFile Fields

TGXFile Fields
TGXFile


TGXFile Properties

TGXFile Properties
TGXFile


TGXFile Events

TGXFile Events
TGXFile


TGXFile

Legend
virtual virtual


TGXFile Friends

TGXFile Friends
TGXFile


TGXFile Types

TGXFile Types
TGXFile


Example

Example
GDXDataReadStrStart
if DataReadStrStart(PGX,1,NrRecs)

then

begin

while DataReadStr(PGX,Uels,Vals)

do [...]

DataReadDone(PGX)

end;


Example

Example
GDXOpenRead
  var
     ErrNr: integer;
     PGX  : PGXFile;
  begin
  ErrNr := GDXOpenRead(PGX,'c:\mydata\file1.gdx');
  if ErrNr <> 0
  then
     begin
     [...]


Example

Example
GDXOpenWrite
  var
     ErrNr: integer;
     PGX  : PGXFile;
  begin
  ErrCode := GDXOpenWrite(PGX,'c:\mydata\file1.gdx','Examples');
  if ErrCode <> 0
  then
     [ ... ]


Unit Overview

Unit Overview
gdxio
Functions in Unit gdxio
GDXAddSetText
Register a string to be used as text associated with a unique element
GDXClose
Close a GDX file
GDXDataErrorCount
The number of error records
GDXDataErrorRecord
Retrieve an error record
GDXDataReadDone
Finish reading of a symbol in any mode(raw, mapped, string)
GDXDataReadFilteredStart
Initialize the reading of a symbol in filtered mode
GDXDataReadMap
Read the next record in mapped mode
GDXDataReadMapStart
Initialize the reading of a symbol in mapped mode
GDXDataReadRaw
Read the next record in raw mode
GDXDataReadRawStart
Initialize the reading of a symbol in raw mode
GDXDataReadStr
Read the next record in string mode
GDXDataReadStrStart
Initialize the reading of a symbol in string mode
GDXDataWriteDone
Finish a write operation
GDXDataWriteMap
Write a data element in mapped mode
GDXDataWriteMapStart
Start writing a new symbol in mapped mode
GDXDataWriteRaw
Write a data element in raw mode
GDXDataWriteRawStart
Start writing a new symbol in raw mode
GDXDataWriteStr
Write a data element in string mode
GDXDataWriteStrStart
Start writing a new symbol in string mode
GDXDLLVersion
Return string for library version
GDXErrorCount
Returns the number of errors
GDXErrorStr
Return string for an error number
GDXFileVersion
Return strings for file version and file producer
GDXFilterExists
Check if there is a filter defined based on its number
GDXFilterRegister
Add a unique element to the current filter definition
GDXFilterRegisterDone
Finish registration of unique elements for a filter
GDXFilterRegisterStart
Define a unique element filter
GDXFindSymbol
Find symbol by name
GDXGetElemText
Retrieve the string and node number for an entry in the string table
GDXGetLastError
Return the last error
GDXGetSpecialValues
Retrieve the internal values for special values
GDXGetUEL
Get the string for a unique element using a mapped index
GDXMapValue
Classify a value as a potential special value
GDXOpenRead
Open a GDX file for reading
GDXOpenWrite
Create a GDX file for writing
GDXResetSpecialValues
Reset the internal values for special values
GDXSetHasText
Test if any of the unique elements in a set has associated text
GDXSetSpecialValues
Set the internal values for special values
GDXSetTextNodeNr
Set the Node number for an entry in the string table
GDXSetTraceLevel
Set the amount of trace (debug) information generated
GDXSymbolInfo
Returns information about a symbol
GDXSymbolInfoX
Returns additional information about a symbol
GDXSystemInfo
Returns the number of symbols and unique elements
GDXUELRegisterAll
This function is now obsolete
GDXUELRegisterDone
Finish registration of unique elements
GDXUELRegisterMap
Register an unique elements in mapped mode
GDXUELRegisterMapStart
Start registering unique elements in mapped mode
GDXUELRegisterNone
This function is now obsolete
GDXUELRegisterRaw
Register an unique elements in raw mode
GDXUELRegisterRawStart
Start registering unique elements in raw mode
GDXUELRegisterStr
Register an unique elements in string mode
GDXUELRegisterStrStart
Start registering unique elements in string mode
GDXUMFindUEL
Search for unique element by its string
GDXUMUelGet
Get a unique element using an unmapped index
GDXUMUelInfo
Return information about the unique elements


Unit Overview

Unit Overview
gxdefs
Classes in Unit gxdefs
TgdxDataType
Enumerated type for GAMS data types
TgdxSpecialValue
Enumerated type for special values


Unit Overview

Unit Overview
gxdefs
Types in Unit gxdefs
PGXFile
TgdxDataSize
TgdxDimension
TgdxNameStr
TgdxStrIndex
TgdxSVals
TgdxUELIndex
TgdxValues


Unit Overview

Unit Overview
gxdefs
Constants in Unit gxdefs
DOMC_EXPAND
DOMC_STRICT
DOMC_UNMAPPED
gdxMAXDATASIZE
gdxMAXDIM
gdxMaxNameLen


Unit Overview

Unit Overview
gxfile
Classes in Unit gxfile
TGXFile


Unit Overview

Unit Overview
gxfile
Functions in Unit gxfile
GetDLLVersion
Get version string from DLL


Unit Overview

Unit Overview
gxfile
Constants in Unit gxfile
DataTypSize
fmode_str
GDXHeaderNr
SYSVER
VERSION


Related Topic Groups

Related Topic Groups

Example programs -> Topics


Related Topic Groups

Related Topic Groups

GDX GAMS Data Exchange -> Topics


Related Topic Groups

Related Topic Groups

Example 1 -> Topics


Related Topic Groups

Related Topic Groups

Reading data from a GDX file -> Topics


Related Topic Groups

Related Topic Groups

Writing data to a GDX file -> Topics


Content

Content
This is the table of contents of this documentation.
GDX GAMS Data Exchange
Writing data to a GDX file
Writing data using strings
Writing data using integers (Raw)
Writing data using integers (Mapped)
Reading data from a GDX file
Reading data using strings
Reading data using integers (Raw)
Reading data using integers (Mapped)
Reading data using a filter
Functions by Category
Transition diagram
Example programs
Example 1
Example 1 in Delphi
Example 1 in C


Index

Index
These are all topics and symbols available in this documentation.
C | D | E | F | G | P | R | S | T | V | W
C
Classes
Constants
D
DataTypSize
DOMC_EXPAND
DOMC_STRICT
DOMC_UNMAPPED
E
Example 1
Example 1 in C
Example 1 in Delphi
Example programs
F
Files
fmode_str
Functions
Functions by Category
G
GDX GAMS Data Exchange
GDXAddSetText
GDXClose
GDXDataErrorCount
GDXDataErrorRecord
GDXDataReadDone
GDXDataReadFilteredStart
GDXDataReadMap
GDXDataReadMapStart
GDXDataReadRaw
GDXDataReadRawStart
GDXDataReadStr
GDXDataReadStrStart
GDXDataWriteDone
GDXDataWriteMap
GDXDataWriteMapStart
GDXDataWriteRaw
GDXDataWriteRawStart
GDXDataWriteStr
GDXDataWriteStrStart
GDXDLLVersion
GDXErrorCount
GDXErrorStr
GDXFileVersion
GDXFilterExists
GDXFilterRegister
GDXFilterRegisterDone
GDXFilterRegisterStart
GDXFindSymbol
GDXGetElemText
GDXGetLastError
GDXGetSpecialValues
GDXGetUEL
GDXHeaderNr
gdxio.dpr
GDXMapValue
gdxMAXDATASIZE
gdxMAXDIM
gdxMaxNameLen
GDXOpenRead
GDXOpenWrite
GDXResetSpecialValues
GDXSetHasText
GDXSetSpecialValues
GDXSetTextNodeNr
GDXSetTraceLevel
GDXSymbolInfo
GDXSymbolInfoX
GDXSystemInfo
GDXUELRegisterAll
GDXUELRegisterDone
GDXUELRegisterMap
GDXUELRegisterMapStart
GDXUELRegisterNone
GDXUELRegisterRaw
GDXUELRegisterRawStart
GDXUELRegisterStr
GDXUELRegisterStrStart
GDXUMFindUEL
GDXUMUelGet
GDXUMUelInfo
GetDLLVersion
gxdefs.pas
gxfile.pas
P
PGXFile
R
Reading data from a GDX file
Reading data using a filter
Reading data using integers (Mapped)
Reading data using integers (Raw)
Reading data using strings
S
Structs and Records
SYSVER
T
TgdxDataSize
TgdxDataType
TgdxDimension
TgdxNameStr
TgdxSpecialValue
TgdxStrIndex
TgdxSVals
TgdxUELIndex
TgdxValues
TGXFile
Transition diagram
Types
V
VERSION
W
Writing data to a GDX file
Writing data using integers (Mapped)
Writing data using integers (Raw)
Writing data using strings