evesely
6th June 2002, 18:59
I have a library that can be called from any number of scripts. I know that prog.name$ allows me to see the current session name, but is there some simple variable or function call that can tell me the name of the object I am currently executing? I might want to pass this to the library.

For example, if I make a custom version of the Maintain Items script and call my library that new script, is there a way in the script or in the library to know that I was running otiitm0101 or whatever I may have named it (e.g., otiitm0101900, otiitmxyzpdq, or whatever other name I conjured up)?

I know that I could use the session, the current package combination, and the VRC hierarchy to run through several tools tables and eventually find the script, but that seems like too much work. Also, I'd like to find a way that works for any user, which would leave out the ottdllvrcsearch tools which would require a user to briefly change to company 0.

Thoughts?

NPRao
6th June 2002, 19:21
Hi Ed,

the only option I can think of is the BaaN standard funtion


long pathname( string file_basename(16), string file_type, ref string file_path(256) )


and then process the file_path to get the VRC, its mostly string processing and pattern detection...

you might like to explore that...

evesely
6th June 2002, 19:28
Thanks for the reply. I just don't know what I would use for file_basename without hard-coding it in each script or doing a lengthy table search

francishsu
7th June 2002, 00:38
It appears that the standard program loads the runtime data from ttadv999 for the session at some point after the before.program section.

Try running your script in debugger, set a breakpoint on a statement after the before.program section, and look at the value of ttadv999.desc

~Vamsi
7th June 2002, 00:52
Ed,

I think you put people off-track by saying prog.name$ does not suit your purpose. I believe that is exactly what works. As an example I wrote a 3-GL script named "vamsi.bc". I compiled it in the shell:
bic6.2 -l vamsi.bc -o a.out
bic6.2 -l vamsi.bc -o b.out

When I execute a.out and b.out I get a.out and b.out for prog.name$. I do not get vamsi.bc. This does not give you the path to a.out or b.out, but it definitely gives you the name of the object!

NPRao
7th June 2002, 01:35
Hi Vamsi,

I have tested that idea... you can get the script code in the prog.name$ if a 3-GL scripts calls the function in the dll, but if a session (and its script) calls this function in the DLL, then the prog.name$ get the session code and not the type-4 or other kind of script.

That gets us back to where we started, if we know the session code, we can always use the search functions to get the script codes which Ed doesnt like to do.

:rolleyes:

OmeLuuk
7th June 2002, 13:53
Hi,

Maybe you can use the function extern long vrc_search_object(
domain ttadv.cpac cpac,
domain ttadv.cmod cmod,
domain ttadv.cprs cprs,
long tdep,
ref domain ttadv.vers tver() fixed,
ref domain ttadv.rele trel() fixed,
ref domain ttadv.cust tcus() fixed )

(see bic_info6.1 -e ottdllvrcsearch)