|
$Ondelim and $Offdelim |
Top Previous Next |
|
CSV formatted entries files may be incorporated by using the command $Ondelim before beginning the entry and then $Offdelim afterwards. Consider the following example (CSV1.gms):
SETS PLANT PLANT LOCATIONS /NEWYORK,CHICAGO,LOSANGLS / MARKET DEMANDS /MIAMI,HOUSTON, PORTLAND/ table datafrmCSV(plant,market) data in CSV format $Ondelim dummy,MIAMI,HOUSTON,PORTLAND NEWYORK,1300,1800,1100 CHICAGO,2200,1300,700 LOSANGLS,3700,2400,2500 $Offdelim
where the section in blue is in CSV form. In version 22.7 and later one can also drop the dummy entry but must maintain the comma as follows table datafrmCSV2(plant,market) data in CSV format $Ondelim ,MIAMI,HOUSTON,PORTLAND NEWYORK,1300,1800,1100 CHICAGO,2200,1300,700 LOSANGLS,3700,2400,2500 $Offdelim
One could equivalently use an include file as follows (CSV2.gms)
SETS PLANT PLANT LOCATIONS /NEWYORK,CHICAGO,LOSANGLS / MARKET DEMANDS /MIAMI,HOUSTON, PORTLAND/ table datafrmCSV(plant,market) data in CSV format $Ondelim $Include Csvtoinc $Offdelim
where the file csvtoinc.gms contains
dummy,MIAMI,HOUSTON,PORTLAND NEWYORK,1300,1800,1100 CHICAGO,2200,1300,700 LOSANGLS,3700,2400,2500
where the dummy could be dropped but the comma must be maintained. Notes:
|