C$TEST FMTR
C TO RUN AS A MAIN PROGRAM REMOVE NEXT LINE
      SUBROUTINE FMTR
C***********************************************************************
C
C  EXAMPLE OF USE OF THE PORT PROGRAM FRMATT
C
C***********************************************************************
C  EXAMPLE PROGRAM TO FIND THE CORRECT FORMAT SPECIFICATIONS
C  AND THEN PRINT OUT AN INTEGER, REAL AND DOUBLE-PRECISION ARRAY.
C
       INTEGER K, XINT(9), IWIDTH, IWRITE
       INTEGER WSP, MANTSP, WDP, MANTDP
       REAL XREAL(9)
       DOUBLE PRECISION DFLOAT, XDP(9)
C
       IWRITE = I1MACH(2)
C
       DO 10 K=1,9
        XINT(K) = K
        XREAL(K) = FLOAT(K)
        XDP(K) = DFLOAT(K)
  10   CONTINUE
C
       CALL FRMATI(IWIDTH)
       CALL FRMATR(WSP, MANTSP)
       CALL FRMATD(WDP, MANTDP)
C
C  TAKE ONE OFF THE MANTISSA WIDTH TO ALLOW FOR 1PEW.D FORMAT.
C
       MANTSP = MANTSP - 1
       MANTDP = MANTDP - 1
C
       CALL APRNTI(XINT,  9, IWRITE, 80, IWIDTH)
       CALL APRNTR(XREAL, 9, IWRITE, 80, WSP, MANTSP)
       CALL APRNTD(XDP,   9, IWRITE, 80, WDP, MANTDP)
C
       STOP
       END
