Page 1 of 1

@wread buggy?

Posted: Fri Apr 12, 2019 8:19 am
by mamo
Dear Eviews team,

I use Eviews 10 March 2018 build. At least in this version, the command @wread seems to be buggy:

1) @wread encloses lines in quotes which is not wanted, and it does so inconsistently. See example below: lines read from text1.txt are enclosed in double quotes, not so lines read from text2.txt. The double quotes cannot be easily removed by @replace, for instance, because this would also remove those double quotes which have been inserted on purpose in the text file to be read in.

2) @wread seems to skip lines with one single character at the beginning of a row. See text2.txt in the example below

Also, it seems that @wread has not been documented in the off-line help of Eviews.

Best, mamo

Code: Select all

' @wread encloses lines in quotes which is not wanted
if @isobject("txt1") then
   delete txt1
endif
' Generate a text file with some typical SQL code
text txt1
txt1.append Select VAR1 VAR2
txt1.append from MYDB
txt1.append where VAR1 IN (X)
txt1.save text1.txt
string str1 =@wread("text1.txt")
show str1

' @wread is buggy: it skips sinlge characters at the beginning of a line!
if @isobject("txt2") then
   delete txt2
endif
text txt2
txt2.append H
txt2.append W
txt2.append Hello
txt2.append World
txt2.save text2.txt
string str2 =@wread("text2.txt")
show str2


Re: @wread buggy?

Posted: Tue Apr 23, 2019 6:22 am
by mamo
... and furthermore, @wread removes commas in the original text, and includes text after a comma in double quotation marks automatically, see text3.txt and str3 in the expanded example code below. Appears to be a rather strange behaviour.
Could the Eviews team kindly correct this unwanted behavior of @wread?

Best, mamo

Code: Select all

' @wread encloses lines in quotes which is not wanted
if @isobject("txt1") then
   delete txt1
endif
' Generate a text file with some typical SQL code
text txt1
txt1.append Select VAR1 VAR2
txt1.append from MYDB
txt1.append where VAR1 IN (X)
txt1.save text1.txt
string str1 =@wread("text1.txt")
show str1

' @wread skips single characters at the beginning of a line!
if @isobject("txt2") then
   delete txt2
endif
text txt2
txt2.append H
txt2.append W
txt2.append Hello
txt2.append World
txt2.save text2.txt
string str2 =@wread("text2.txt")
show str2

' @wread removes commas!
if @isobject("txt3") then
   delete txt3
endif
text txt3
txt3.append Hello,
txt3.append World
txt3.save text3.txt
string str3 =@wread("text3.txt")
show str3