Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!iuvax!bsu-cs!cfchiesa
From: cfchiesa@bsu-cs.UUCP (Christopher Chiesa)
Newsgroups: comp.os.vms
Subject: Re: LIB$GETJPI
Summary: LIB$GETJPI process-id parameter REVEALED!
Message-ID: <3383@bsu-cs.UUCP>
Date: 7 Jul 88 16:22:15 GMT
References: <8807071431.AA22249@ucbvax.Berkeley.EDU>
Organization: CS Dept, Ball St U, Muncie, Indiana
Lines: 66

In article <8807071431.AA22249@ucbvax.Berkeley.EDU>, sysmgr@JALCF.WPAFB.AF.MIL ("SYSTEM") writes:
> 
> 	I want to use LIB$GETJPI to return information on any process
> running on the system. The ORANGE book gives me this:
> 
> LIB$GETJPI  item-code,[,process-id] [,process-name] [,outvalue]....etc
> 
> 	The problem I'm having is with the [,process-id] part. The book
> tells us the process-id is "the address of an unsigned longword containing 
> the process identification." How do I fill this parameter?
> 

I know the feeling.  I used to get all tangled up in the "address of an
unsigned longword..." syntax of the Orange Books, too.  

What this means, is that rather than passing LIB$GETJPI the actual value
of the process-id you want to look at, you pass the ADDRESS of the place
where the actual value is stored.  If you've ever programmed in Pascal,
for example, this is the difference between "non-VAR" and "VAR" parame- 
ters to a procedure or function.  In VMS it is designated as "by value"
vs. "by reference."

It's been a while since I programmed in FORTRAN, but I believe you can
take care of the problem something like so:

       INTEGER*4 PID         <---  "*4" makes it a LONGWORD
          .
          .
          .
       [whatever you have to do to put a value in PID, and
        invoke LIB$GETJPI...]

         STATUSCODE = LIB$GETJPI( item_code, %LOC PID, .... )

The %LOC modifier forces the compiler to code for passing of PID "by 
reference," rather than "by value" which is apparently the default.
Like I said, it's been a while; if any more up-to-date FORTRANers 
would care to correct me, that's fine!

> 	If I want LIB$GETJPI to return certain information on process 23d
> how would I put it in [,process-id]????

Well, in my experience, you have to use the FULL 8-hex-digit (32-bit,
i.e. a LONGWORD) process-id, rather than just the last few digits which
are unique from one process to the next.   Also you must beware that 
the PID must be represented in binary, NOT as an eight-character read-
able STRING...  Note that PIDs are generally displayed in HEX by VMS,
so you'd need to perform some sort of input conversion if you wanted to
be able to TYPE IN a hex PID value and send it to LIB$GETJPI.  In MACRO,
I use LIB$GET_INPUT to obtain the string representation of PID, then 
use LIB$CVT_XTB to turn that into the binary representation needed for 
LIB$GETJPI.  

> 
> 	Any help on this subject would be greatly appreciated!
> 
> Thanx
> 
> Don
 
I hope this HAS helped somewhat...

   Chris

-- 
UUCP: !{iuvax,pur-ee,uunet}!bsu-cs!cfchiesa 
cfchiesa@bsu-cs.UUCP