GDXXRW issues for a newbie

questions about GAMS' tools
Post Reply
polppp
User
User
Posts: 3
Joined: 5 years ago

GDXXRW issues for a newbie

Post by polppp »

Hello,

I am trying to read some parameters from excel to gams. I am creating the gdx. file with this command:

$call gdxxrw.exe Book1.xls par=alpha rng=sheet1!A2:B3 ;

And then I am trying to load the data with:

$gdxin Book1.gdx
$load alpha
$gdxin

As you can see in the attachment the error I am taking says that there is no such file and it is true. Why there is no Book1.gdx file? Can anybody help me please..
Attachments
gams.PNG
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: GDXXRW issues for a newbie

Post by bussieck »

Hi,

Never call an external program without checking the return code:

Code: Select all

$call gdxxrw.exe Book1.xls par=alpha rng=sheet1!A2:B3 ; 
$if errorlevel 1 $abort problems with running gdxxrw

* Now continue to load GDX data
$gdxin Book1.gdx
$load alpha
In your case gdxxrw fails and gives the message "Unknown option =" (from your screenshot). Not clear I understand why that is giving your description of the gdxxrw command. The only thing that looks suspicious is the tailing semicolon ';' at the end of the $call gdxxrw line. GAMS statements are terminated by ';' $call is a compile directive (also called dollar control option, https://www.gams.com/latest/docs/UG_Dol ... DOLLARcall) to call an external program at compile time, not a GAMS statement (https://www.gams.com/latest/docs/UG_GAM ... Statements). If removing the ';' does not help, post your spreadsheet and the part of your GAMS code that does the Excel reading.

-Michael
SekharCT
User
User
Posts: 2
Joined: 5 years ago

Re: GDXXRW issues for a newbie

Post by SekharCT »

Hello,
I am learning to code in GAMS. I recently came across an issue while linking a gdxrrw file with the code, it is returning this error(placed in attachments along with the corresponding code). I can provide additional information if this is insufficient. Please help me to debug this error. Awaiting a reply.
Thank you in advance.

The error is:
The error that is encountered
The error that is encountered
The code which produced the error:
Code which gave the corresponding error
Code which gave the corresponding error
sissi.alves
User
User
Posts: 2
Joined: 5 years ago

Begginer´s doubt. Please, Help me!!!

Post by sissi.alves »

I need use a input file with parameters. Is there some syntax that I can put the parameters in a simple file .txt?
Post Reply