	.TITLE	GETPRCCNT - GET PROCESS COUNT FROM JIB
	.IDENT	'V4.1'

;++
; FACILITY:	WATCHDOG
;
; ABSTRACT:	Retrieve Subprocess Count From Job Information 
;		Block
;
; ENVIRONMENT:	native/kernal mode, privileged code
;
; AUTHOR:	 
;	George H. Walrod III	CREATION DATE: 17-MAR-1986
;
; MODIFICATION HISTORY:
;	None
;
;	CALLS/G	GETPRCCNT
;
; INPUT PARAMETERS:
;	4(AP)	Address of Longword for PCB Index
;	8(AP)	Address of Longword return Status
;
; OUTPUT PARAMETERS:
;	R0	Status of Call	- Longword
;	8(AP)	Process Count	- Longword
;
; IMPLICIT OUTPUTS:
;	NONE
;
; COMPLETION CODES:
;	NONE
;
; SIDE EFFECTS:
;
;--
	.LIBRARY	/SYS$LIBRARY:LIB.MLB/
	.psect	data,wrt,noexe
status:	.blkl	1
pcb_index:
	.blkw	1
prccnt:
	.blkl	1

	.psect	code,exe,nowrt,rd
getprccnt::
	.word	0
	movl	@4(ap),pcb_index
	movl	prccnt,@8(ap)
	$CMKRNL_S	-
		routin = getjibinfo, -
		arglst = #0
	movl	prccnt,@8(ap)
	movl	status, r0
	ret

getjibinfo::
	.word	^m<r6,r8>
	dsbint	#ipl$_astdel		; Raise IPL to Astdel to Access DB
	movl	#ss$_nopriv,status	; Set Bad Status
	movl	g^sch$gl_maxpix,r6	; Get Maximum Index Number
	movl	pcb_index,R8		; Convert to Longword
	cmpl	R8,R6			; Check to See if In Range
	bgtru	100$			; Bad Index Return
	movl	g^sch$gl_pcbvec,r6	; Vector of PCB Address
	movl	(r6)[r8],r6		; Address of Pointer to PCB
	movl	pcb$l_jib(r6),r6	; Address of Jib
	cvtwl	jib$w_prccnt(r6),prccnt	; Set Subprocess Count
        movl	#ss$_normal,status	; Set Normal Status
100$:
	enbint				; Restore IPL
        movl	#ss$_normal,r0		; Come Out of Kernal Mode Clean
	ret				; That's all in Kernal Mode.
	.word	0
	.end
