C$TEST PRSM
C TO RUN AS A MAIN PROGRAM REMOVE NEXT LINE
      SUBROUTINE PRSM
C***********************************************************************
C
C  EXAMPLE OF USE OF THE PORT PROGRAM SPFCE
C
C***********************************************************************
       INTEGER N1, N2, N, MCP(500), MRP(500), MAXIW, IW, I
       INTEGER I1MACH, IREAD, IWRITE, TEMP, ISTAK(20000)
       REAL A1, RSTAK(20000)
       DOUBLE PRECISION DSTAK(10000)
       EXTERNAL QUEI, QUEA
       COMMON /QUE/ A1, K
       COMMON /CSTAK/ DSTAK
       EQUIVALENCE(RSTAK(1),DSTAK(1),ISTAK(1))
       CALL ISTKIN(10000,4)
       IREAD = I1MACH(1)
       IWRITE = I1MACH(2)
       CALL ISTKIN(20000, 2)
       READ(IREAD,11)K
  11   FORMAT(I3)
       IF (K. EQ. 0) STOP
       N = K*K - 1
       WRITE(IWRITE,12)N
  12   FORMAT(20H NO. OF EQUATIONS = ,I3)
C
C DETERMINE THE ORDERING
C
       CALL SPFOR(N, QUEI, MRP)
C
C GET THE WORK SPACE FROM THE STORAGE STACK
C
       MAXIW = (ISTKQU(2)-3*N-50)/2
       IW = ISTKGT(MAXIW, 2)
       IUL = ISTKGT(MAXIW, 3)
C
C READ IN PARAMETER
C
  20   READ(IREAD, 21)A1
  21   FORMAT(E15.7)
       IF (A1.EQ.0.0E0) STOP
       WRITE(IWRITE, 22)A1
  22   FORMAT(/4H A1=, E15.5)
C
C GET THE CONDITION NUMBER
C
       CALL SPFCE(N, MRP, MCP, QUEA, ISTAK(IW), RSTAK(IUL), MAXIW,
     1 ISIZE, COND)
       WRITE(IWRITE,23)COND
  23   FORMAT(20H CONDITION NUMBER = ,E15.5)
       GO TO 20
       END
