/**********************************************************************/
/* GRAPHIT REXX - Plots a graph of the input pipeline                 */
/*        SCALE - The scale used for the graph.                       */
/*   Input Pipe - Word 1 is the value to plot on the graph.  Anything */
/*                else is treated as a row header, padded to 25 bytes.*/
/**********************************************************************/

parse upper arg scale
if scale = '' then
   scale = 1

tlr0 = '  Scale: ' scale
tlr1 = '....+....1....+....2....+....3....+....4....+....5'
tlr2 = '....+....6....+....7....+....8....+....9....+...10'
cnt = 0
tot = 0

parse value substr(diag(8C),3,4) with columns 3 rows

signal on error
'readto record'
parse var record gval hdr
sval = format((gval/scale),3,0)

do forever
   cnt = cnt + 1
   tot = tot + gval
   if hdr = '' then
      hdr = 'Record' right(cnt,5)
   graph = ''
   graph = substr(hdr,1,20)||'|'||left('',sval,'X') left('',100-sval,' ') right(gval,8)
   output graph
   'readto record'
   parse var record gval hdr
   sval = format((gval/scale),3,0)
end

error:
if rc = 12 then do
   'output' substr(tlr0,1,20)||'|'||tlr1||tlr2
   average = tot / cnt
   aver = format(average,3,0)
   text1 = 'Average:' format(average,3,2)
   avg = substr(text1,1,20)||'|'||left('',format(aver),'X')
   'output' avg
   exit 0
end
exit rc

    Source: geocities.com/vmvse/files

               ( geocities.com/vmvse)