Kbase P10912: How to get information about a client session using the PROG
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  1/28/2003 |
|
Status: Unverified
GOAL:
How to get information about a client session using the PROGRESS 4GL on UNIX
FIX:
The following PROGRESS procedure shows how to use UNIX and the PROGRESS proshut utility to get this information. Please note that this program will run only on the UNIX operating system, and when a PROGRESS broker is running for the database.
/**********************************************************/
/* PROGRAM NAME : whoami.p */
/* AUTHOR : gfs */
/* DESCRIPTION : Gets information about a client session */
/* from proshut (Written only for UNIX) */
/* LAST MODIFIED: 07/21/92 */
/**********************************************************/
DEF VAR userno AS INTEGER.
DEF VAR pid AS CHAR.
DEF VAR dow AS CHAR.
DEF VAR mo AS CHAR.
DEF VAR lday AS CHAR.
DEF VAR ltime AS CHAR.
DEF VAR lyear AS CHAR.
DEF VAR who AS CHAR.
DEF VAR tty AS CHAR FORMAT "X(10)".
UNIX SILENT echo 'x' | proshut demo | grep `whoami` > whoami.dat.
INPUT FROM whoami.dat NO-ECHO.
IMPORT userno pid dow mo lday ltime lyear who tty.
INPUT CLOSE.
UNIX SILENT rm whoami.dat.
DISPLAY userno LABEL "User" pid LABEL "Process"
dow + " " + mo + " " + lday + " " + lyear + " " +
ltime FORMAT "X(30)"
LABEL "Login Time" who LABEL "User Id" tty LABEL "Device".
/* END OF PROCEDURE */
The output of this procedure looks like this:
User Process Login Time User Id Device
---- ------- ------------------------ -------- ----------
1 4855 Tue Jul 21 1992 16:47:04 gfs /dev/ttyp5
Another approach is to read in the value of an environment variable,
such as those you set in your PROGRESS scripts, and then use that as
data in your procedure.
DEFINE VARIABLE dbdir AS CHAR FORMAT "X(50)".
UNIX SILENT echo $DBDIR > dbdir.loc.
INPUT FROM dbdir.loc.
IMPORT dbdir.
dbdir = dbdir + "/dbname".
CONNECT VALUE(dbdir).
RUN proc1.p.