C   25/07/77 912210852  MEMBER NAME  SORT     (S)           FORTRAN
      SUBROUTINE SORT(VARMIN,VARBLE,ARRAY,BINSIZ,JMAX,K)
C---  SORT REAL VARIABLES INTO 1-DIM DISTRIBUTIONS
C     (FOR VARIABLE SORTING, I.E. ADDING, OR SUBTRACTING, OR VARIING OF
C      INCREMENT USE 'VSORT')
C
C     H.WRIEDT   02.02.79     18:00
C     LAST MODIFICATION    21.12.79     08:55
C
C     ORIGINALLY WRITTEN BY J.GAYLER NAMED 'VERTEI'
C
C     VARBLE: INPUT VARIABLE
C     ARRAY:  OUTPUT ARRAY
C     ARRAY(101): UNDERFLOWS
C     ARRAY(102): OVERFLOWS
C     JMAX = (VARMAX - VARMIN) / BINSIZ
C     K = NO. OF COLUMNS / BIN
C
      DIMENSION ARRAY(102)
      J = ((VARBLE - VARMIN) / BINSIZ) + 1.
      IF (J*K.GT.JMAX) J = JMAX+2
      IF (J.LT.1) J = JMAX+1
      IF (K.NE.1.AND.J.LE.JMAX) GOTO 2
      ARRAY(J) = ARRAY(J) + 1
      RETURN
 2    DO 1 L = 1,K
      M = J*K - L + 1
 1    ARRAY(M) = ARRAY(M) + 1
      RETURN
      END
