      SUBROUTINE PLH.USAGE.TABLE(W,XX,CC0,TBL)
*PIC-LAN
*
*ALL
*PC
*Y
*
*
*
*
      INCLUDE SYS.TYPE.INCLUDE
*
      INCLUDE PL.COMMON
      INCLUDE PL.COMMON.DEFS
      INCLUDE PL.DEFS
      INCLUDE PLIP.COMMON
      INCLUDE PLW.COMMON
*
      TBL.SZ = DCOUNT(XX,AM)
      M = 0
      FOR I = 1 TO TBL.SZ
         IF XX<I> > M THEN M = XX<I>
      NEXT I
*
      SCALE = .1
      M0 = M
      LOOP WHILE M0 >= 100 DO
         SCALE = SCALE * 10
         M0 = M0 / 10
      REPEAT
*
      BEGIN CASE
         CASE M0 > 40
            SCALE = SCALE * 5
         CASE M0 > 20
            SCALE = SCALE * 2
         CASE M0 > 10
            SCALE = SCALE * 1
      END CASE
      SCALE2 = INT(SCALE/2)
*
      C.DATA = ''
      C.OPTS = ''
      R.OPTS = ''
      S = SCALE * 200
      GOSUB 100
      C.DATA<1,1> = S
      C.OPTS<1,1> = 'width="70" align=right'
      C.DATA<1,2> = '<image src="s-grey.gif" height="1" width="10"><br><image src="s-clr.gif" height="99" width="9"><image src="s-grey.gif" height="99" width="1">'
      R.OPTS<1> = 'valign=top'
*
      S = SCALE * 100
      GOSUB 100
      C.DATA<2,1> = S
      C.OPTS<2,1> = 'align=right'
      C.DATA<2,2> = '<image src="s-grey.gif" height="1" width="10"><br><image src="s-clr.gif" height="99" width="9"><image src="s-grey.gif" height="99" width="1">'
      R.OPTS<2> = 'valign=top'
*
      CALL PLH.BLD.TABLE.EXT('','border=0 cellspacing=0 cellpadding=0','',R.OPTS,C.DATA,C.OPTS,SCALE.TBL)
*
      C.DATA = ''
      C.OPTS = ''
*
      C.DATA<1,1> = PL_AMTOCRLF(SCALE.TBL)
      C.OPTS<1,1> = ' '
      C.DATA<2,1> = '&nbsp;'
      C.OPTS<2,1> = ' '
*
      FOR I = 1 TO TBL.SZ
         H = INT( ( XX<I> + SCALE2 ) / SCALE )
         IF H = 0 AND XX<I> THEN H = 1
         IF H THEN
            T = '<image src="s-blk.gif" height="' : H : '" width="' : W-1 : '"><br>'
         END ELSE
            T = ''
         END
         C.DATA<1,-1> = T : '<image src="s-grey.gif" height="1" width="' : W : '">'
      NEXT I
*
      FOR I = 1 TO 2
         C.DATA<1,-1> = '<image src="s-clr.gif" height="1" width="' : W : '">'
      NEXT I
*
      T0 = INT((W-1)/2)
      T1 = W-1 - T0 - T0
*
      CC = CC0
      I1 = DCOUNT(CC,AM)
      FOR I = 1 TO I1
         IF CC<I> <> ' ' THEN
            T = ''
            IF T0 THEN
               T = T : '<image src="s-clr.gif" width="' : T0 : '" height="3">'
            END
            T = T : '<image src="s-grey.gif" width="' : T1 : '" height="3">'
            CC<I> = T : '<br>' : CC<I>
         END
      NEXT I
*
      T = 0
      LOOP WHILE CC <> '' AND CC<1> = ' ' DO
         T = T + 1
         CC = DELETE(CC,1,0,0)
      REPEAT
      IF T THEN
         C.DATA<2,-1> = '&nbsp;'
         C.OPTS<2,-1> = 'colspan="' : T : '"'
      END
      LOOP WHILE CC <> '' DO
         C.DATA<2,-1> = CC<1>
         T = 1
         CC = DELETE(CC,1,0,0)
         LOOP WHILE CC <> '' AND CC<1> = ' ' DO
            T = T + 1
            CC = DELETE(CC,1,0,0)
         REPEAT
         IF CC = '' AND W < 20 THEN T = T + 1
         C.OPTS<2,-1> = 'colspan="' : T : '"'
      REPEAT
*
      R.OPTS = ''
      R.OPTS<1> = 'valign=bottom'
      R.OPTS<2> = 'valign=top'
*
      CALL PLH.BLD.TABLE.EXT('I','border=0 cellspacing=0 cellpadding=0','',R.OPTS,C.DATA,C.OPTS,TBL)
*
      RETURN
*
100   REM Return S as K,M,G
*
      BEGIN CASE
         CASE S >= 1000000000
            S = S/1000000000 : 'G'
         CASE S >= 1000000
            S = S/1000000 : 'M'
         CASE S >= 1000
            S = S/1000 : 'K'
      END CASE
*
      RETURN
   END
