



      INTEGER FUNCTION GVF2SM(IVEC,NUM)


















      IMPLICIT      NONE
      INTEGER       NUM, I
      INTEGER*2     IVEC(NUM)





      GVF2SM=0
      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            GVF2SM=GVF2SM+IVEC(I)
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSD05')
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSD06',NUM)
      END IF



 998  CONTINUE


      RETURN
      END
      SUBROUTINE GVS2T0 (IROW,NUM)
















      IMPLICIT      NONE
      INTEGER       NUM, I
      INTEGER*2     IROW(NUM)





      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            IROW(I) = 0
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSD03')
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSD04',NUM)
      END IF



 998  CONTINUE


      RETURN
      END
      SUBROUTINE GVS2TC (IROW,ICON,NUM)

















      IMPLICIT      NONE
      INTEGER       NUM, I, ICON
      INTEGER*2     IROW(NUM)





      IF (NUM.GT.0) THEN



         DO 10 I=1,NUM
            IROW(I) = ICON
   10    CONTINUE
         GOTO 998
      ELSE IF (NUM.EQ.0) THEN



         CALL GVSTTB ('?TLSD48')
         GOTO 998
      ELSE IF (NUM.LT.0) THEN



         CALL GVSTTI ('?TLSD49',NUM)
      END IF



 998  CONTINUE


      RETURN
      END
      SUBROUTINE GVS2RT (RA,RB,N)



















      IMPLICIT      NONE
      INTEGER       L, IR, I, J, N
      INTEGER*2     RA(N), RB(N), RRA, RRB







      IF (N.LT.2) THEN
         CALL GVSTTI ('?TLSC91',N)
         GOTO 998
      END IF



      L=N/2+1
      IR=N
   10 CONTINUE
         IF (L.GT.1) THEN
            L=L-1
            RRA=RA(L)
            RRB=RB(L)
         ELSE
            RRA=RA(IR)
            RRB=RB(IR)
            RA(IR)=RA(1)
            RB(IR)=RB(1)
            IR=IR-1
            IF(IR.EQ.1)THEN
               RA(1)=RRA
               RB(1)=RRB
               GOTO 998
            END IF
         END IF
         I=L
         J=L+L
   20    IF(J.LE.IR)THEN
            IF(J.LT.IR)THEN
               IF(RA(J).LT.RA(J+1))J=J+1
            END IF
            IF(RRA.LT.RA(J))THEN
               RA(I)=RA(J)
               RB(I)=RB(J)
               I=J
               J=J+J
            ELSE
               J=IR+1
            END IF
            GO TO 20
         END IF
         RA(I)=RRA
         RB(I)=RRB
      GO TO 10



 998  CONTINUE


      END
      SUBROUTINE GVSW2P (INT1,INT2)









      IMPLICIT      NONE
      INTEGER*2     TEMP, INT1, INT2





      TEMP=INT1
      INT1=INT2
      INT2=TEMP





      RETURN
      END
