Page 1 of 1

copy between wokfile

Posted: Sat Sep 12, 2015 1:57 am
by maxchen
EV9 20150825 xp

when the workfile name has "-" (minus)

Code: Select all

wfcreate u 8 ' copy J2012-1m2.wf1::ot\ov ov 'work copy J2012-1m2::ot\ov ov 'Database not found: The DB file 'E:\DOC\HEDGE\TEST\J2012-1M2.edb' does not exist in "COPY J2012-1M2::OT\OV OV". copy J2012-1m2::ot\o* o* 'J20121M2::OT\O* was not found in "COPY J2012-1M2::OT\O* O*".
1 copy single object, workfile recognize as database
2 copy with wildcard, the "-" was removed, and not able to find the workfile

Re: copy between wokfile

Posted: Sat Sep 12, 2015 5:10 pm
by maxchen

Re: copy between wokfile

Posted: Mon Sep 14, 2015 8:32 am
by EViews Steve
There's a subtle difference between the EViews name of a workfile and the filename of the workfile. Windows filenames allow you to have dashes, such as:

Code: Select all

c:\files\j2012-1m2.wf1

But if you open this workfile in EViews, the name of the workfile will be:

Code: Select all

J20121M2
EViews names do not allow dashes due to ambiguity between dashes and minus as in the following statement:

Code: Select all

x=y-z::x
(if we allowed dashes in EViews names, we wouldn't know how to read this line "y minus z::x" or "y-z workfile, series x"?)

In any case, if you specify an EViews name, you shouldn't use dashes. Our COPY method does have some inconsistencies in how it parses the dash, but the overall premise is still correct. If you want to specify the file, use the file extension. If you want to specify the EViews name (and the associated workfile or database is not already open), make sure the internal name matches the filename exactly (no dashes allowed).

The one exception to this rule seems to be database (EDB) names so I'll look into that more. Those seem to allow dashes in the name in the COPY method without any issues. It's possible we could do that same exception for workfiles, but I'm not sure.

In any case, the safest thing to do when writing EViews programs is to avoid using dashes in any of your filenames.

Steve

Re: copy between wokfile

Posted: Mon Sep 14, 2015 9:17 am
by EViews Steve
Turns out the exception is the rule. If you don't specify a filename, EViews will default to thinking it's an EViews database (EDB) and will treat it as such. That's why the dash seems to work. If you don't specify a file extension and you don't have a corresponding EDB file in your default directory, the copy operation won't be able to find the workfile.