csv2gdx2.gms : CSV2GDX - Testing the Option checkDate

Description

This program tests the option "checkDate" from the tool CSV2GDX. In the
first call of CSV2GDX, a GDX file dataBackup.gdx is written. Then, data.gdx
is created manually with different content. Finally, CSV2GDX 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 CSV2GDX - Testing the Option checkDate (CSV2GDX2,SEQ=746)

$onText
This program tests the option "checkDate" from the tool CSV2GDX. In the
first call of CSV2GDX, a GDX file dataBackup.gdx is written. Then, data.gdx
is created manually with different content. Finally, CSV2GDX 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 csv2gdx data.csv output=dataBackup.gdx id=d index=1 value=2 colCount=2 trace=0
$ifE errorLevel<>0 $abort Problems reading data with CSV2GDX!

*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 csv2gdx data.csv id=d index=1 value=2 colCount=2 checkDate=Y trace=0
$ifE errorLevel<>0 $abort Problems reading data with CSV2GDX!

$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!