anupamprasad
24th July 2005, 18:02
In the report script I want to find the parent process program name.
I am not able to use the function to get the progname

before.program:

long info(PSMAXSIZE)
string progname(512)
long procid


procid = pstat( parent, progname, info )

if progname = "tdpur9401m000" then
do some thing...
endif

NPRao
25th July 2005, 03:18
Anupam,

Try -

before.program:
import("prog.name$", progname)

This will give you the calling/parent session id.

anupamprasad
25th July 2005, 14:24
import does not work...

It gives the current report name... I want to get the session code which is the parent process id of report...

Could you give some other suggestion...

DStroud
25th July 2005, 18:28
try the following:

long info(PSMAXSIZE)
string progname(512)
long procid

procid = -1
procid = pstat( procid, progname, info )
while procid > 0
| process info
procid = pstat( procid, progname, info )
endwhile

NPRao
25th July 2005, 20:15
Anupam,

I just debugged with this code in Report Script and it works for me -

declaration:
long info(PSMAXSIZE)
string progname(512)
long procid

before.program:
import("prog.name$", progname) |* Session Code
message("Entering %s", progname)
procid = pstat(parent, progname, info )
message("Parent %s", progname) |* Session Code
procid = pstat(pid, progname, info )
message("PID %s", progname) |* Report Code