SalesProfitDB1.gms : MDB2GMS Example 2 - Reading a multi valued Table using separate Queries and Parameters

Description

The programs selects sales and profit information from database "Sample.mdb"
using MDB2GMS and writes them to "sales.inc" or "profit.inc" respectively.
Note that two separate MDB2GMS calls are used, while it would be also possible
to query the data in a single MDB2GMS run (check the MDB2GMS Documentation
section "Multi-Query Batch Usage").

This model is referenced in "Example 2 - Reading a multi valued Table" section
"Two separate Parameters" from the MDB2GMS Documentation.

Keywords: MDB2GMS, data exchange, GAMS language features


Category : GAMS Data Utilities library


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

$title MDB2GMS Example 2 - Reading a multi valued Table using separate Queries and Parameters (SalesProfitDB1,SEQ=033)

$onText
The programs selects sales and profit information from database "Sample.mdb"
using MDB2GMS and writes them to "sales.inc" or "profit.inc" respectively.
Note that two separate MDB2GMS calls are used, while it would be also possible
to query the data in a single MDB2GMS run (check the MDB2GMS Documentation
section "Multi-Query Batch Usage").

This model is referenced in "Example 2 - Reading a multi valued Table" section
"Two separate Parameters" 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 /;

$call mdb2gms I=Sample.mdb Q="SELECT year, loc, prod, sales FROM data" O=sales.inc > %system.nullfile%
$ifE errorLevel<>0 $abort Error using MDB2GMS when querying sales!

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

$call mdb2gms I=Sample.mdb Q="SELECT year, loc, prod, profit FROM data" O=profit.inc > %system.nullfile%
$ifE errorLevel<>0 $abort Error using MDB2GMS when querying profit!

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