File Paths and Include

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

Jwink
Posts: 11
Joined: Thu Mar 17, 2011 12:44 pm

File Paths and Include

Postby Jwink » Tue Apr 19, 2011 9:49 am

Working with Eviews 6 (July 2010 build).

A bit of setup:
I'm working with a group where we're all going to be working on individual parts of a program and then including the programs in a larger program. Each program that we'll be working on individually consists of 3 individual programs that run in sequence, but I've broken it up because you'll only need to run the first part once, but the other two parts will be run repeatedly. Since I'm working with Eviews 6, I've been using the include command plus the file path to pull the subsequent parts of the program - something like:

program 1
blah blah
include c:/test/program2.prg

program 2
blah blah
include c:/test/program3.prg

program 3
blah blah

I was trying to streamline this so that each person working won't have to change the file paths and then we won't all have to change the file paths back when we combine them by putting a change directory command at the start of program 1:

program 1
cd c:\test
blah blah
include program 2

program 2
blah blah
include program 3

program 3
blah blah

The problem:
The change directory command works (I can see it change in the lower right corner), but it continues to pull programs 2 and 3 from my directory when the file paths are not in the include commands rather than pulling them from my colleague's directories that the change directory command has switched it to. I tried running the program on one of their computers but because we have a shared networked drive that we're all working from, it continued to pull the programs from my files. I even tried screwing the included programs up on my colleague's drives to test which copy it was pulling from, but it still worked so I'm sure it was running off of my copy. I was wondering if there was some better way of running this or if this is an issue with the way Eviews pulls files. Let me know if the explanation of my problem doesn't make sense too.

-Thanks,
John

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

File Paths and Include

Postby EViews Gareth » Tue Apr 19, 2011 1:45 pm

The problem is that all include statements take place before any other lines in your program. Thus the include happens before the cd does. In EViews 6 there isn't an easy way around this (in EViews 7 you could use the exec command).

Jwink
Posts: 11
Joined: Thu Mar 17, 2011 12:44 pm

Re: File Paths and Include

Postby Jwink » Tue Apr 19, 2011 2:18 pm

Thanks. Hopefully I'll be getting Eviews 7 soon.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests