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

Description

The programs selects sales and profit information from database "Sample.accdb"
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.accdb  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.accdb"
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

$callTool win32.msappavail Access
$if errorlevel 1 $abort.noError "No Access 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.accdb
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;