      SUBROUTINE MAIN
      LOGICAL*1 BUF(402), NAME(16,1000), VALSTR(7)
      LOGICAL*1 ARG(128), BARSTR(134), C
      INTEGER FD
      INTEGER OPEN
      INTEGER MAXCOL, MEAN, SUM, VALUE(1000)
      INTEGER I, J, JUNK, MAXVAL, MAXNDX, MINVAL, NDX, PERCEN, RANGE
      INTEGER CTOI, GETARG, GETLIN, GETWRD
      INTEGER DOHDR
      INTEGER DOMEAN
      INTEGER DOSUM
      INTEGER DOWIDE
      INTEGER HIRULE
      INTEGER LORULE
      LOGICAL*1 BARCHR
      LOGICAL*1 HIFILL
      LOGICAL*1 LOFILL
      LOGICAL*1 MEACHR
      LOGICAL*1 RULCHR
      LOGICAL*1 ST001Z(41)
      LOGICAL*1 ST002Z(38)
      LOGICAL*1 ST003Z(28)
      COMMON / CBAR / DOHDR, DOMEAN, DOSUM, DOWIDE, HIRULE, LORULE, BARC
     *HR, HIFILL, LOFILL, MEACHR, RULCHR
      DATA BARCHR /124/
      DATA HIFILL /32/
      DATA LOFILL /124/
      DATA MEACHR /46/
      DATA RULCHR /58/
      DATA DOHDR /0/
      DATA DOSUM /0/
      DATA DOWIDE /0/
      DATA HIRULE /0/
      DATA LORULE /0/
      DATA MAXCOL /51/
      DATA MAXVAL /0/
      DATA MINVAL /0/
      DATA RANGE /0/
      DATA SUM /0/
      DATA ST001Z(1)/117/,ST001Z(2)/115/,ST001Z(3)/97/,ST001Z(4)/103/,ST
     *001Z(5)/101/,ST001Z(6)/58/,ST001Z(7)/32/,ST001Z(8)/32/,ST001Z(9)/9
     *8/,ST001Z(10)/97/,ST001Z(11)/114/,ST001Z(12)/103/,ST001Z(13)/114/,
     *ST001Z(14)/97/,ST001Z(15)/112/,ST001Z(16)/104/,ST001Z(17)/32/,ST00
     *1Z(18)/91/,ST001Z(19)/45/,ST001Z(20)/99/,ST001Z(21)/102/,ST001Z(22
     *)/70/,ST001Z(23)/104/,ST001Z(24)/109/,ST001Z(25)/114/,ST001Z(26)/8
     *2/,ST001Z(27)/115/,ST001Z(28)/119/,ST001Z(29)/93/,ST001Z(30)/32/,S
     *T001Z(31)/91/,ST001Z(32)/102/,ST001Z(33)/105/,ST001Z(34)/108/,ST00
     *1Z(35)/101/,ST001Z(36)/93/,ST001Z(37)/32/,ST001Z(38)/46/,ST001Z(39
     *)/46/,ST001Z(40)/46/,ST001Z(41)/0/
      DATA ST002Z(1)/63/,ST002Z(2)/32/,ST002Z(3)/84/,ST002Z(4)/111/,ST00
     *2Z(5)/111/,ST002Z(6)/32/,ST002Z(7)/109/,ST002Z(8)/117/,ST002Z(9)/9
     *9/,ST002Z(10)/104/,ST002Z(11)/32/,ST002Z(12)/100/,ST002Z(13)/97/,S
     *T002Z(14)/116/,ST002Z(15)/97/,ST002Z(16)/58/,ST002Z(17)/32/,ST002Z
     *(18)/32/,ST002Z(19)/105/,ST002Z(20)/110/,ST002Z(21)/99/,ST002Z(22)
     */114/,ST002Z(23)/101/,ST002Z(24)/97/,ST002Z(25)/115/,ST002Z(26)/10
     *1/,ST002Z(27)/32/,ST002Z(28)/84/,ST002Z(29)/65/,ST002Z(30)/66/,ST0
     *02Z(31)/76/,ST002Z(32)/69/,ST002Z(33)/95/,ST002Z(34)/83/,ST002Z(35
     *)/73/,ST002Z(36)/90/,ST002Z(37)/69/,ST002Z(38)/0/
      DATA ST003Z(1)/63/,ST003Z(2)/32/,ST003Z(3)/82/,ST003Z(4)/97/,ST003
     *Z(5)/110/,ST003Z(6)/103/,ST003Z(7)/101/,ST003Z(8)/32/,ST003Z(9)/11
     *1/,ST003Z(10)/102/,ST003Z(11)/32/,ST003Z(12)/100/,ST003Z(13)/97/,S
     *T003Z(14)/116/,ST003Z(15)/97/,ST003Z(16)/32/,ST003Z(17)/118/,ST003
     *Z(18)/97/,ST003Z(19)/108/,ST003Z(20)/117/,ST003Z(21)/101/,ST003Z(2
     *2)/115/,ST003Z(23)/32/,ST003Z(24)/105/,ST003Z(25)/115/,ST003Z(26)/
     *32/,ST003Z(27)/48/,ST003Z(28)/0/
      CALL QUERY(ST001Z)
      CALL BARARG
      IF (.NOT.( DOWIDE .EQ. 1 ))GOTO 23000
      MAXCOL = MAXCOL + 50
23000 CONTINUE
      IF (.NOT.( DOHDR .EQ. 1 ))GOTO 23002
      CALL BARHDR(DOWIDE)
23002 CONTINUE
      NDX = 1
      J = 1 
23004 CONTINUE
      IF (.NOT.( GETARG( J, ARG, 128) .EQ. -1 ))GOTO 23007
      IF (.NOT.( J .NE. 1 ))GOTO 23009
      GOTO 23006
23009 CONTINUE
      FD = 1
23010 CONTINUE
      GOTO 23008
23007 CONTINUE
      IF (.NOT.( ARG(1) .EQ. 45 ))GOTO 23011
      FD = 1
      GOTO 23012
23011 CONTINUE
      FD = OPEN( ARG, 1)
      IF (.NOT.( FD .EQ. -3 ))GOTO 23013
      CALL CANT(ARG)
23013 CONTINUE
23012 CONTINUE
23008 CONTINUE
23015 IF (.NOT.(GETLIN( BUF, FD) .NE. -1 ))GOTO 23017
      MAXNDX = NDX
      IF (.NOT.( NDX .GT. 1000 ))GOTO 23018
      CALL REMARK( ST002Z )
      GOTO 23017
23018 CONTINUE
      I = 1
      JUNK = GETWRD( BUF, I, NAME( 1, NDX))
      JUNK = GETWRD( BUF, I, VALSTR)
      I = 1
      VALUE(NDX) = CTOI( VALSTR, I)
      IF (.NOT.( DOSUM .EQ. 0 ))GOTO 23020
      IF (.NOT.( VALUE(NDX) .GT. MAXVAL ))GOTO 23022
      MAXVAL = VALUE(NDX)
23022 CONTINUE
      IF (.NOT.( VALUE(NDX) .LT. MINVAL ))GOTO 23024
      MINVAL = VALUE(NDX)
23024 CONTINUE
23020 CONTINUE
      RANGE = RANGE + VALUE(NDX)
23016 NDX = NDX + 1 
      GOTO 23015
23017 CONTINUE
      IF (.NOT.( FD .NE. 1 ))GOTO 23026
      CALL CLOSE(FD)
23026 CONTINUE
23005 J = J + 1 
      GOTO 23004
23006 CONTINUE
      IF (.NOT.( NDX .GT. 1 .AND. DOSUM .EQ. 0 ))GOTO 23028
      MEAN = RANGE / (NDX - 1)
      GOTO 23029
23028 CONTINUE
      MEAN = 0
23029 CONTINUE
      IF (.NOT.( DOSUM .EQ. 0 ))GOTO 23030
      RANGE = MAXVAL - MINVAL
      IF (.NOT.( RANGE .EQ. 0 ))GOTO 23032
      CALL ERROR( ST003Z )
23032 CONTINUE
23030 CONTINUE
      NDX = 1 
23034 IF (.NOT.(NDX .LE. MAXNDX ))GOTO 23036
      CALL PUTSTR( NAME( 1, NDX), -16, 2)
      CALL PUTINT( VALUE(NDX), 7, 2)
      CALL PUTCH( 32, 2)
      IF (.NOT.( DOSUM .EQ. 1 ))GOTO 23037
      SUM = SUM + VALUE(NDX)
      PERCEN = ( SUM * 100 ) / RANGE
      GOTO 23038
23037 CONTINUE
      PERCEN = ( VALUE(NDX) * 100 ) / RANGE
23038 CONTINUE
      CALL PUTCH( 124, 2)
      IF (.NOT.( DOWIDE .EQ. 0 ))GOTO 23039
      PERCEN = PERCEN / 2
23039 CONTINUE
      I = 1 
23041 IF (.NOT.(I .LT. PERCEN ))GOTO 23043
      BARSTR(I) = LOFILL
      IF (.NOT.( LORULE .EQ. 1 ))GOTO 23044
      IF (.NOT.( DOWIDE .EQ. 1 ))GOTO 23046
      IF (.NOT.( MOD( I, 10) .EQ. 0 ))GOTO 23048
      BARSTR(I) = RULCHR
23048 CONTINUE
      GOTO 23047
23046 CONTINUE
      IF (.NOT.( MOD( I, 5) .EQ. 0 ))GOTO 23050
      BARSTR(I) = RULCHR
23050 CONTINUE
23047 CONTINUE
23044 CONTINUE
23042 I = I + 1 
      GOTO 23041
23043 CONTINUE
      CALL CHCOPY( BARCHR, BARSTR, I)
23052 IF (.NOT.(I .LT. MAXCOL ))GOTO 23054
      BARSTR(I) = HIFILL
      IF (.NOT.( HIRULE .EQ. 1 ))GOTO 23055
      IF (.NOT.( DOWIDE .EQ. 1 ))GOTO 23057
      IF (.NOT.( MOD( I, 10) .EQ. 0 ))GOTO 23059
      BARSTR(I) = RULCHR
23059 CONTINUE
      GOTO 23058
23057 CONTINUE
      IF (.NOT.( MOD( I, 5) .EQ. 0 ))GOTO 23061
      BARSTR(I) = RULCHR
23061 CONTINUE
23058 CONTINUE
23055 CONTINUE
23053 I = I + 1 
      GOTO 23052
23054 CONTINUE
      IF (.NOT.( DOMEAN .EQ. 1 .AND. MEAN .GT. 0 ))GOTO 23063
      IF (.NOT.( DOWIDE .EQ. 1 ))GOTO 23065
      BARSTR( MEAN * 100 / RANGE ) = MEACHR
      GOTO 23066
23065 CONTINUE
      BARSTR( MEAN * 50 / RANGE ) = MEACHR
23066 CONTINUE
23063 CONTINUE
      BARSTR(I) = 124
      BARSTR(I+1) = 0
      CALL PUTLIN( BARSTR, 2)
      CALL PUTCH( 10, 2)
23035 NDX = NDX + 1 
      GOTO 23034
23036 CONTINUE
      RETURN
      END
      SUBROUTINE BARARG
      INTEGER DOHDR
      INTEGER DOMEAN
      INTEGER DOSUM
      INTEGER DOWIDE
      INTEGER HIRULE
      INTEGER LORULE
      LOGICAL*1 BARCHR
      LOGICAL*1 HIFILL
      LOGICAL*1 LOFILL
      LOGICAL*1 MEACHR
      LOGICAL*1 RULCHR
      LOGICAL*1 ARG(128), C
      INTEGER I
      INTEGER GETARG
      COMMON / CBAR / DOHDR, DOMEAN, DOSUM, DOWIDE, HIRULE, LORULE, BARC
     *HR, HIFILL, LOFILL, MEACHR, RULCHR
      I = 1 
23067 IF (.NOT.(GETARG( I, ARG, 128) .NE. -1 ))GOTO 23069
      IF (.NOT.( ARG(1) .EQ. 45 ))GOTO 23070
      C = ARG(2)
      IF (.NOT.( C .EQ. 0 ))GOTO 23072
      GOTO 23068
23072 CONTINUE
      IF (.NOT.( C .EQ. 99 ))GOTO 23074
      IF (.NOT.( ARG(3) .GT. 32 ))GOTO 23076
      BARCHR = ARG(3)
23076 CONTINUE
      GOTO 23075
23074 CONTINUE
      IF (.NOT.( C .EQ. 102 ))GOTO 23078
      IF (.NOT.( ARG(3) .GE. 32 ))GOTO 23080
      LOFILL = ARG(3)
23080 CONTINUE
      GOTO 23079
23078 CONTINUE
      IF (.NOT.( C .EQ. 70 ))GOTO 23082
      IF (.NOT.( ARG(3) .GT. 32 ))GOTO 23084
      HIFILL = ARG(3)
23084 CONTINUE
      GOTO 23083
23082 CONTINUE
      IF (.NOT.( C .EQ. 104 ))GOTO 23086
      DOHDR = 1
      GOTO 23087
23086 CONTINUE
      IF (.NOT.( C .EQ. 109 ))GOTO 23088
      DOMEAN = 1
      IF (.NOT.( ARG(3) .GE. 32 ))GOTO 23090
      MEACHR = ARG(3)
23090 CONTINUE
      GOTO 23089
23088 CONTINUE
      IF (.NOT.( C .EQ. 114 ))GOTO 23092
      LORULE = 1
      IF (.NOT.( ARG(3) .GT. 32 ))GOTO 23094
      RULCHR = ARG(3)
23094 CONTINUE
      GOTO 23093
23092 CONTINUE
      IF (.NOT.( C .EQ. 82 ))GOTO 23096
      HIRULE = 1
      IF (.NOT.( ARG(3) .GT. 32 ))GOTO 23098
      RULCHR = ARG(3)
23098 CONTINUE
      GOTO 23097
23096 CONTINUE
      IF (.NOT.( C .EQ. 115 ))GOTO 23100
      DOSUM = 1
      GOTO 23101
23100 CONTINUE
      IF (.NOT.( C .EQ. 119 ))GOTO 23102
      DOWIDE = 1
23102 CONTINUE
23101 CONTINUE
23097 CONTINUE
23093 CONTINUE
23089 CONTINUE
23087 CONTINUE
23083 CONTINUE
23079 CONTINUE
23075 CONTINUE
      CALL DELARG(I)
      I = I - 1
23070 CONTINUE
23068 I = I + 1 
      GOTO 23067
23069 CONTINUE
      RETURN
      END
      SUBROUTINE BARHDR(DOWIDE)
      INTEGER DOWIDE, I
      LOGICAL*1 HDRSTR(25)
      LOGICAL*1 BLANKS(9)
      LOGICAL*1 HUNDRD(4)
      DATA HDRSTR(1)/78/,HDRSTR(2)/97/,HDRSTR(3)/109/,HDRSTR(4)/101/,HDR
     *STR(5)/32/,HDRSTR(6)/32/,HDRSTR(7)/32/,HDRSTR(8)/32/,HDRSTR(9)/32/
     *,HDRSTR(10)/32/,HDRSTR(11)/32/,HDRSTR(12)/32/,HDRSTR(13)/32/,HDRST
     *R(14)/32/,HDRSTR(15)/32/,HDRSTR(16)/32/,HDRSTR(17)/32/,HDRSTR(18)/
     *32/,HDRSTR(19)/32/,HDRSTR(20)/83/,HDRSTR(21)/105/,HDRSTR(22)/122/,
     *HDRSTR(23)/101/,HDRSTR(24)/32/,HDRSTR(25)/0/
      DATA BLANKS(1)/32/,BLANKS(2)/32/,BLANKS(3)/32/,BLANKS(4)/32/,BLANK
     *S(5)/32/,BLANKS(6)/32/,BLANKS(7)/32/,BLANKS(8)/32/,BLANKS(9)/0/
      DATA HUNDRD(1)/49/,HUNDRD(2)/48/,HUNDRD(3)/48/,HUNDRD(4)/0/
      IF (.NOT.( DOWIDE .EQ. 0 ))GOTO 23104
      BLANKS(4) = 0
23104 CONTINUE
      CALL PUTLIN( HDRSTR, 2)
      I = 0 
23106 IF (.NOT.(I .LT. 100 ))GOTO 23108
      CALL PUTINT( I, 1, 2)
      CALL PUTLIN( BLANKS, 2)
23107 I = I + 10 
      GOTO 23106
23108 CONTINUE
      CALL PUTLIN( HUNDRD, 2)
      CALL PUTCH( 10, 2)
      CALL PUTCH( 10, 2)
      RETURN
      END
