	SUBROUTINE GETPAT_DISK (STARTING_BYTE, BUFFER, NBYTES, STATUS)

C======================================================================
C
C	<<<<<<<<<<<<<<<< DISK VERSION, VAX >>>>>>>>>>>>>>>>>
C
C	   Routine to retrieve a pattern from the PDF-2 magnetic DISK based
C	   distributed data base (must be copied to and reside on disk),
C	   given it's byte offset (beginning at zero).
C
C	   STARTING_BYTE - Byte offset from the start of the file, from 0
C	   BUFFER        - an 80 col buffer to put the AIDS format cards in
C	   NBYTES        - number of bytes read for this pattern
C	   STATUS        - 0 if no error, 1 if no end of block found
C	   	         - 3 end-of-file or other error
C	   	         - 5 other error
C
C	   By: Mark Holomany      Date: 25-Apr-1988
C
C renamed to GETPAT_DISK for Powder Suite by Brian Toby 10/90
C     also, additional STATUS codes assigned for error conditions
C======================================================================

	IMPLICIT INTEGER (A-Z)

	CHARACTER*80  BUFFER(135)

 	INCLUDE  'CDROM.CMN'
	INCLUDE  'IORET.CMN'
       	INCLUDE  'PDFDATA.CMN'

	STARTING_RECORD = (STARTING_BYTE + 80)/80
C
C	 ... Read in data set starting at STARTING_RECORD
	STATUS = 0
	DO 4010 NREC=1,135
!	READ (PDFDAT,REC=STARTING_RECORD+NREC-1,ERR=9002)
	READ (PDFDAT,'(A80)',END=9001,ERR=9002)
     1		BUFFER(NREC)
	IF(BUFFER(NREC)(80:80) .EQ. 'K') THEN
D	type *,NREC,' Records read, start=',starting_record
	   NBYTES = (NREC)*80
	   GO TO 9000
	ENDIF
4010	CONTINUE
	CALL ERRTXT ('E', '>135 cards read in AIDS format in GETPAT')
	STATUS = 1

9000	RETURN
9001	STATUS = 3
	RETURN
9002	STATUS = 5
	RETURN
	END
