	Integer*4 Function IMGOPN(FAB)
C	###############################################################
C	# (C) Copyright 1985 Auto-trol Technology Corporation         #
C	#                                                             #
C	# This program is the sole property of Auto-trol Technology   #
C	# Corporation and is considered a trade secret and/or a       #
C	# proprietary product of Auto-trol Technology Corporation.    #
C	# Use or disclosure of this program by other than Auto-trol   #
C	# Technology Corporation and its assigned licensees and       #
C	# customers is strictly forbidden by law.                     #
C	#                                                             #
C	# Use, duplication or disclosure by the Government is subject #
C	# to restrictions as set forth in subdivision (b)(3)(ii) of   #
C	# the Rights in Technical Data and Computer Software clause   #
C	# at 252.227.7013.                                            #
C	###############################################################
C
C      /BEGIN MODULE HEADER/        		/STANDARD MODULE HEADER/
C
C       NAME -- IMGOPN
C
C       PURPOSE -- VAX IMAGE BUILD TOOLS
C	           User OPEN routine for an image file 
C
C       CALLING SEQUENCE --
C		Called by FORTRAN OPEN(...,USROPEN=IMGOPN...)
C
C       COMMON REFERENCES --
C		/IMGCOM/ passes arguments back form open
C
C       ERRORS DETECTED --
C		Returned as VMS return status function value
C
C       EXTERNAL REFERENCES --
C
C       INTERNAL DESCRIPTION AND DESIGN CONSIDERATIONS --
C
C	  This subroutine is a FORTRAN function called during a file open
C	  operation for a file that is to be mapped as a private section.
C
C       NOTES --
C
C       HISTORY --
C         MM/DD/YY,SDRC,functional spec number,initials,comments
C	  02/24/87,,,MXB,Initial coding
C
C /END MODULE HEADER/        		    /STANDARD MODULE HEADER/
C ******************************************************************
	IMPLICIT NONE			! Force all declared
C
C PARAMETER CONSTANTS --
	INCLUDE '($FABDEF)/NOLIST'
C
C ARGUMENTS --
	RECORD /FABDEF/ FAB		! FAB definition
C
C COMMON --
	INCLUDE 'IMGCOM/NoList'		! IMGOPN common
C
C LOCAL VARIABLES --
C
C EQUIVALENCES --
C
C EXTERNALS --
	Integer*4	SYS$OPEN	! VMS System OPEN routine
C
C DATA STATEMENTS --
C
C /END DECLARATIONS/			    /STANDARD MODULE HEADER/
C ******************************************************************
C
C START OF EXECUTABLE CODE --
C
	FAB.FAB$L_FOP = FAB.FAB$L_FOP .OR. FAB$M_UFO	! Set User Open
	FAB.FAB$B_RTV = -1				! Force all RTVs
	FAB.FAB$B_SHR = FAB.FAB$B_SHR .OR. FAB$M_UPI	! Set UPI for share
C
	IMGopn = SYS$OPEN(FAB)  	! Open the file
	if (IMGopn) then
	   CHAN   = FAB.FAB$L_STV	! Retrieve VMS channel number	
	   NUMPAG = FAB.FAB$L_ALQ	! and number of pages in this file
	end if
	RETURN 
	END
