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.accdb  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

$callTool win32.msappavail Access
$if errorlevel 1 $abort.noError "No Access available"

$onEcho > howToRead.txt
I=Sample.accdb

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;