Getting the process ID from a session (no DB)

Posted by Admin on 19-Mar-2012 06:15

Is there a way of getting the process ID of an appserver agent that is not connected to a DB?

At the moment I use:

def buffer connection for _myConnection.

find first connection no-lock no-error.

mypid = if avail connection

        then string(connection._MyConn-Pid)

        else ""

(Which doesn't work for agents with no DB)

I was hoping there would be a nice and easy session:pid attribute, but there doesn't appear to be one.



Solaris 10

All Replies

Posted by egarcia on 19-Mar-2012 07:52


There is an old thread related to this:

You can use the getpid() function in to get the PID:

     procedure getpid external '' cdecl.

       define return parameter pid as long no-undo.


     def var p as int no-undo.

     run getpid (output p).

     message p.

I hope this helps.

Posted by Admin on 19-Mar-2012 11:25

Yep does the trick.


This thread is closed