C***   A5TOA1

       SUBROUTINE A5TOA1(A,B,C,CHARS,LENG)

C  A AND B CONTAIN A 1- TO 9-CHARACTER WORD IN A5 FORMAT, C CONTAINS ANOTHER
C  WORD AND/OR PUNCTUATION.  THEY ARE UNPACKED TO ONE CHARACTER PER WORD IN THE
C  ARRAY "CHARS", WITH EXACTLY ONE BLANK BETWEEN B AND C (OR NONE, IF C >= 0).
C  THE INDEX OF THE LAST NON-BLANK CHAR IN CHARS IS RETURNED IN LENG.

       IMPLICIT INTEGER(A-Z)
       DIMENSION CHARS(20),WORDS(3),AW(12),BW(6),CW(6)
      REAL*8 A(1),B(1),C(1)
      DECODE(6,101,A)(AW(I),I=1,6)
      DECODE(6,101,B)(AW(I),I=7,12)
      IF(C(1).NE.0)DECODE(6,101,C)CW
101   FORMAT(6A1)
      DO 5 I=1,12
      IF(AW(I).EQ.' ')GOTO 10
      CHARS(I)=AW(I)
5     CONTINUE
      LENG=12
      GOTO 15
10    CONTINUE
      LENG=I-1
15    IF(C(1).NE.0) GOTO 30
      LENG=LENG+1
      IF(LENG.EQ.13)CHARS(13)=' '
      RETURN
30    DO 40 I=1,6
      IF(CW(I).EQ.' ')RETURN
      LENG=LENG+1
      CHARS(LENG)=CW(I)
40    CONTINUE
      RETURN
      END
