      REAL FUNCTION RNRM(X,Y,N,IFLAG)
C
C   IFLAG=0    CALCULATE THE MAXIMUM NORM OF X.
C   IFLAG=1    CALCULATE THE MAXIMUM NORM OF X-Y.
C
      DIMENSION X(N),Y(N)
      IF(IFLAG .EQ. 1) GO TO 2
C   FIND THE NORM OF X.
      RNRM=0.0
      DO 1 I=1,N
1     RNRM=AMAX1(RNRM,ABS(X(I)))
      RETURN
C   FIND THE NORM OF X-Y.
2     RNRM=0.0
      DO 3 I=1,N
3     RNRM=AMAX1(RNRM,ABS(X(I)-Y(I)))
      RETURN
      END
