c#subroutine rdhead     srs     v1.1     jan 1981
	subroutine rdhead(iun,ifmt)
c
c	This routine reads the header or title record
c	from a formatted coordinate file. The formats
c	accomidated by the program are listed in the
c	comment section for FTCHUZ.
c
c
c	v1.1: error handling prevents bomb if title
c		cards missing. Note this may result in
c		loss of up to three coordinate records.
c		for a diamond file
c
c
c	the file is assumed to exist on unit IUN.
c
c****************************************************
c&
	character*1 ijunk
	character*80 title
	character*4 junk
c
	go to (100,10,20,100,100,100),ifmt
c 
c ****  Kraut format; read the CELL and GRID cards
10	read(iun,6,end=500,err=12) junk
	read(iun,6,end=500,err=12) junk
	go to 100
12	rewind iun
	go to 100
c ****  Diamond format; read a title
20	print *,' '
	print *,'Title of Diamond formatted Coordinate file:'
	read(iun,6,end=500,err=21)iijunk
21	read(iun,1,end=500,err=22)title
22	read(iun,6,end=500,err=23)iijunk
	print *,title
23	print *,'No title record'
c ****  header structure unknown or header absent
100	return
c
500	print 3, ifmt,iun
	stop
1	format(a80)
3	format(1x,'unexpected eof on header read',/,
     *  1x,'format type:',i5,/,1x,'unit:',i5,//)
6	format(a1)
66	format(i5)
	end
