Jump to page titleUNITED STATES
hp.com home products and services support and drivers solutions how to buy
» contact hp

:

more options
 

hp.com home
End of Jump to page title
Example-PL/I: Use Of $GETJPI To Retrieve The Process ID
Jump to content



» 

business support center

Home & Home Office Support:
» HP branded products
» Presario branded products
» Services & Warranties
Small & Medium Business Support:
» Small & Medium Business products
» Small & Medium Business services
Support for IT Professionals:
» Enterprise products (IT Resource Center)
» NonStop enterprise products
» Business & IT Services
Content starts here
Copyright (c) Digital Equipment Corporation 1985. All rights reserved

OVERVIEW:

This example will demonstrate how to set up an item list to retrieve the
Process ID of the running process using the system service SYS$GETJPI.

CAUTION:  This sample program has been tested using PL/I V2.2 on VMS V4.1.
However, we cannot guarantee its effectiveness because of the possibility
of error in transmitting or implementing it.  It is meant to be used as a
template for writing your own program, and it may require modification for
use on your system.

The length of this article is about 85 lines.


PROGRAM EXAMPLE:

ST:     PROCEDURE OPTIONS (MAIN);

        %INCLUDE SYS$GETJPI;
        %INCLUDE $JPIDEF;
        %INCLUDE $STSDEF;
        %INCLUDE SYS$WAITFR;

/* Declare item list structure for $GETJPI */

        DCL 01 ITEMLST,
                02      SIZE    FIXED BIN(15),
                02      CODE    FIXED BIN(15),
                02      PID     POINTER,
                02      PIDX    FIXED BIN(31),
                02      END     FIXED BIN(31);

        DCL EFN         FIXED BINARY(31) INIT(3);
        DCL MASK        BIT(32) INIT('00000000000000000000000000000100'B);
        DCL PID_HEX     CHARACTER(11);
        DCL PROCESS_PID FIXED BIN(31);

        DCL OTS$CVT_L_TZ EXTERNAL ENTRY
                (FIXED BIN(31), /* VALUE */
                 CHARACTER (*), /* OUT-STRING */
                 ANY,           /* INT-DIGITS */
                 ANY)           /* VALUE-SIZE */
        OPTIONS(VARIABLE) RETURNS (FIXED BIN(31));

/* Initialize the item list structure */

        SIZE = 4;
        CODE = JPI$_PID;
        PID  = ADDR(PROCESS_PID);
        PIDX = 0;
        END = 0;

/* Call $GETJPI and wait for it to complete */

        STS$VALUE = SYS$GETJPI(EFN,,,ITEMLST,,,);
        IF ^STS$SUCCESS THEN SIGNAL VAXCONDITION(STS$VALUE);

        STS$VALUE = SYS$WAITFR(EFN);
        IF ^STS$SUCCESS THEN SIGNAL VAXCONDITION(STS$VALUE);

/* Convert the PL/I bit string to a Hex ASCII string for output */

        STS$VALUE = OTS$CVT_L_TZ(PROCESS_PID, PID_HEX, , );
        IF ^STS$SUCCESS THEN SIGNAL VAXCONDITION(STS$VALUE);

        PUT SKIP LIST ('Process ID in HEX: ',PID_HEX);

        END ST;



buy online or call 1.800.AT.COMPAQ
privacy statementusing this site means you accept its terms