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

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

$onEcho > howToRead.txt
I=Sample.accdb
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!

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;