      SUBROUTINE Y12MAF(N, Z, A, SNR, NN, RNR, NN1, PIVOT, HA,
     1IHA,AFLAG,IFLAG,B,IFAIL)
      IMPLICIT DOUBLE PRECISION (A-B,G,P,T-Y), INTEGER (C,F,H-N,R-S,Z)
      DOUBLE PRECISION A(NN), PIVOT(N), AFLAG(8),B(N)
      INTEGER SNR(NN), RNR(NN1), HA(IHA,11), IFLAG(10)
      AFLAG(1)=16.0D0
      AFLAG(2)=1.D-12
      AFLAG(3)=1.D+16
      AFLAG(4)=1.D-12
      IFLAG(2)=2
      IFLAG(3)=1
      IFLAG(4)=0
      IFLAG(5)=1
      CALL Y12MBF(N,Z,A,SNR,NN,RNR,NN1,HA,IHA,AFLAG,IFLAG,IFAIL)
      IF(IFAIL.NE.0)GO TO 1
      CALL Y12MCF(N,Z,A,SNR,NN,RNR,NN1,PIVOT,B,HA,IHA,AFLAG,IFLAG,
     1 IFAIL)
      IF(IFAIL.NE.0)GO TO 1
      CALL Y12MDF(N,A,NN,B,PIVOT,SNR,HA,IHA,IFLAG,IFAIL)
1     RETURN
      END
