Consultor Eletrônico



Kbase 20532: How to Get the Process ID (PID) from a 4GL Client in UNIX - for Progress 32-Bit
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Verified

GOAL:

How to get process ID (PID) of a 4GL client that executes a particular program.

FACT(s) (Environment):

UNIX
Progress/OpenEdge Versions

FIX:

This code will only work for a 32 bit version of Progress.

There are various types of 4GL clients, for example:

- 4GL client TTY mode
- 4GL client batch mode
- 4GL client running as a WebSpeed agent
- 4GL client running as an AppServer server process

Sometimes it's needed to get the PID of the 4GL client that executes a particular program, usually for debugging or logging purposes.

Following code uses the LIBC UNIX function "getpid" that resides in the UNIX shared library /usr/lib/libc.1 to get the process ID (PID) of the Progress 4GL client that executes a particular program. Access to shared libraries on UNIX is available in Progress Version 9.1x or later. For further information on the getpid function or on other UNIX functions, refer to your UNIX documentation.

The code is as follows:

DEFINE VARIABLE ppid AS INTEGER NO-UNDO.

PROCEDURE getpid EXTERNAL "/usr/lib/libc.1" CDECL:
DEFINE RETURN PARAMETER ppid AS LONG NO-UNDO.
END PROCEDURE.

RUN getpid(OUTPUT ppid).

MESSAGE ppid.