SalesProfitDB3.gms : MDB2GMS Example 7 - Multi-Query Batch Example (Output: Several include Files)

Description

Several queries are executed in a single MDB2GMS call. The results are written
to several include files.

This model is referenced in "Example 7 - Multi-Query Batch Example" section
"Output: Several include Files" from the MDB2GMS Documentation.

Keywords: MDB2GMS, data exchange, GAMS language features


Category : GAMS Data Utilities library


Main file : SalesProfitDB3.gms   includes :  Sample.mdb  SalesProfitDB3.gms

$title MDB2GMS Example 7 - Multi-Query Batch Example (Output: Several include Files) (SalesProfitDB3,SEQ=036)

$onText
Several queries are executed in a single MDB2GMS call. The results are written
to several include files.

This model is referenced in "Example 7 - Multi-Query Batch Example" section
"Output: Several include Files" 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!';

$onEcho > howToRead.txt
I=Sample.mdb

Q1=SELECT distinct(year) FROM data
O1=year.inc

Q2=SELECT distinct(loc) FROM data
O2=loc.inc

Q3=SELECT distinct(prod) FROM data
O3=prod.inc

Q4=SELECT prod, loc, year, sales FROM data
O4=sales.inc

Q5=SELECT prod, loc, year, profit FROM data
O5=profit.inc
$offEcho

$call mdb2gms @howToRead.txt > %system.nullfile%
$ifE errorLevel<>0 $abort Error using MDB2GMS!

Set y 'years' /
$include year.inc
/;
Set loc 'locations' /
$include loc.inc
/;
Set prd 'products' /
$include prod.inc
/;

Parameter sales(prd,loc,y) /
$include sales.inc
/;
display sales;

Parameter profit(prd,loc,y) /
$include profit.inc
/;
display profit;