
C OPENS THE WORD ADDRESSABLE DIRECT ACCESS FILES USED BY CRAPS

      SUBROUTINE OPNFIL(IUNIT)
      CHARACTER*8 NAME(5)
      CHARACTER*80 FNAME
      LOGICAL EXISTS
      COMMON /FILSPC/ IBUFLN,IPRCLN,IPRCWD
      COMMON /IOPOS/ ICRSIZ,ICHCSZ,IOFF(2),LENREC
 
#include "icdacc.com"

      DATA NAME /'MOINTS  ','GAMLAM  ','MOABCD  ','DERINT  ','DERGAM  '/

      CALL GFNAME(NAME(IUNIT),FNAME,ILENGTH)
      INQUIRE(FILE=FNAME(1:ILENGTH),EXIST=EXISTS)

c YAU - old
c      IF(EXISTS)THEN
c       OPEN(UNIT=IUNIT+49,FILE=FNAME(1:ILENGTH),
c     &      FORM='UNFORMATTED',ACCESS=
c     &      'DIRECT',RECL=idaccr,STATUS= 'OLD')
c      ELSE
c       OPEN(UNIT=IUNIT+49,FILE=FNAME(1:ILENGTH),
c     &      FORM='UNFORMATTED',ACCESS=
c     &      'DIRECT',RECL=idaccr,STATUS='NEW')
c      ENDIF
c YAU - new
      IF (EXISTS) THEN
         OPEN(UNIT=IUNIT+49,FILE=FNAME(1:ILENGTH),
     &        FORM='UNFORMATTED',ACCESS='DIRECT',
     &        RECL=IPRCWD*idaccm,STATUS='OLD')
      ELSE
         OPEN(UNIT=IUNIT+49,FILE=FNAME(1:ILENGTH),
     &        FORM='UNFORMATTED',ACCESS='DIRECT',
     &        RECL=IPRCWD*idaccm,STATUS='NEW')
      END IF
c YAU - end

      RETURN
      END

