get program name or path

For questions regarding programming in the EViews programming language.

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

amrsherif
Posts: 99
Joined: Mon Jul 23, 2018 4:34 pm

get program name or path

Postby amrsherif » Thu Feb 07, 2019 10:03 am

Hi,

I would like to know if there is a command to get the name (or path) of the program currently being run (for logging purposes, i.e. this series was created in this program). I know how to get the workfile name, path, page names and frequency.

I'm positive i can work my way around this but it would be very helpful to know whether or not such a command exisits.

I did a quick search in the forum to see if this has been asked before, but couldn't find anything similar, yet.

Thanks

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

Re: get program name or path

Postby EViews Matt » Thu Feb 07, 2019 11:46 am

Hello,

See here.

amrsherif
Posts: 99
Joined: Mon Jul 23, 2018 4:34 pm

Re: get program name or path

Postby amrsherif » Thu Feb 07, 2019 11:48 am

Thank you very much!

amrsherif
Posts: 99
Joined: Mon Jul 23, 2018 4:34 pm

Re: get program name or path

Postby amrsherif » Thu Feb 07, 2019 2:00 pm

So this works except in one circumstance. If i have a 'master' program that runs several other sub programs, then the @runpath and @runname commands give me the info of the master program instead of the sub programs.

In other words, i totally missed the part in the link that mentioned 'high-level' program. Is there any way to get around this?

amrsherif
Posts: 99
Joined: Mon Jul 23, 2018 4:34 pm

Re: get program name or path

Postby amrsherif » Thu Feb 07, 2019 2:39 pm

I would also add that my programs are now very buggy (after using logmsg and logsave).
They seem to freeze in the middle of the logging, and crash (and need to be closed).
If i take out the logging, they run without problems. Not sure why.

amrsherif
Posts: 99
Joined: Mon Jul 23, 2018 4:34 pm

Re: get program name or path

Postby amrsherif » Fri Feb 08, 2019 10:16 am

The programs specifically crash on the logsave line.
I'm generating a string with all the series that i want to log, then log each series individually in the logmsg. generate the location of where the text file will be saved, then saving it.

Here is the code:

string serieslist=@wlookup("*xr*", "series")
group currencymaster {serieslist}

string path=@runpath
string name = @runname
string path=path+name

for %var {serieslist}
%command=%var + ": " + path
logmsg {%command}
next
%datenow = @strnow("yyyy/mm/dd")
%datenow=@replace(%datenow,"/","-")
%chartcodeloc="c:\somelocation\log\log_" + %datenow + ".txt"

''''''''THIS IS WHERE IT FREEZES AND CRASHES
logsave(append, name="logseriessource", type=text) {%chartcodeloc}
''''''''

logclear(name="logseriessource")

Has anybody else had issues while saving the log?

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

Re: get program name or path

Postby EViews Matt » Fri Feb 08, 2019 10:19 am

I'm not aware of a workaround for @runpath and @runname's behavior, it's a limitation of the current internal representation of programs.

amrsherif
Posts: 99
Joined: Mon Jul 23, 2018 4:34 pm

Re: get program name or path

Postby amrsherif » Fri Feb 08, 2019 10:26 am

Ok thanks. I found a way around it (had to write a subroutine tat executes the programs). How about the crashing issue? Have you seen anybody reporting bugs/crashing while using logsave?

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

Re: get program name or path

Postby EViews Matt » Fri Feb 08, 2019 11:07 am

They do crop up from time to time (top post in the Bug Report forum is a logsave bug at the moment). What version of EViews are you running and is there a logmode statement in your program?

amrsherif
Posts: 99
Joined: Mon Jul 23, 2018 4:34 pm

Re: get program name or path

Postby amrsherif » Fri Feb 08, 2019 11:19 am

i have logmode(name="logseriessource", ts) logmsg at the top of every program that uses logmsg

I do get the crash every single time though. Even if i stop the program before the logsave, and run that part in the command

Eviews 10, August 22 2018 build.

amrsherif
Posts: 99
Joined: Mon Jul 23, 2018 4:34 pm

Re: get program name or path

Postby amrsherif » Fri Feb 08, 2019 12:36 pm

Ok so i think i’ve figured it out. The problem was my workaround involved making a subroutine that logged the low level program name and then it executed it. The problem seems to have been the execution inside the sub routine.

It’s very strange and i don’t know exactly why this was happening. But having the subroutine only log the low level program with executing it did the trick, for now.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 25 guests