Description
Example of using SQL2GMS to read text files using the ODBC Text Driver Note: uses schema.ini This model is referenced in "Example 10 - Reading from a Text File" from the SQL2GMS Documentation. Keywords: SQL2GMS, data exchange, GAMS language features
Category : GAMS Data Utilities library
Main file : Text.gms includes : Text.gms ODBCData.txt ODBCData2.txt Schema.ini
$title Reads Table from a Text File using the ODBC Text Driver (Text,SEQ=059)
$onText
Example of using SQL2GMS to read text files using the ODBC Text Driver
Note: uses schema.ini
This model is referenced in "Example 10 - Reading from a Text File" from
the SQL2GMS Documentation.
Keywords: SQL2GMS, data exchange, GAMS language features
$offText
$callTool win32.msappavail Access
$if errorlevel 1 $abort.noError "No Access available"
Set
i / SEATTLE, SAN-DIEGO /
j / NEW-YORK, CHICAGO, TOPEKA /;
$onEcho > fixedtextcmd.txt
C=DRIVER={Microsoft Text Driver (*.txt; *.csv)};DBQ=%system.fp%;
Q=SELECT city1, city2, distance FROM ODBCData.txt
O=fixed.inc
$offEcho
$call sql2gms @fixedtextcmd.txt > %system.nullfile%
$ifE errorLevel<>0 $abort Error using SQL2GMS on ODBCData.txt!
Parameter p1(i,j) /
$include fixed.inc
/;
display p1;
$onEcho > separatedtextcmd.txt
C=DRIVER={Microsoft Text Driver (*.txt; *.csv)};DBQ=%system.fp%;
Q=SELECT city1, city2, distance FROM ODBCData2.txt
O=fixed2.inc
$offEcho
$call sql2gms @separatedtextcmd.txt > %system.nullfile%
$ifE errorLevel<>0 $abort Error using SQL2GMS on ODBCData2.txt!
Parameter p2(i,j) /
$include fixed2.inc
/;
display p2;