SalesProfitDB4.gms : MDB2GMS Example 7 - Multi-Query Batch Example (Output: A single GDX File)

Description

Several queries are executed in a single MDB2GMS call. The results are written
to a single GDX file.

This model is referenced in "Example 7 - Multi-Query Batch Example" section
"Output: A single GDX File" from the MDB2GMS Documentation.

Keywords: MDB2GMS, data exchange, GAMS language features


Category : GAMS Data Utilities library


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

$title MDB2GMS Example 7 - Multi-Query Batch Example (Output: A single GDX File) (SalesProfitDB4,SEQ=037)

$onText
Several queries are executed in a single MDB2GMS call. The results are written
to a single GDX file.

This model is referenced in "Example 7 - Multi-Query Batch Example" section
"Output: A single GDX File" 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
X=Sample.gdx

Q1=SELECT distinct(year) FROM data
S1=year

Q2=SELECT distinct(loc) FROM data
S2=loc

Q3=SELECT distinct(prod) FROM data
S3=prd

Q4=SELECT prod, loc, year, sales FROM data
P4=sales

Q5=SELECT prod, loc, year, profit FROM data
P5=profit
$offEcho

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

$call =shellExecute gdxviewer Sample.gdx
$ifE errorLevel<>0 $abort Error calling GDXVIEWER!

Set
   y   'years'
   loc 'locations'
   prd 'products';

Parameter
   sales(prd,loc,y)
   profit(prd,loc,y);

$gdxIn Sample.gdx
$load y=year prd loc sales profit
$gdxIn

display sales, profit;