      SUBROUTINE ACCSTP
C     ****
C     ****     ACCESS NEEDED MASS STORE VOLUMES
C     ****
      include "params.h"
      include "cons.h"
      include "strt.h"
      include "unit.h"
      include "amie.h"
      INTEGER DNAME
C     ****
C     ****     CHECK FOR ACCESS TO HISTORY VOLUME
C     ****
      IF(MODEST.NE.-1.AND.MODEST.NE.2)GO TO 2
      IF(MODEST.EQ.2.AND.IHIS.EQ.MHIS)GO TO 2
C     ****
C     ****     READ HISTORY VOLUME FROM MASS STORE TO FILE HISTCPY
C     ****
      DNAME = 'HISTCPY'
      call acquire(labhis(1,itap),dname,istat,tmpdir)
      IF(ISTAT.EQ.0)GO TO 3
        NUM = 3
        GO TO 1000
    3 CONTINUE
      GO TO 8
    2 CONTINUE
C     ****
C     ****     ASSIGN HISTORY FILE OUTPUT
C     ****
    8 CONTINUE
C     ****
C     ****     READ MAGNETIC DATA FROM MS TO FILE, MAGNET
C     ****
      DNAME = 'MAGNET'
      call acquire(labmag,dname,istat,tmpdir)
      IF(ISTAT.EQ.0)GO TO 5
        NUM = 5
        GO TO 1000
    5 CONTINUE
C     ****
C     ****     ASSIGN MAGNETIC DATA FILE TO UNIT 17
C     ****
C     ****
C     ****     ACCESS AMIE VOLUME IF NEEDED
C     ****
      IF(IAMIE.EQ.1)THEN
C       ****
C       ****     READ AMIE VOLUMES FROM MASS STORE TO FILES AMIES,NH
C       ****
	DNAME = 'SHAMIE'
        call acquire(labsami,dname,istat,tmpdir)
	DNAME = 'NHAMIE'
        call acquire(labnami,dname,istat,tmpdir)
      ENDIF
C     ****
C     ****     ACCESS LABSRC IF MODEST = 1, 3, OR 5
C     ****
      IF(MODEST.NE.1.AND.MODEST.NE.3.AND.MODEST.NE.5)RETURN
C     ****
C     ****     READ SOURCE VOLUME FROM MS TO FILE, SOURCE
C     ****
      DNAME = 'SOURCE'
      call acquire(labsrc,dname,istat,tmpdir)
      IF(ISTAT.EQ.0)GO TO 7
        NUM = 7
        GO TO 1000
    7 CONTINUE
      REWIND ISORC
C     ****
C     ****     ASSIGN SOURCE FILE
C     ****
      RETURN
 1000 CONTINUE
      WRITE(6,1001)NUM,ISTAT
 1001 FORMAT(* ACCSTP --- error returned in ISTAT at NUM=*,I2,
     1  *, ISTAT=*I2)
      STOP
      END
C
C
