      SUBROUTINE PRNS(Y,LB,LL,MM,H,FI,IPW,KPW,KCH,ZAP)
      CHARACTER Z1*10,Z2*27,ZAP*8
C
C        IPW=  1 - A(B),
C              2 - FORMAT I3,
C              3 - FORMAT F3.1,
C        KPW=  0 - WITHOUT CHANGES
C              1 - MAXIMUM DIVIDED
C        KCH - CHANAL NUMBER
C
      DIMENSION Y(LL,MM),I1(18),I2(18),KM(18),A(10),YL(99,99)
      DIMENSION Z1(5),H(*),FI(*)
      DATA Z1/'(/43X',2*'(/25X',2*'(/16X'/,
     *Z2/',A8,'' MULT.FACTOR'',1PE7.0)'/
      IF(LB.EQ.1)THEN
           M=MM
           L=LL
      ELSE
           M=LL
           L=MM
      ENDIF
      MSTE=M
      M=18
      KSTE=MSTE/M
      DO 6 K=1,M
         KK=KSTE*K
         KM(K)=INT(FI(KK))
         DO 6 I=1,L
            IF(LB.EQ.1)THEN
                 YL(I,K)=Y(I,KK)
            ELSE
                 YL(I,K)=Y(KK,I)
            ENDIF
   6     CONTINUE
      IF(KPW.EQ.1)THEN
            DMN=YL(1,1)
            DO 50 I=1,L
               DO 50 K=1,M
  50              DMN=AMAX1(DMN,YL(I,K))
            IF(DMN.GT.0.)THEN
                  DMN1=10**(INT(ALOG10(DMN))-2.)
            ELSE
                  DMN1=1.
            END IF
      ELSE
            DMN1=10**(-1.*KPW)
      END IF
      DO 51 I=1,L
         DO 51 K=1,M
  51        YL(I,K)=YL(I,K)/DMN1
      WRITE(KCH,Z1(IPW)//Z2)ZAP,DMN1
      GOTO(3,4,4,5,5),IPW
   3  WRITE(KCH,14)(KM(K),K=1,M)
      GOTO7
   4  WRITE(KCH,16)(KM(K),K=1,M)
      GOTO7
   5  WRITE(KCH,18)(KM(K),K=2,M,2)
      DO 40 I=1,L
         DO 40 K=1,M
            IF(IPW-5)41,42,42
  41        YL(I,K)=YL(I,K)
            GOTO40
  42        YL(I,K)=ALOG10(YL(I,K))
  40        CONTINUE
      YMI=YL(1,1)
      YMA=YMI
      DO 9 K=1,M
         DO 9 I=1,L
            IF(YL(I,K).GT.YMA)YMA=YL(I,K)
            IF(YL(I,K).LT.YMI)YMI=YL(I,K)
   9     CONTINUE
      DY=(YMA-YMI)/10.
      DO 24 J=1,10
  24     A(J)=YMI+(J-1)*DY
   7  DO 1 II=1,L
         I=L-II+1
         DO 2 K=1,M
            GOTO(21,22,2,23,23),IPW
  21        IF(YL(I,K).EQ.0.)GOTO36
            AA1=ALOG10(ABS(YL(I,K)))
            IF(AA1)37,38,38
  37        I1(K)=AA1-0.9777
            IF(I1(K)+10)36,36,39
  38        I1(K)=AA1+0.0223
  39        IF(YL(I,K))31,36,32
  31        I2(K)=YL(I,K)/10**(I1(K)*1.)-0.5
            GOTO2
  36        I1(K)=0
            I2(K)=0
            GOTO2
  32        I2(K)=YL(I,K)/10**(I1(K)*1.)+0.5
            GOTO2
  23        DO 35 J=1,10
               IF(YL(I,K).GE.A(J))I1(K)=J-1
  35           CONTINUE
            GOTO2
  22        I1(K)=YL(I,K)+0.5
   2        CONTINUE
         GOTO(25,26,46,27,27),IPW
  25     WRITE(KCH,10)INT(H(I)),(I2(K),I1(K),K=1,M),INT(H(I))
         GOTO1
  26     WRITE(KCH,11)INT(H(I)),(I1(K),K=1,M),INT(H(I))
         GOTO1
  46     WRITE(KCH,47)INT(H(I)),(YL(I,K),K=1,M),INT(H(I))
         GOTO1
  27     IF(I.LE.13.OR.I.GT.23)GOTO33
         IP1=I-14
         IF(IPW-5)44,45,45
  45     A1=10**A(IP1+1)
         A2=A1*10**DY
         GOTO43
  44     A1=A(IP1+1)
         A2=A1+DY
  43     WRITE(KCH,20)INT(H(I)),(I1(K),K=1,M),INT(H(I)),IP1,A1,A2
         GOTO1
  33     WRITE(KCH,19)INT(H(I)),(I1(K),K=1,M),INT(H(I))
   1     CONTINUE
      GOTO(28,29,29,30,30),IPW
  28  WRITE(KCH,14)(KM(K),K=1,M)
      GOTO8
  29  WRITE(KCH,16)(KM(K),K=1,M)
      GOTO8
  30  WRITE(KCH,18)(KM(K),K=2,M,2)
  10  FORMAT(I3,18(I2,1H(,I2,1H)),I3)
  11  FORMAT(I3,18I4,I3)
  12  FORMAT(/53X,2A4)
  14  FORMAT(/3H KM,18(I5,1X),3H KM/)
  15  FORMAT(/35X,2A4)
  16  FORMAT(/3H KM,8I4,2(I3,1X),8I4,3H KM/)
  17  FORMAT(/26X,2A4)
  18  FORMAT(/3H KM,1X,4I6,I5,4I6,3H KM/)
  19  FORMAT(20I3)
  20  FORMAT(20I3,5X,I2,5H - OT,1PE10.2,3H DO ,1PE10.2)
  47  FORMAT(I3,18F4.1,I3)
   8  RETURN
      END


