
C
C     COMMERCIAL SUBROUTINE PACKAGE MANIPULATION ROUTINES
C
C     TAKEN FROM THE IBM 1130 COMMERCIAL SUBROUTINE PACKAGE
C     REWRITTEN IN FORTRAN FOR THE DECSYSTEM-10 BY -
C     PETE SCHILLING     ALCOA TECHNICAL CENTER     MAY, 1974
C
      SUBROUTINE FILL ( JCARD, J, JLAST, NCH )
C
C     FILLS AREA JCARD(J) THROUGH JCARD(JLAST) WITH
C     CHARACTER  NCH .
C
      DIMENSION JCARD(1)
      JEND = JLAST
      IF ( J .GT. JLAST ) JEND = J
      DO 10  JNOW = J, JEND
      JCARD(JNOW) = NCH
   10 CONTINUE
      RETURN
      END
      SUBROUTINE MOVE ( JCARD, J, JLAST, KCARD, K )
C
C     MOVES DATA FROM JCARD(J) THROUGH JCARD(JLAST) TO
C     KCARD(K) THROUGH KCARD(K+JLAST-J)
C
      DIMENSION JCARD(1), KCARD(1)
      JEND = JLAST
      IF ( J .GT. JLAST ) JEND = J
      K1 = K - J
      DO 10  JNOW = J, JEND
      KNOW = K1 + JNOW
      KCARD(KNOW) = JCARD(JNOW)
   10 CONTINUE
      RETURN
      END
      FUNCTION NCOMP ( JCARD, J, JLAST, KCARD, K )
C
C     COMPARES JCARD(J) THROUGH JCARD(JLAST) WITH KCARD(K)
C     THROUGH KCARD(K+JLAST-J), RETURNING -1 IF JCARD IS
C     LESS, 0 IF JCARD EQUALS KCARD, AND +1 IF JCARD IS
C     GREATER.
C
      DIMENSION JCARD(1), KCARD(1)
      DATA ICLEAR / "377777777777 /
      JEND = JLAST
      IF ( J .GT. JLAST ) JEND = J
      K1 = K - J
      DO 10 JNOW = J, JEND
      KNOW = K1 + JNOW
      IF ( JCARD(JNOW) .EQ. KCARD(KNOW) ) GO TO 10
      JCOMP = JCARD(JNOW) / 2
      KCOMP = KCARD(KNOW) / 2
      JCOMP = JCOMP .AND. ICLEAR
      KCOMP = KCOMP .AND. ICLEAR
      IF ( JCOMP .LT. KCOMP ) GO TO 6
C     IF NOT EQUAL OR LESS THAN, MUST BE GREATER THAN.
      NCOMP = 1
      GO TO 20
C
    6 NCOMP = -1
      GO TO 20
C
   10 CONTINUE
      NCOMP = 0
C
   20 RETURN
      END
