C
C FUNCTION SUBROUTINE TO DETERMINE PROCESS PID
	INTEGER FUNCTION PID
	IMPLICIT INTEGER (A-Z)
	INTEGER*2 IOSB(4), ITMLST(8)
	EQUIVALENCE (ITMLST(3), BUFADR), (ITMLST(5), RLADR),
	1 (ITMLST(7), LSTEND)
	EXTERNAL JPI$_PID
	ITMLST(1)= 4
	ITMLST(2)= %LOC(JPI$_PID)
	BUFADR= %LOC(PIDBUF)
	RLADR= 0
	LSTEND= 0
	CALL LIB$GET_EF(EF)
	STATUS= SYS$GETJPI(%VAL(EF),,, ITMLST, IOSB,,)
	IF (.NOT. STATUS) CALL EXIT(STATUS)
	CALL SYS$WAITFR(%VAL(EF))
	IF (.NOT. IOSB(1)) CALL EXIT(IOSB(1))
	PID= PIDBUF
	CALL LIB$FREE_EF(EF)
	RETURN
	END

