C
C INITIALIZES I/O SYSTEM.  DEPENDENT OF CRAPSI, SHOULD PROBABLY *NEVER*
C  BE CALLED EXPLICITLY.
C
      SUBROUTINE INITIO(INTIME,I0)
      IMPLICIT INTEGER (A-Z)
      LOGICAL YESNO,GAMLAM
      CHARACTER*8 NAMES(5)
      CHARACTER*80 FNAME
      INTEGER USEC,USECIN,TSTART,WSTART
      COMMON / / ICORE(1)
      COMMON /INCORE/ ICREC(2),USEC,IXT(2),IMOD(2)
      COMMON /MACHSP/ IINTLN,IFLTLN,IINTFP,IALONE,IBITWD
      COMMON /FILES/ LUOUT,MOINTS
      COMMON /LISTS/ MOIO(10,500),MOIOWD(10,500),MOIODS(10,500),
     &               MOIOSZ(10,500),MOIOFL(10,500)
      COMMON /FLAGS/ IFLAGS(100)
      COMMON /IOPOS/ ICRSIZ,ICHCSZ,IOFF(2),LENREC
      COMMON /FILSPC/ IBUFLN,IPRCLN,IPRCWD
      COMMON /CACHEINF/ CACHSIZ,CACHSZP1,CACHDIR(100),CACHPOS(100),
     &                  CACHFILE(100),CACHMOD(100),OLDEST
      DATA NAMES /'MOINTS  ','GAMLAM  ','MOABCD  ','DERINT  ',
     &            'DERGAM  '/
C
      LENMOIO=5000
C
C INITIALIZE FILE IO INFORMATION IF INTIME = -1 (INTPROC ONLY)
C
      IF(INTIME.EQ.-1)THEN
c YAU : old
c      CALL IZERO(MOIO,LENMOIO)
c      CALL IZERO(MOIODS,LENMOIO)
c      CALL IZERO(MOIOSZ,LENMOIO)
c      CALL IZERO(MOIOWD,LENMOIO)
c      CALL IZERO(MOIOFL,LENMOIO)
c YAU : new
       call aces_io_zero
c YAU : end
      ELSE
       DO 10 I=50,54
        IPOS=IIEQ(LENMOIO,MOIOFL,1,I)
        IF(IPOS.NE.0)THEN
         CALL GFNAME(NAMES(I-49),FNAME,ILENGTH)
         INQUIRE(FILE=FNAME(1:ILENGTH),EXIST=YESNO)
         IF(YESNO)THEN
          CALL ACES_IO_OPEN(I-49)
         ELSE
          WRITE(6,1000)I
1000      FORMAT(T3,'@INITIO-F, Unit ',I3,' contained in list directory'
     &             ,' but is not on disk.')
          CALL ERREX
         ENDIF
        ENDIF
10     CONTINUE
      ENDIF
C
C INITIALIZE ALL OF THE CACHE INFORMATION
C
      IF(INTIME.NE.0)CALL IZERO(CACHDIR,100)
      OLDEST=1
      RETURN
      END
