|
Setcomps |
Top Previous Next |
|
Establishes or redefines control variables so they contain the components of a period delimited string.
$setcomps perioddelimstring v1 v2 v3 ….
where perioddelimstring is any period delimited string like the set specification of a multidimensional parameter
Thus (condcomp.gms)
$setcomps s1.s2.s3 sel1 sel2 sel3
separates the string s1.s2.s3 into its three components placing s1 into sel1, s2 into sel2 and s3 into sel3. The three items may be recombined back into the original filename string by using %v1%.%v2%.%v3% in a command like (condcomp.gms)
$setglobal nam1 %sel1%.%sel2%.%sel3%
In turn one can do conditional processing as illustrated below
scalar count /0/; set sels /s1*s3/; loop(sels,count=count+1; if(sameas(sels,"%sel2%"),display "found element %sel2% in position",count;); ); |