GDX (GDX) API Documentation

Generated for GAMS 24.9.2

Functions, Procedures and Properties

gdxAcronymAdd
Add a new acronym entry. This can be used to add entries before data is written. =<0 if the entry is not added.
gdxAcronymCount
Number of entries in the acronym table.
gdxAcronymGetInfo
Retrieve acronym information from the acronym table. <>0 if the index into the acronym table is valid.
gdxAcronymGetMapping
Get information how acronym values are remapped. When reading gdx data, we need to map indices for acronyms used in the gdx file to indices used by the reading program. <>0 if the index into the acronym table is valid.
gdxAcronymIndex
Get index value of an acronym. 0 if V does not represent an acronym.
gdxAcronymName
Find the name of an acronym value. <>0 if a name for the acronym is defined. An unnamed acronym value will return a string of the form UnknownAcronymNNN, were NNN is the index of the acronym.
gdxAcronymNextNr
Returns the value of the NextAutoAcronym variable and sets the variable to NV. When we read from a gdx file and encounter an acronym that was not defined, we need to assign a new index for that acronym. That index is the variable NextAutoAcronym.
gdxAcronymSetInfo
Modify acronym information in the acronym table. When reading (writing) a gdx file, this function is used to provide the acronym index (name of an acronym), the SyId (AIndx) parameter must match.
gdxAcronymValue
Create an acronym value based on the index (AIndx should be greater than 0). Returns the calculated acronym value (0 if AIndx =<0).
gdxAddAlias
Add an alias for a set to the symbol table. One of the two identifiers has to be a known set, the other identifier is used as the new alias. 0 if the operation is not possible.
gdxAddSetText
Register a string to be used as text associated with a unique element. The string must follow the GAMS syntax rules for explanatory text. 0 if the operation is not possible.
gdxAutoConvert
Returns the value of the AutoConvert variable and sets the variable to NV. If AutoConvert <>0 when closing a new gdx file we look at the GDXCOMPRESS and GDXCONVERT environment variables to determine if conversion to an older file format is desired.
gdxClose
Close a gdx file that was previously opened for reading or writing. Any pending write operations will be finished before closing
gdxDataErrorCount
The number of error records after a write operation is finished (gdxDataWriteDone).
gdxDataErrorRecord
Retrieve an error record. <>0 if the record number is valid.
gdxDataErrorRecordX
Retrieve an error record. <>0 if the record number is valid.
gdxDataReadDone
Finish reading of a symbol in any mode(raw, mapped, string). 0 if the operation is not possible.
gdxDataReadFilteredStart
Initialize the reading of a symbol in filtered mode. 0 if the operation is not possible.
gdxDataReadMap
Read the next record in mapped mode. 0 if the operation is not possible.
gdxDataReadMapStart
Initialize the reading of a symbol in mapped mode. 0 if the operation is not possible.
gdxDataReadRaw
Read the next record in raw mode. 0 if the operation is not possible.
gdxDataReadRawFast
Read a symbol in Raw mode using a callback procedure. 0 if the operation is not possible.
gdxDataReadRawFastFilt
Read a symbol in Raw mode while applying a filter using a callback procedure. 0 if the operation is not possible.
gdxDataReadRawStart
Initialize the reading of a symbol in raw mode. 0 if the operation is not possible.
gdxDataReadSlice
Read a slice of data from a data set, by fixing zero or more index positions in the data. When a data element is available, the callback procedure DP is called with the current index and the values. 0 if the operation is not possible.
gdxDataReadSliceStart
Prepare for the reading of a slice of data from a data set. The actual read of the data is done by calling gdxDataReadSlice. When finished reading, call gdxDataReadDone. 0 if the operation is not possible.
gdxDataReadStr
Read the next record using strings for the unique elements. The reading should be initialized by calling DataReadStrStart. 0 if the operation is not possible or if there is no more data.
gdxDataReadStrStart
Initialize the reading of a symbol in string mode. 0 if the operation is not possible.
gdxDataSliceUELS
Map a slice index into the corresponding unique elements. After calling DataReadSliceStart, index positions are mapped from 0 to N(d)-1. This function maps this index space back into unique elements (strings). 0 if the operation is not possible.
gdxDataWriteDone
Finish a write operation. 0 if the operation is not possible.
gdxDataWriteMap
Write a data element in mapped mode. 0 if the operation is not possible.
gdxDataWriteMapStart
Start writing a new symbol in mapped mode. 0 if the operation is not possible.
gdxDataWriteRaw
Write a data element in raw mode. 0 if the operation is not possible.
gdxDataWriteRawStart
Start writing a new symbol in raw mode. 0 if the operation is not possible.
gdxDataWriteStr
Write a data element in string mode. Each element string must follow the GAMS rules for unique elements. 0 if the operation is not possible.
gdxDataWriteStrStart
Start writing a new symbol in string mode. 0 if the operation is not possible.
gdxGetDLLVersion
Returns a version descriptor of the library. Always nonzero
gdxErrorCount
Total number of errors encountered.
gdxErrorStr
Returns the text for a given error number. Always nonzero.
gdxFileInfo
Returns file format number and compression level used. Always nonzero.
gdxFileVersion
Return strings for file version and file producer. Always nonzero.
gdxFilterExists
Check if there is a filter defined based on its number as used in gdxFilterRegisterStart. 0 if the operation is not possible.
gdxFilterRegister
Add a unique element to the current filter definition. 0 if the index number is out of range or was never mapped into the user index space.
gdxFilterRegisterDone
Finish registration of unique elements for a filter. 0 if the operation is not possible.
gdxFilterRegisterStart
Define a unique element filter. 0 if the operation is not possible.
gdxFindSymbol
Search for a symbol by name (case insensitive). When the symbol is found, SyNr contains the symbol number and the function returns a nonzero, else it returns 0.
gdxGetElemText
Retrieve the string and node number for an entry in the string table. 0 if the operation is not possible.
gdxGetLastError
Returns the last error number or 0 if there was no error. Calling this function will clear the last error stored.
gdxGetMemoryUsed
Get memory in use by gdx object.
gdxGetSpecialValues
Retrieve the internal values for special values. Always nonzero.
gdxGetUEL
Get the string for a unique element using a mapped index. 0 if the operation is not possible.
gdxMapValue
Classify a value as a potential special value. Nonzero if D is a special value, 0 otherwise.
gdxOpenAppend
Open an existing gdx file for output. Nonzero if the file can be opened, 0 otherwise.
gdxOpenRead
Open an existing gdx file for input. Nonzero if the file can be opened, 0 otherwise.
gdxOpenWrite
Open a new gdx file for output. Nonzero if the file can be opened, 0 otherwise.
gdxOpenWriteEx
Open a new gdx file for output with optional compression. Nonzero if the file can be opened, 0 otherwise.
gdxResetSpecialValues
Reset the internal values for special values. Always nonzero.
gdxSetHasText
Test if any of the unique elements in a set has associated text. Nonzero if the Set contains at least one unique element that has associated text, 0 otherwise
gdxSetReadSpecialValues
Set internal values for special values when reading a gdx file. Before calling this function, initialize the array of special values by calling gdxGetSpecialValues first. Always nonzero
gdxSetSpecialValues
Set internal values for special values. Before calling this function, initialize the array of special values by calling gdxGetSpecialValues first. Note: values in AVals have to be unique. Nonzero if all values specified are unique, 0 otherwise.
gdxSetTextNodeNr
Set the Node number for an entry with Index N in the string table. After registering a string with AddSetText, we can assign a node number for later retrieval. 0 if the operation is not possible.
gdxSetTraceLevel
Set the amount of trace (debug) information generated. Always nonzero.
gdxSymbIndxMaxLength
Returns the length of the longest UEL used for every index position for a given symbol.
gdxSymbMaxLength
Returns the length of the longest symbol name.
gdxSymbolAddComment
Add a line of comment text for a symbol. 0 if the operation is not possible.
gdxSymbolGetComment
Retrieve a line of comment text for a symbol. 0 if the operation is not possible.
gdxSymbolGetDomain
Retrieve the domain of a symbol. 0 if the operation is not possible.
gdxSymbolGetDomainX
Retrieve the domain of a symbol (Relaxed version). 0 if the operation is not possible.
gdxSymbolDim
Retrieve dimension of a symbol.
gdxSymbolInfo
Returns information about a symbol. 0 if the symbol number is out of range, nonzero otherwise.
gdxSymbolInfoX
Returns additional information about a symbol. 0 if the symbol number is out of range, nonzero otherwise.
gdxSymbolSetDomain
Define the domain of the symbol for which a write data operation just started using DataWriteRawStart, DataWriteMapStart or DataWriteStrStart. 0 if the operation is not possible.
gdxSymbolSetDomainX
Define the domain of symbol SyNr (Relaxed version). 0 if the operation is not possible.
gdxSystemInfo
Returns the number of symbols and unique elements. Always nonzero.
gdxUELMaxLength
Returns the length of the longest UEL name.
gdxUELRegisterDone
Finish registration of unique elements. 0 if the operation is not possible.
gdxUELRegisterMap
Register a unique element in mapped mode. A unique element must follow the GAMS rules when it contains quote characters. 0 if the operation is not possible.
gdxUELRegisterMapStart
Start registering unique elements in mapped mode. 0 if the operation is not possible.
gdxUELRegisterRaw
Register a unique element in raw mode. This can only be used while writing to a gdx file. 0 if the operation is not possible.
gdxUELRegisterRawStart
Start registering unique elements in raw mode. 0 if the operation is not possible.
gdxUELRegisterStr
Register a unique element in string mode. A unique element must follow the GAMS rules when it contains quote characters. Nonzero if the element was registered, zero otherwise.
gdxUELRegisterStrStart
Start registering unique elements in string mode. 0 if the operation is not possible.
gdxUMFindUEL
Search for a unique element by its string. Nonzero if the element was found, 0 otherwise.
gdxUMUelGet
Get a unique element using an unmapped index. 0 if the operation is not possible.
gdxUMUelInfo
Returns information about the unique elements. Always nonzero.
gdxGetDomainElements
Get the unique elements for a given dimension of a given symbol.
gdxCurrentDim
Returns the dimension of the current active symbol. When reading or writing data, the dimension of the current active symbol is sometimes needed to convert arguments from strings to pchars etc.
gdxRenameUEL
Rename a previously known unique element.

Arguments

AIndx
Index value of the acronym
AName
Name of the acronym
autoIndex
Nonzero if the newIndx was generated using the value of NextAutoAcronym
AVals
Array of special values used for Eps, +Inf, -Inf, NA and Undef
Compr
Zero for no compression; nonzero uses compression if available
ComprLev
Compression used; 0=no compression, 1=zlib
D
Value to classify
Dimen
Dimension of the symbol/index space; index space means the number of index positions that is not fixed (gdxDataReadSlice)
DimFrst
The first index position in KeyInt that changed
DomainIDs
Array containing the set identifiers or * of the domain for the corresponding index position
DomainSyNrs
Array containing the index numbers of the one dimensional set or alias used as the domain for corresponding index position. A value of zero represents the universe (*)
DP
Callback procedure that will be called for each item
ElemCounts
Array of integers, each position indicating the number of unique indices in that position
ErrMsg
Error text
ErrNr
Error number (gdxErrorStr)/Error code or zero if there is no error
ExplTxt
Explanatory text for the symbol
FileName
File name of the gdx file to be opened
FileStr
Version string
FileVer
File format number or zero if the file is not open
FilterAction
Array of filter actions for each index position
FilterNr
Filter number
HighMap
Highest user mapping index used
Id1
Set identifier
Id2
Set identifier
KeyInt
Index of the record/element
KeyStr
The index of the record or element using strings for the unique elements/Array of strings containing the unique elements (gdxDataSliceUELS)
LengthInfo
The longest length for each index position
N
Index number/Tracing level, N=<0 no tracing N>=3 maximum tracing (gdxSetTraceLevel)/Line number (gdxSymbolGetComment)
newIndx
The Index returned when reading gdx data
NewName
New name of the UEL
Node
Node number of the entry (gdxGetElemText)/New Node value for the entry (gdxSetTextNodeNr)
NrRecs
The maximum number of records available for reading. The actual number of records may be less when a filter is applied to the records read.
NV
New value
OldName
Name of an existing UEL
orgIndx
The Index used in the gdx file
Producer
Name of program that appends to/creates the gdx file
ProduceStr
Producer string
RecCnt
Total number of records stored (unmapped)
RecNr
The number of the record to be retrieved, range from 1 to NrErrorRecords; this argument is ignored in gdxDataReadMap
result
Result/Return code of function
s
String to be included in trace output(gdxSetTraceLevel)
SliceKeyInt
The slice index to be mapped to strings
sv
Classification
SyCnt
Number of symbols available in the gdx file
SyId
Name of the acronym/symbol; might be an empty string at gdxAcronymName
SyNr
The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
Txt
Explanatory text of the acronym (gdxAcronym...)/String to be registered(gdxAddSetText)/Text found for the entry (gdxGetElemText)/String to add (gdxSymbolAddComment)/String containing requested line(gdxSymbolGetComment)
TxtNr
The index number assigned to this string (gdxAddSetText)/String table index (gdxGetElemText)/Index number of the entry to be modified (gdxSetTextNodeNr)
Typ
Type of the symbol
Uel
String for the unique element
UelCnt
Number of unique elements
UelFilterStr
Each index can be fixed by setting the string for the unique element. Set an index position to the empty string in order not to fix that position.
UelMap
Unique element number in the user index space or -1 if element was never mapped
UelNr
Internal unique element number or -1 if not found
UMap
User index number to be assigned to the unique element, -1 if not found or the element was never mapped
UserInfo
Any integer value/User field value (gdxSymbolInfoX)
V
Input value, possibly representing an acronym/Version string after return (gdxGetDLLVersion)
Values
Values of the element (gdxDataWrite...)/Data of the record (gdxDataRead..., gdxDataErrorRecord)

Calling Sequences

gdxAcronymAdd

  • Add a new acronym entry. This can be used to add entries before data is written. =<0 if the entry is not added.
  • Function returns Integer
  • Arguments:
    • const AName : ShortString
      Name of the acronym
      const Txt : ShortString
      Explanatory text of the acronym (gdxAcronym...)/String to be registered(gdxAddSetText)/Text found for the entry (gdxGetElemText)/String to add (gdxSymbolAddComment)/String containing requested line(gdxSymbolGetComment)
      AIndx : Integer
      Index value of the acronym

gdxAcronymCount

  • Number of entries in the acronym table.
  • Function returns Integer

gdxAcronymGetInfo

  • Retrieve acronym information from the acronym table. <>0 if the index into the acronym table is valid.
  • Function returns Integer
  • Arguments:
    • N : Integer
      Index number/Tracing level, N=<0 no tracing N>=3 maximum tracing (gdxSetTraceLevel)/Line number (gdxSymbolGetComment)
      out AName : ShortString
      Name of the acronym
      out Txt : ShortString
      Explanatory text of the acronym (gdxAcronym...)/String to be registered(gdxAddSetText)/Text found for the entry (gdxGetElemText)/String to add (gdxSymbolAddComment)/String containing requested line(gdxSymbolGetComment)
      out AIndx : Integer
      Index value of the acronym

gdxAcronymGetMapping

  • Get information how acronym values are remapped. When reading gdx data, we need to map indices for acronyms used in the gdx file to indices used by the reading program. <>0 if the index into the acronym table is valid.
  • Function returns Integer
  • Arguments:
    • N : Integer
      Index number/Tracing level, N=<0 no tracing N>=3 maximum tracing (gdxSetTraceLevel)/Line number (gdxSymbolGetComment)
      out orgIndx : Integer
      The Index used in the gdx file
      out newIndx : Integer
      The Index returned when reading gdx data
      out autoIndex : Integer
      Nonzero if the newIndx was generated using the value of NextAutoAcronym

gdxAcronymIndex

  • Get index value of an acronym. 0 if V does not represent an acronym.
  • Function returns Integer
  • Arguments:
    • V : Double
      Input value, possibly representing an acronym/Version string after return (gdxGetDLLVersion)

gdxAcronymName

  • Find the name of an acronym value. <>0 if a name for the acronym is defined. An unnamed acronym value will return a string of the form UnknownAcronymNNN, were NNN is the index of the acronym.
  • Function returns Integer
  • Arguments:
    • V : Double
      Input value, possibly representing an acronym/Version string after return (gdxGetDLLVersion)
      out AName : ShortString
      Name of the acronym

gdxAcronymNextNr

  • Returns the value of the NextAutoAcronym variable and sets the variable to NV. When we read from a gdx file and encounter an acronym that was not defined, we need to assign a new index for that acronym. That index is the variable NextAutoAcronym.
  • Function returns Integer
  • Arguments:
    • NV : Integer
      New value

gdxAcronymSetInfo

  • Modify acronym information in the acronym table. When reading (writing) a gdx file, this function is used to provide the acronym index (name of an acronym), the SyId (AIndx) parameter must match.
  • Function returns Integer
  • Arguments:
    • N : Integer
      Index number/Tracing level, N=<0 no tracing N>=3 maximum tracing (gdxSetTraceLevel)/Line number (gdxSymbolGetComment)
      const AName : ShortString
      Name of the acronym
      const Txt : ShortString
      Explanatory text of the acronym (gdxAcronym...)/String to be registered(gdxAddSetText)/Text found for the entry (gdxGetElemText)/String to add (gdxSymbolAddComment)/String containing requested line(gdxSymbolGetComment)
      AIndx : Integer
      Index value of the acronym

gdxAcronymValue

  • Create an acronym value based on the index (AIndx should be greater than 0). Returns the calculated acronym value (0 if AIndx =<0).
  • Function returns Double
  • Arguments:
    • AIndx : Integer
      Index value of the acronym

gdxAddAlias

  • Add an alias for a set to the symbol table. One of the two identifiers has to be a known set, the other identifier is used as the new alias. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • const Id1 : ShortString
      Set identifier
      const Id2 : ShortString
      Set identifier

gdxAddSetText

  • Register a string to be used as text associated with a unique element. The string must follow the GAMS syntax rules for explanatory text. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • const Txt : ShortString
      Explanatory text of the acronym (gdxAcronym...)/String to be registered(gdxAddSetText)/Text found for the entry (gdxGetElemText)/String to add (gdxSymbolAddComment)/String containing requested line(gdxSymbolGetComment)
      out TxtNr : Integer
      The index number assigned to this string (gdxAddSetText)/String table index (gdxGetElemText)/Index number of the entry to be modified (gdxSetTextNodeNr)

gdxAutoConvert

  • Returns the value of the AutoConvert variable and sets the variable to NV. If AutoConvert <>0 when closing a new gdx file we look at the GDXCOMPRESS and GDXCONVERT environment variables to determine if conversion to an older file format is desired.
  • Function returns Integer
  • Arguments:
    • NV : Integer
      New value

gdxClose

  • Close a gdx file that was previously opened for reading or writing. Any pending write operations will be finished before closing
  • Function returns Integer

gdxCurrentDim

  • Returns the dimension of the current active symbol. When reading or writing data, the dimension of the current active symbol is sometimes needed to convert arguments from strings to pchars etc.
  • Function returns Integer

gdxDataErrorCount

  • The number of error records after a write operation is finished (gdxDataWriteDone).
  • Function returns Integer

gdxDataErrorRecord

  • Retrieve an error record. <>0 if the record number is valid.
  • Function returns Integer
  • Arguments:
    • RecNr : Integer
      The number of the record to be retrieved, range from 1 to NrErrorRecords; this argument is ignored in gdxDataReadMap
      var KeyInt : TgdxUELIndex
      Index of the record/element
      var Values : TgdxValues
      Values of the element (gdxDataWrite...)/Data of the record (gdxDataRead..., gdxDataErrorRecord)

gdxDataErrorRecordX

  • Retrieve an error record. <>0 if the record number is valid.
  • Function returns Integer
  • Arguments:
    • RecNr : Integer
      The number of the record to be retrieved, range from 1 to NrErrorRecords; this argument is ignored in gdxDataReadMap
      var KeyInt : TgdxUELIndex
      Index of the record/element
      var Values : TgdxValues
      Values of the element (gdxDataWrite...)/Data of the record (gdxDataRead..., gdxDataErrorRecord)

gdxDataReadDone

  • Finish reading of a symbol in any mode(raw, mapped, string). 0 if the operation is not possible.
  • Function returns Integer

gdxDataReadFilteredStart

  • Initialize the reading of a symbol in filtered mode. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      const FilterAction: TgdxUELIndex
      Array of filter actions for each index position
      out NrRecs : Integer
      The maximum number of records available for reading. The actual number of records may be less when a filter is applied to the records read.

gdxDataReadMap

  • Read the next record in mapped mode. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • RecNr : Integer
      The number of the record to be retrieved, range from 1 to NrErrorRecords; this argument is ignored in gdxDataReadMap
      var KeyInt : TgdxUELIndex
      Index of the record/element
      var Values : TgdxValues
      Values of the element (gdxDataWrite...)/Data of the record (gdxDataRead..., gdxDataErrorRecord)
      out DimFrst : Integer
      The first index position in KeyInt that changed

gdxDataReadMapStart

  • Initialize the reading of a symbol in mapped mode. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      out NrRecs : Integer
      The maximum number of records available for reading. The actual number of records may be less when a filter is applied to the records read.

gdxDataReadRaw

  • Read the next record in raw mode. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • var KeyInt : TgdxUELIndex
      Index of the record/element
      var Values : TgdxValues
      Values of the element (gdxDataWrite...)/Data of the record (gdxDataRead..., gdxDataErrorRecord)
      out DimFrst : Integer
      The first index position in KeyInt that changed

gdxDataReadRawFast

  • Read a symbol in Raw mode using a callback procedure. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      DP : TDataStoreProc
      Callback procedure that will be called for each item Procedure(const Indx:TgdxUELIndex, const Vals:TgdxValues)
      out NrRecs : Integer
      The maximum number of records available for reading. The actual number of records may be less when a filter is applied to the records read.

gdxDataReadRawFastFilt

  • Read a symbol in Raw mode while applying a filter using a callback procedure. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      const UelFilterStr: TgdxStrIndex
      Each index can be fixed by setting the string for the unique element. Set an index position to the empty string in order not to fix that position.
      DP : TDataStoreFiltProc
      Callback procedure that will be called for each item Function(const Indx:TgdxUELIndex, const Vals:TgdxValues, Uptr:Pointer) returns Integer

gdxDataReadRawStart

  • Initialize the reading of a symbol in raw mode. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      out NrRecs : Integer
      The maximum number of records available for reading. The actual number of records may be less when a filter is applied to the records read.

gdxDataReadSlice

  • Read a slice of data from a data set, by fixing zero or more index positions in the data. When a data element is available, the callback procedure DP is called with the current index and the values. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • const UelFilterStr: TgdxStrIndex
      Each index can be fixed by setting the string for the unique element. Set an index position to the empty string in order not to fix that position.
      out Dimen : Integer
      Dimension of the symbol/index space; index space means the number of index positions that is not fixed (gdxDataReadSlice)
      DP : TDataStoreProc
      Callback procedure that will be called for each item Procedure(const Indx:TgdxUELIndex, const Vals:TgdxValues)

gdxDataReadSliceStart

  • Prepare for the reading of a slice of data from a data set. The actual read of the data is done by calling gdxDataReadSlice. When finished reading, call gdxDataReadDone. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      var ElemCounts : TgdxUELIndex
      Array of integers, each position indicating the number of unique indices in that position

gdxDataReadStr

  • Read the next record using strings for the unique elements. The reading should be initialized by calling DataReadStrStart. 0 if the operation is not possible or if there is no more data.
  • Function returns Integer
  • Arguments:
    • out KeyStr : TgdxStrIndex
      The index of the record or element using strings for the unique elements/Array of strings containing the unique elements (gdxDataSliceUELS)
      var Values : TgdxValues
      Values of the element (gdxDataWrite...)/Data of the record (gdxDataRead..., gdxDataErrorRecord)
      out DimFrst : Integer
      The first index position in KeyInt that changed

gdxDataReadStrStart

  • Initialize the reading of a symbol in string mode. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      out NrRecs : Integer
      The maximum number of records available for reading. The actual number of records may be less when a filter is applied to the records read.

gdxDataSliceUELS

  • Map a slice index into the corresponding unique elements. After calling DataReadSliceStart, index positions are mapped from 0 to N(d)-1. This function maps this index space back into unique elements (strings). 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • const SliceKeyInt : TgdxUELIndex
      The slice index to be mapped to strings
      out KeyStr : TgdxStrIndex
      The index of the record or element using strings for the unique elements/Array of strings containing the unique elements (gdxDataSliceUELS)

gdxDataWriteDone

  • Finish a write operation. 0 if the operation is not possible.
  • Function returns Integer

gdxDataWriteMap

  • Write a data element in mapped mode. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • const KeyInt : TgdxUELIndex
      Index of the record/element
      const Values : TgdxValues
      Values of the element (gdxDataWrite...)/Data of the record (gdxDataRead..., gdxDataErrorRecord)

gdxDataWriteMapStart

  • Start writing a new symbol in mapped mode. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • const SyId : ShortString
      Name of the acronym/symbol; might be an empty string at gdxAcronymName
      const ExplTxt : ShortString
      Explanatory text for the symbol
      Dimen : Integer
      Dimension of the symbol/index space; index space means the number of index positions that is not fixed (gdxDataReadSlice)
      Typ : Integer
      Type of the symbol
      UserInfo : Integer
      Any integer value/User field value (gdxSymbolInfoX)

gdxDataWriteRaw

  • Write a data element in raw mode. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • const KeyInt : TgdxUELIndex
      Index of the record/element
      const Values : TgdxValues
      Values of the element (gdxDataWrite...)/Data of the record (gdxDataRead..., gdxDataErrorRecord)

gdxDataWriteRawStart

  • Start writing a new symbol in raw mode. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • const SyId : ShortString
      Name of the acronym/symbol; might be an empty string at gdxAcronymName
      const ExplTxt : ShortString
      Explanatory text for the symbol
      Dimen : Integer
      Dimension of the symbol/index space; index space means the number of index positions that is not fixed (gdxDataReadSlice)
      Typ : Integer
      Type of the symbol
      UserInfo : Integer
      Any integer value/User field value (gdxSymbolInfoX)

gdxDataWriteStr

  • Write a data element in string mode. Each element string must follow the GAMS rules for unique elements. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • const KeyStr : TgdxStrIndex
      The index of the record or element using strings for the unique elements/Array of strings containing the unique elements (gdxDataSliceUELS)
      const Values : TgdxValues
      Values of the element (gdxDataWrite...)/Data of the record (gdxDataRead..., gdxDataErrorRecord)

gdxDataWriteStrStart

  • Start writing a new symbol in string mode. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • const SyId : ShortString
      Name of the acronym/symbol; might be an empty string at gdxAcronymName
      const ExplTxt : ShortString
      Explanatory text for the symbol
      Dimen : Integer
      Dimension of the symbol/index space; index space means the number of index positions that is not fixed (gdxDataReadSlice)
      Typ : Integer
      Type of the symbol
      UserInfo : Integer
      Any integer value/User field value (gdxSymbolInfoX)

gdxErrorCount

  • Total number of errors encountered.
  • Function returns Integer

gdxErrorStr

  • Returns the text for a given error number. Always nonzero.
  • Function returns Integer
  • Arguments:
    • ErrNr : Integer
      Error number (gdxErrorStr)/Error code or zero if there is no error
      out ErrMsg : ShortString
      Error text

gdxFileInfo

  • Returns file format number and compression level used. Always nonzero.
  • Function returns Integer
  • Arguments:
    • out FileVer : Integer
      File format number or zero if the file is not open
      out ComprLev : Integer
      Compression used; 0=no compression, 1=zlib

gdxFileVersion

  • Return strings for file version and file producer. Always nonzero.
  • Function returns Integer
  • Arguments:
    • out FileStr : ShortString
      Version string
      out ProduceStr : ShortString
      Producer string

gdxFilterExists

  • Check if there is a filter defined based on its number as used in gdxFilterRegisterStart. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • FilterNr : Integer
      Filter number

gdxFilterRegister

  • Add a unique element to the current filter definition. 0 if the index number is out of range or was never mapped into the user index space.
  • Function returns Integer
  • Arguments:
    • UelMap : Integer
      Unique element number in the user index space or -1 if element was never mapped

gdxFilterRegisterDone

  • Finish registration of unique elements for a filter. 0 if the operation is not possible.
  • Function returns Integer

gdxFilterRegisterStart

  • Define a unique element filter. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • FilterNr : Integer
      Filter number

gdxFindSymbol

  • Search for a symbol by name (case insensitive). When the symbol is found, SyNr contains the symbol number and the function returns a nonzero, else it returns 0.
  • Function returns Integer
  • Arguments:
    • const SyId : ShortString
      Name of the acronym/symbol; might be an empty string at gdxAcronymName
      out SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe

gdxGetDLLVersion

  • Returns a version descriptor of the library. Always nonzero
  • Function returns Integer
  • Arguments:
    • out V : ShortString
      Input value, possibly representing an acronym/Version string after return (gdxGetDLLVersion)

gdxGetDomainElements

  • Get the unique elements for a given dimension of a given symbol.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      DimPos : Integer
      FilterNr : Integer
      Filter number
      DP : TDomainIndexProc
      Callback procedure that will be called for each item Procedure(RawIndex:Integer, MappedIndex:Integer, Uptr:Pointer)
      out NrElem : Integer
      Uptr : Pointer

gdxGetElemText

  • Retrieve the string and node number for an entry in the string table. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • TxtNr : Integer
      The index number assigned to this string (gdxAddSetText)/String table index (gdxGetElemText)/Index number of the entry to be modified (gdxSetTextNodeNr)
      out Txt : ShortString
      Explanatory text of the acronym (gdxAcronym...)/String to be registered(gdxAddSetText)/Text found for the entry (gdxGetElemText)/String to add (gdxSymbolAddComment)/String containing requested line(gdxSymbolGetComment)
      out Node : Integer
      Node number of the entry (gdxGetElemText)/New Node value for the entry (gdxSetTextNodeNr)

gdxGetLastError

  • Returns the last error number or 0 if there was no error. Calling this function will clear the last error stored.
  • Function returns Integer

gdxGetMemoryUsed

  • Get memory in use by gdx object.
  • Function returns Int64

gdxGetSpecialValues

  • Retrieve the internal values for special values. Always nonzero.
  • Function returns Integer
  • Arguments:
    • var AVals : TgdxSVals
      Array of special values used for Eps, +Inf, -Inf, NA and Undef

gdxGetUEL

  • Get the string for a unique element using a mapped index. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • UelNr : Integer
      Internal unique element number or -1 if not found
      out Uel : ShortString
      String for the unique element

gdxMapValue

  • Classify a value as a potential special value. Nonzero if D is a special value, 0 otherwise.
  • Function returns Integer
  • Arguments:
    • D : Double
      Value to classify
      out sv : Integer
      Classification

gdxOpenAppend

  • Open an existing gdx file for output. Nonzero if the file can be opened, 0 otherwise.
  • Function returns Integer
  • Arguments:
    • const FileName : ShortString
      File name of the gdx file to be opened
      const Producer : ShortString
      Name of program that appends to/creates the gdx file
      out ErrNr : Integer
      Error number (gdxErrorStr)/Error code or zero if there is no error

gdxOpenRead

  • Open an existing gdx file for input. Nonzero if the file can be opened, 0 otherwise.
  • Function returns Integer
  • Arguments:
    • const FileName : ShortString
      File name of the gdx file to be opened
      out ErrNr : Integer
      Error number (gdxErrorStr)/Error code or zero if there is no error

gdxOpenWrite

  • Open a new gdx file for output. Nonzero if the file can be opened, 0 otherwise.
  • Function returns Integer
  • Arguments:
    • const FileName : ShortString
      File name of the gdx file to be opened
      const Producer : ShortString
      Name of program that appends to/creates the gdx file
      out ErrNr : Integer
      Error number (gdxErrorStr)/Error code or zero if there is no error

gdxOpenWriteEx

  • Open a new gdx file for output with optional compression. Nonzero if the file can be opened, 0 otherwise.
  • Function returns Integer
  • Arguments:
    • const FileName : ShortString
      File name of the gdx file to be opened
      const Producer : ShortString
      Name of program that appends to/creates the gdx file
      Compr : Integer
      Zero for no compression; nonzero uses compression if available
      out ErrNr : Integer
      Error number (gdxErrorStr)/Error code or zero if there is no error

gdxRenameUEL

  • Rename a previously known unique element.
  • Function returns Integer
  • Arguments:
    • const OldName : ShortString
      Name of an existing UEL
      const NewName : ShortString
      New name of the UEL

gdxResetSpecialValues

  • Reset the internal values for special values. Always nonzero.
  • Function returns Integer

gdxSetHasText

  • Test if any of the unique elements in a set has associated text. Nonzero if the Set contains at least one unique element that has associated text, 0 otherwise
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe

gdxSetReadSpecialValues

  • Set internal values for special values when reading a gdx file. Before calling this function, initialize the array of special values by calling gdxGetSpecialValues first. Always nonzero
  • Function returns Integer
  • Arguments:
    • const AVals : TgdxSVals
      Array of special values used for Eps, +Inf, -Inf, NA and Undef

gdxSetSpecialValues

  • Set internal values for special values. Before calling this function, initialize the array of special values by calling gdxGetSpecialValues first. Note: values in AVals have to be unique. Nonzero if all values specified are unique, 0 otherwise.
  • Function returns Integer
  • Arguments:
    • const AVals : TgdxSVals
      Array of special values used for Eps, +Inf, -Inf, NA and Undef

gdxSetTextNodeNr

  • Set the Node number for an entry with Index N in the string table. After registering a string with AddSetText, we can assign a node number for later retrieval. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • TxtNr : Integer
      The index number assigned to this string (gdxAddSetText)/String table index (gdxGetElemText)/Index number of the entry to be modified (gdxSetTextNodeNr)
      Node : Integer
      Node number of the entry (gdxGetElemText)/New Node value for the entry (gdxSetTextNodeNr)

gdxSetTraceLevel

  • Set the amount of trace (debug) information generated. Always nonzero.
  • Function returns Integer
  • Arguments:
    • N : Integer
      Index number/Tracing level, N=<0 no tracing N>=3 maximum tracing (gdxSetTraceLevel)/Line number (gdxSymbolGetComment)
      const s : ShortString
      String to be included in trace output(gdxSetTraceLevel)

gdxSymbIndxMaxLength

  • Returns the length of the longest UEL used for every index position for a given symbol.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      var LengthInfo : TgdxUELIndex
      The longest length for each index position

gdxSymbMaxLength

  • Returns the length of the longest symbol name.
  • Function returns Integer

gdxSymbolAddComment

  • Add a line of comment text for a symbol. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      const Txt : ShortString
      Explanatory text of the acronym (gdxAcronym...)/String to be registered(gdxAddSetText)/Text found for the entry (gdxGetElemText)/String to add (gdxSymbolAddComment)/String containing requested line(gdxSymbolGetComment)

gdxSymbolDim

  • Retrieve dimension of a symbol.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe

gdxSymbolGetComment

  • Retrieve a line of comment text for a symbol. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      N : Integer
      Index number/Tracing level, N=<0 no tracing N>=3 maximum tracing (gdxSetTraceLevel)/Line number (gdxSymbolGetComment)
      out Txt : ShortString
      Explanatory text of the acronym (gdxAcronym...)/String to be registered(gdxAddSetText)/Text found for the entry (gdxGetElemText)/String to add (gdxSymbolAddComment)/String containing requested line(gdxSymbolGetComment)

gdxSymbolGetDomain

  • Retrieve the domain of a symbol. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      var DomainSyNrs : TgdxUELIndex
      Array containing the index numbers of the one dimensional set or alias used as the domain for corresponding index position. A value of zero represents the universe (*)

gdxSymbolGetDomainX

  • Retrieve the domain of a symbol (Relaxed version). 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      out DomainIDs : TgdxStrIndex
      Array containing the set identifiers or * of the domain for the corresponding index position

gdxSymbolInfo

  • Returns information about a symbol. 0 if the symbol number is out of range, nonzero otherwise.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      out SyId : ShortString
      Name of the acronym/symbol; might be an empty string at gdxAcronymName
      out Dimen : Integer
      Dimension of the symbol/index space; index space means the number of index positions that is not fixed (gdxDataReadSlice)
      out Typ : Integer
      Type of the symbol

gdxSymbolInfoX

  • Returns additional information about a symbol. 0 if the symbol number is out of range, nonzero otherwise.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      out RecCnt : Integer
      Total number of records stored (unmapped)
      out UserInfo : Integer
      Any integer value/User field value (gdxSymbolInfoX)
      out ExplTxt : ShortString
      Explanatory text for the symbol

gdxSymbolSetDomain

  • Define the domain of the symbol for which a write data operation just started using DataWriteRawStart, DataWriteMapStart or DataWriteStrStart. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • const DomainIDs : TgdxStrIndex
      Array containing the set identifiers or * of the domain for the corresponding index position

gdxSymbolSetDomainX

  • Define the domain of symbol SyNr (Relaxed version). 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • SyNr : Integer
      The index number of the symbol, range from 0 to NrSymbols; SyNr = 0 reads universe
      const DomainIDs : TgdxStrIndex
      Array containing the set identifiers or * of the domain for the corresponding index position

gdxSystemInfo

  • Returns the number of symbols and unique elements. Always nonzero.
  • Function returns Integer
  • Arguments:
    • out SyCnt : Integer
      Number of symbols available in the gdx file
      out UelCnt : Integer
      Number of unique elements

gdxUELMaxLength

  • Returns the length of the longest UEL name.
  • Function returns Integer

gdxUELRegisterDone

  • Finish registration of unique elements. 0 if the operation is not possible.
  • Function returns Integer

gdxUELRegisterMap

  • Register a unique element in mapped mode. A unique element must follow the GAMS rules when it contains quote characters. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • UMap : Integer
      User index number to be assigned to the unique element, -1 if not found or the element was never mapped
      const Uel : ShortString
      String for the unique element

gdxUELRegisterMapStart

  • Start registering unique elements in mapped mode. 0 if the operation is not possible.
  • Function returns Integer

gdxUELRegisterRaw

  • Register a unique element in raw mode. This can only be used while writing to a gdx file. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • const Uel : ShortString
      String for the unique element

gdxUELRegisterRawStart

  • Start registering unique elements in raw mode. 0 if the operation is not possible.
  • Function returns Integer

gdxUELRegisterStr

  • Register a unique element in string mode. A unique element must follow the GAMS rules when it contains quote characters. Nonzero if the element was registered, zero otherwise.
  • Function returns Integer
  • Arguments:
    • const Uel : ShortString
      String for the unique element
      out UelNr : Integer
      Internal unique element number or -1 if not found

gdxUELRegisterStrStart

  • Start registering unique elements in string mode. 0 if the operation is not possible.
  • Function returns Integer

gdxUMFindUEL

  • Search for a unique element by its string. Nonzero if the element was found, 0 otherwise.
  • Function returns Integer
  • Arguments:
    • const Uel : ShortString
      String for the unique element
      out UelNr : Integer
      Internal unique element number or -1 if not found
      out UelMap : Integer
      Unique element number in the user index space or -1 if element was never mapped

gdxUMUelGet

  • Get a unique element using an unmapped index. 0 if the operation is not possible.
  • Function returns Integer
  • Arguments:
    • UelNr : Integer
      Internal unique element number or -1 if not found
      out Uel : ShortString
      String for the unique element
      out UelMap : Integer
      Unique element number in the user index space or -1 if element was never mapped

gdxUMUelInfo

  • Returns information about the unique elements. Always nonzero.
  • Function returns Integer
  • Arguments:
    • out UelCnt : Integer
      Number of unique elements
      out HighMap : Integer
      Highest user mapping index used

Undocumented Arguments

  • DimPos
  • NrElem
  • Uptr