SalesProfitDB2c.gms : MDB2GMS Example 2 - Reading a multi valued Table using a Parameter with an extra Index Position

Description

The programs selects sales and profit information from database "Sample.mdb"
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.mdb  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.mdb"
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

$if %system.filesys% == UNIX $abort.noError 'This model cannot run on a non-Windows platform';
$call msappavail -Access
$ifE errorlevel<>0 $abort.noError 'Microsoft Access is not 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.mdb
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;