how to pass data from a .gms file to another .gms file?

there are two .gms files: test1.gms and test2.gms. i’d like to execute test2.gms in test1.gms, such as:

Execute “gams test2.gms”;

now, i want to pass some data (for example, data1=2010 and data2=2011) from test1.gms to test2.gms. how can test2.gms get data1 and data2?

what should i do?

thank you.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

hi
In “test2.gms”, save data in a gdx file:

execute_unload “DATA.gdx” data1,data2;

then load data in “test1.gms”:

$GDXIN DATA.gdx
$LOAD data1
$LOAD data2
$GDXIN



From: “wliangcn@gmail.com
To: gamsworld@googlegroups.com
Sent: Sunday, March 3, 2013 2:15 PM
Subject: how to pass data from a .gms file to another .gms file?

there are two .gms files: test1.gms and test2.gms. i’d like to execute test2.gms in test1.gms, such as:

Execute “gams test2.gms”;

now, i want to pass some data (for example, data1=2010 and data2=2011) from test1.gms to test2.gms. how can test2.gms get data1 and data2?

what should i do?

thank you.

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Reply-to: gamsworld@googlegroups.com

hi,Hajinezhad ,

my question’s detailed description as follow:

there are two .gms files: test1.gms and test2.gms. i want to pass some data (for example, qq1=2007,2008,2009……) from test1.gms to test2.gms.

test1.gms as follow:

set years/2007*2014/

parameters
qq1
;

qq1=2006;

loop(years,
qq1=qq1+1;
Execute “gams E:\GAMS\test2.gms --myvalue=qq1”;
)


test2.gms as follow:

parameters
sumQA
;
sumQA=89898;
execute_unload “E:\GAMS\2007-2014\butterfly.gdx” sumQA
execute “gdxxrw.exe E:\GAMS\2007-2014\butterfly.gdx output=E:\GAMS\2007-2014%myvalue%.xls par=sumQA rng=QA!”


i want to send qq1 to test2.gms, but when test2.gms receive qq1(through %myvalue% ), i find qq1 become a string “qq1”, not a numerical value 2007,2008…….

how should i modify above code to send qq1(2007,2008,2009……) to test2.gms? and in test2.gms how can i use qq1 construct files’ name like 2007.xls, 2008.xls, 2009.xls……

thanks!


在 2013年3月3日星期日UTC+8下午9时41分14秒,Hajinezhad写道:

hi
In “test2.gms”, save data in a gdx file:

execute_unload “DATA.gdx” data1,data2;

then load data in “test1.gms”:

$GDXIN DATA.gdx
$LOAD data1
$LOAD data2
$GDXIN



From: “wlia...@gmail.com
To: gams...@googlegroups.com
Sent: Sunday, March 3, 2013 2:15 PM
Subject: how to pass data from a .gms file to another .gms file?

there are two .gms files: test1.gms and test2.gms. i’d like to execute test2.gms in test1.gms, such as:

Execute “gams test2.gms”;

now, i want to pass some data (for example, data1=2010 and data2=2011) from test1.gms to test2.gms. how can test2.gms get data1 and data2?

what should i do?

thank you.

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\