	SUBROUTINE GET_ENDIAN
C
C       This subroutine determins the endian of the curent system.
C  If the endian needs to be known in a program, this subroutine should be
C  called at the start.  Then any routines which need to know the endian
C  should incorporate the common block SYS_ENDIAN and check the variable
C  SYSTEM_ENDIAN.
C				Donald H. Gudehus, August 22, 2006
C
	BYTE PHYSREC(8)
	INTEGER*2 I2REC(4)
	INTEGER*4 I4REC(2)
	EQUIVALENCE (PHYSREC,I2REC,I4REC)

	CHARACTER*1 SYSTEM_ENDIAN
	COMMON /SYS_ENDIAN/ SYSTEM_ENDIAN
C
	DATA PHYSREC /1,2,4,8,16,32,64,128/
	DATA SYSTEM_ENDIAN /' '/
C
	IF (I2REC(1).EQ.513.AND.I2REC(2).EQ.2052.AND.I2REC(3).EQ.8208
	1.AND.I2REC(4).EQ.-32704) THEN
	  SYSTEM_ENDIAN='L'
	ELSE IF (I2REC(1).EQ.258.AND.I2REC(2).EQ.1032.AND.I2REC(3).EQ.4128
	1.AND.I2REC(4).EQ.16512) THEN
	  SYSTEM_ENDIAN='B'
	ELSE
	  SYSTEM_ENDIAN='U'
	  CALL ERROR(-3,'Unknown system endian;  call GET_ENDIAN')
	END IF
C
	RETURN
	END

