      SUBROUTINE G5TRIN(NVALS,ISTART)
C
C          ------------------------------------------------
C          ROUTINE NO. (5014)   VERSION (A7.3B)   11:FEB:85
C          ------------------------------------------------
C
C          THIS GETS <NVALS> TRIPLETS FROM THE TRANGRID FILE
C          AND PLACES THEM IN [IFUNIB], STARTING AT <ISTART>.
C
C          ** THIS VERSION ALLOWS NON-STANDARD ERROR HANDLING **
C
C
      LOGICAL TEROUT
C
      COMMON /T5TBUF/ IFUNIB(257)
      COMMON /T5TERR/ INERR,TEROUT
      COMMON /T5TINP/ KTRNMI,KTRNDI,INPBUF(26),INBUFP,INLINE
C
C
      LEFT= NVALS
      IHERE= ISTART
      IF (INBUFP.GT.26) GO TO 2
    1   LIMIT= INBUFP+LEFT-1
        IF (LIMIT.GT.26) LIMIT= 26
C
        DO 100 LOAD= INBUFP,LIMIT
          IFUNIB(IHERE)= INPBUF(LOAD)
          IHERE= IHERE+1
  100   CONTINUE
C
        LEFT= LEFT-(LIMIT-INBUFP+1)
        INBUFP= LIMIT+1
        IF (LEFT.LE.0) GO TO 3
C
C          NO READ IS ATTEMPTED AFTER AN INPUT ERROR HAS OCCURRED.
C
    2   IF (INERR.NE.0) RETURN
C
        INLINE= INLINE+1
        READ(KTRNDI,101,END= 901,ERR= 902) INPBUF
  101   FORMAT(26I3)
        INBUFP= 1
        GO TO 1
C
    3 RETURN
C
C          IF AN ERROR IS ENCOUNTERED, A READ SHUT-DOWN IS MADE.
C
  901 INERR= 1
      IF (TEROUT) CALL G5ERMS
      RETURN
C
  902 INERR= 2
      IF (TEROUT) CALL G5ERMS
      RETURN
      END
