Wiring.gms : Use of wiring Option to read multi-data Column Tables

Description

The programs selects sales and profit information from database "Sample.mdb"
using wiring option and writes results to "x.inc".

Instead of
   SELECT prod, loc, year, 'sales', sales FROM data
   UNION
   SELECT prod, loc, year, 'profit', profit FROM data

we use
   SELECT prod, loc, year, sales, profit FROM data
   or
   SELECT * FROM data

Keywords: MDB2GMS, data exchange, GAMS language features


Category : GAMS Data Utilities library


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

$title Use of wiring Option to read multi-data Column Tables (Wiring,SEQ=045)

$onText
The programs selects sales and profit information from database "Sample.mdb"
using wiring option and writes results to "x.inc".

Instead of
   SELECT prod, loc, year, 'sales', sales FROM data
   UNION
   SELECT prod, loc, year, 'profit', profit FROM data

we use
   SELECT prod, loc, year, sales, profit FROM data
   or
   SELECT * FROM data

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
   y   'years'      / 1997*1998 /
   loc 'locations'  / nyc, was, la, sfo  /
   prd 'products'   / hardware, software /
   q   'quantities' / sales, profit      /;

$onEcho > cmd.txt
I=Sample.mdb
Q=SELECT * FROM data
O=x.inc
W=i1|i2|i3|v4='sales'|v4='profit'
$offEcho

$call mdb2gms @cmd.txt > %system.nullfile%
$ifE errorLevel<>0 $abort Error using MDB2GMS with wiring option!

Parameter data(y,loc,prd,q) /
$include x.inc
/;
display data;