C.hr HEADER
C@
C....*...1.........2.........3.........4.........5.........6.........7.*
C     HEADER   7/16/87
C
C     PURPOSE
C     TITLE OUTPUT.
C
C     USAGE
C     CALL HEADER(TITLE)
C
C     ARGUMENTS
C     TITLE - A CHARACTER STRING ENCLOSED IN QUOTES.  THE LAST CHARACTER
C             MUST BE AN UNDERSCORE.  THE STRING IS MADE UP OF AN UN-
C             LIMITED NUMBER OF CONCATONATED LINES.  A LINE IS MADE UP
C             OF 0-68 CHARACTERS FOLLOWED BY A SLASH.
C
C     REMARK
C     AN EXAMPLE IS:
C     CALL HEADER('//LINE 1/LINE 2/LINE 3///_')
C
C     COMMENT
C     THE DEFAULT LINESIZE IS 133, 132 PLUS CARRIAGE CONTROL CHARACTER.
C     THE USAGE:
C     COMMON /ZLNSIZ/ LNSIZE
C     LNSIZE=80
C     WILL CHANGE THE LINESIZE TO 80.  LINESIZES BETWEEN 72 AND 133 ARE
C     PERMITTED.
C
C
      SUBROUTINE HEADER(TITLE)
      IMPLICIT REAL*8 (A-H,O-Z)
      save
      COMMON /ZLNSIZ/ LNSIZE
      CHARACTER*1 DIGIT(10),LDUMMY(8)
      CHARACTER*1 TITLE(133),PRINT(68),SLASH,UNC,LTR,BLANK
      CHARACTER*4 DUMMY(18)
      CHARACTER*8 FMT1(11),FMT2(3),FMT3(3),RDUMMY
      CHARACTER*24 CFMT2,CFMT3
      CHARACTER*88 CFMT1
      EQUIVALENCE (FMT1(1),CFMT1),(FMT2(1),CFMT2),(FMT3,CFMT3)
      EQUIVALENCE (RDUMMY,LDUMMY(1)),(DUMMY(1),PRINT(1))
      DATA FMT1/'(1X,    ','X,70H***',8*'********','***  )  '/
      DATA FMT2/'(1X,    ','X,1H*,17','A4,1H*) '/
      DATA FMT3/'(1X,    ','X,1H*,68','X,1H*)  '/
      DATA DIGIT/'0','1','2','3','4','5','6','7','8','9'/
      DATA SLASH/'/'/,UNC/'_'/,BLANK/' '/
      NOUT=3
      LNSIZ=LNSIZE
      IF((LNSIZE.LT.72).OR.(LNSIZE.GT.133)) LNSIZ=133
      RDUMMY=FMT1(1)
      IPAD=(LNSIZ-72)/2+1
      IPAD10=IPAD/10
      IPAD1=IPAD-10*IPAD10
      LDUMMY(7)=DIGIT(IPAD10+1)
      LDUMMY(8)=DIGIT(IPAD1+1)
      FMT1(1)=RDUMMY
      FMT2(1)=RDUMMY
      FMT3(1)=RDUMMY
      WRITE(NOUT,3001)
      WRITE(NOUT,3001)
      WRITE(NOUT,CFMT1)
      M=0
      L=0
10    M=M+L
      L=0
      DO 20 I=1,69
      LTR=TITLE(M+I)
      IF((LTR.EQ.SLASH).OR.(LTR.EQ.UNC)) GO TO 25
20    L=I
25    IF((L.EQ.0).AND.(LTR.EQ.UNC)) GO TO 50
      IF(L.EQ.0) GO TO 60
      IPAD=(68-L)/2
      DO 30 I=1,68
30    PRINT(I)=BLANK
      DO 40 I=1,L
40    PRINT(I+IPAD)=TITLE(M+I)
      WRITE(NOUT,CFMT2) (DUMMY(I),I=1,17)
      L=L+1
      LTR=TITLE(M+L+1)
      IF(LTR.EQ.UNC) GO TO 50
      GO TO 10
50    WRITE(NOUT,CFMT1)
      RETURN
60    WRITE(NOUT,CFMT3)
      L=L+1
      GO TO 10
3001  FORMAT(' ')
      END
