Description
The programs selects sales and profit information from database "Sample.accdb" using 'UNION' and writes results to "data.inc". A single parameter with an extra index position 'type' is used to access the sales resp. profit data. It also illustrates how to break a line in a query statement using the "\" character. This model is referenced in "Example 2 - Reading a multi valued Table" section "Single Parameter with extra Index Position" from the MDB2GMS Documentation. Keywords: MDB2GMS, data exchange, GAMS language features
Category : GAMS Data Utilities library
Main file : SalesProfitDB2c.gms includes : Sample.accdb SalesProfitDB2c.gms
$title MDB2GMS Example 2 - Reading a multi valued Table using a Parameter with an extra Index Position (SalesProfitDB2c,SEQ=034)
$onText
The programs selects sales and profit information from database "Sample.accdb"
using 'UNION' and writes results to "data.inc". A single parameter with an
extra index position 'type' is used to access the sales resp. profit data.
It also illustrates how to break a line in a query statement using the "\"
character.
This model is referenced in "Example 2 - Reading a multi valued Table" section
"Single Parameter with extra Index Position" from the MDB2GMS Documentation.
Keywords: MDB2GMS, data exchange, GAMS language features
$offText
$callTool win32.msappavail Access
$if errorlevel 1 $abort.noError "No Access available"
Set
year 'years' / 1997*1998 /
loc 'locations' / nyc, was, la, sfo /
prd 'products' / hardware, software /
type 'data type' / sales, profit /;
$onEcho > howToRead.txt
I=Sample.accdb
Q=SELECT year, loc, prod, 'sales', sales FROM data \
UNION \
SELECT year, loc, prod, 'profit', profit FROM data
O=data.inc
$offEcho
$call mdb2gms @howToRead.txt > %system.nullfile%
$ifE errorLevel<>0 $abort Error using MDB2GMS!
Parameter data(year,loc,prd,type) /
$include data.inc
/;
display data;