csv2gdx2.gms : CSVRead - Testing the Option checkDate

Description

This program tests the option "checkDate" from the tool CSVRead. In the
first call of CSVRead, a GDX file dataBackup.gdx is written. Then, data.gdx
is created manually with different content. Finally, CSVRead is called again
on the unmodified CSV file with the option "checkDate" to prevent writing
data.gdx. If there would be no difference between the files dataBackup.gdx and
data.gdx, "checkDate" would have failed.

Contributor: Jan-Erik Justkowiak, March 2018


Small Model of Type : GAMS


Category : GAMS Test library


Main file : csv2gdx2.gms

$title CSVRead - Testing the Option checkDate (CSV2GDX2,SEQ=746)

$onText
This program tests the option "checkDate" from the tool CSVRead. In the
first call of CSVRead, a GDX file dataBackup.gdx is written. Then, data.gdx
is created manually with different content. Finally, CSVRead is called again
on the unmodified CSV file with the option "checkDate" to prevent writing
data.gdx. If there would be no difference between the files dataBackup.gdx and
data.gdx, "checkDate" would have failed.

Contributor: Jan-Erik Justkowiak, March 2018
$offText

$onEcho > data.csv
a,1
$offEcho

$call gamstool csvread data.csv gdxout=dataBackup.gdx id=d index=1 values=2 trace=0
$ifE errorLevel<>0 $abort Problems reading data with CSVRead!

*Wait a moment to trigger the checkDate option
$call sleep 2

Set dim1 / a /;
Parameter d / a 2 /;

$gdxOut data.gdx
$unLoad dim1 d
$gdxOut

$call gamstool csvread data.csv id=d index=1 values=2 checkDate=Y trace=0 gdxout=data.gdx
$ifE errorLevel<>0 $abort Problems reading data with CSVRead!

$call gdxdiff data.gdx dataBackup.gdx > %system.nullfile%
$ifE errorLevel=0 $abort Option checkData did not work - data.gdx was rewritten!
$log The files data.gdx and dataBackup.gdx are different - data.gdx was not rewritten due to checkDate=y!