	.TITLE		GETFID - SUBROUTINE TO RETURN FILE-ID
	.PSECT		DATA,LONG
;
;	----- GETFID.MAR -----
;
;	----- Last Change 05/01/89 by Brian Lomasky -----
;
;	----- Teradyne, Inc., 179 Lincoln Street, Boston, MA  02111 -----
;	----- (617) 482-2706, x3259 -----
;
;	----- Neither Brian Lomasky nor Teradyne, Inc. implicitly or -----
;	----- explicitly implies this program is usable in any way. -----
;	----- This program is released to the public domain in an -----
;	----- "AS-IS" condition. -----
;
; Calling sequence:
;
;	CALL GETFID(FILEN, FID)
;
;		where:
;
;		FILEN :	The address of a string descriptor for the file name
;		FID   :	The address of a 3-word integer array for the return
;			file ID
;
; Note:
;	GETFID can also be called as an integer function so that the return
;	status can be tested.   e.g.  STATUS = GETFID(FILEN, FID)
;
INFAB:	$FAB	NAM=NAMBLK,FNA=NAME
INRAB:	$RAB	FAB=INFAB
NAMBLK:	$NAM
NAME:		.BLKB	63				; MAX FILE NAME SIZE=63
		.PSECT	CODE
GETFID::	.WORD	^M<R2,R3,R4,R5,R6,R7>
		MOVL	4(AP),R7			; GET FNAM DESC. ADDR.
		MOVB	(R7),W^INFAB+FAB$B_FNS		; SET FILE NAME SIZE
		MOVZBL	(R7),R6				; BYTE COUNT TO R6
		MOVL	4(R7),R7			; GET STRING ADDR.
		MOVC3	R6,(R7),W^NAME			; MOVE NAME TO "NAME"
		$OPEN	FAB=W^INFAB			; OPEN FILE
		BLBC	R0,EXIT				; IF LBC REPORT ERROR
		MOVL	8(AP),R3			; GET ADDR. FOR FID
		MOVAL	W^NAMBLK,R2			; GET NAMEBLK ADDRESS
		MOVW	W^NAM$W_FID_NUM(R2),(R3)+	; MOVE FID
		MOVW	W^NAM$W_FID_SEQ(R2),(R3)+	; MOVE FILE SEQ #
		MOVW	W^NAM$W_FID_RVN(R2),(R3)	; MOVE FILE REL VOL #
		$CLOSE	FAB=W^INFAB			; CLOSE FILE
		BLBC	R0,EXIT				; IF LBC REPORT ERROR
		MOVZWL	#SS$_NORMAL,R0			; SET SUCCESS RET CODE
EXIT:		RET
		.END
