GAMS only generates entries in a GDX file for those parameters, which are not equal to Zero or to their default values. A Zero will not be stored. However, we can tell GAMS to store an
EPS (Epsilon) instead and instruct
GDXXRW to use a Zero when writing the value for 'Epsilon'.
Below you find an example, which also shows an alternative approach regarding variables:
$eolcom # set i /i1*i10/; parameter x(i); variable y(i); x(i) = uniformint(0,1); y.m(i) = 1; #Generate entries for all variable attributes y.l(i) = x(i); x(i)$(not x(i)) = eps; # Assign Eps to x(i) = 0 Execute_Unload 'results.gdx',x,y; $onecho >param.txt EpsOut =0 par =x rng =a1 sq =n var =y rng =a4 $offecho Execute 'GDXXRW.EXE results.gdx @param.txt' ;