	Program Test
c
	Open ( Unit=5, Name='SYS$OUTPUT:', Status='UNKNOWN',
	1	CarriageControl='LIST')
c
	Accept *, I, J, K, L, M, N
	Call Hist ( 5, I, J, K, L, M, N )
c
	End


	Subroutine Hist ( Lun, A, B, C, D, F, Len )
c
	Integer		A,	B,	C,	D,	F
	Integer		Lun,	Len
c
	Integer		Max_Cnt,	Basic_Units
	Integer		Inter_Unit_Step_Size
c
	Character*9	CA, CB, CC, CD, CF
c
	Basic_Units = ( Max( A, B, C, D, F) + 4 ) / 5 
	Max_Cnt = Basic_Units * 5
	Inter_Unit_Step_Size = (Len - 2) / Max_Cnt
	CA = '          '
	CB = '          '
	CC = '          '
	CD = '          '
	CF = '          '
c
	Do I = Max_Cnt, 1, -5
c
	    If ( A .ge. I ) CA = '#########'
	    If ( B .ge. I ) CB = '#########'
	    If ( C .ge. I ) CC = '#########'
	    If ( D .ge. I ) CD = '#########'
	    If ( F .ge. I ) CF = '#########'
c
	    Write( Lun, 10 ) I, CF, CD, CC, CB, CA
c
	    Do K = 1, Inter_Unit_Step_Size - 1
		Write( Lun, 20 ) CF, CD, CC, CB, CA
	    End Do
c
	    Do J = 1, 4
c
		L = I - J
		If ( A .ge. L ) CA = '#########'
		If ( B .ge. L ) CB = '#########'
		If ( C .ge. L ) CC = '#########'
		If ( D .ge. L ) CD = '#########'
		If ( F .ge. L ) CF = '#########'
c
		Do K = 1, Inter_Unit_Step_Size
		    Write( Lun, 20 ) CF, CD, CC, CB, CA
		End Do
	    End Do
	End Do
c
	Write ( Lun, 30 )
	Write ( Lun, 40 ) 'F', 'D', 'C', 'B', 'A'
c
	Return
c
10	Format ( I5, ' --+', 5(A,' ' ) )
20	Format ( 5X, '   |', 5(A,' ' ) )
30	Format ( 4X, '0 --+', 5('---------+'))
40	Format ( 5X, '   |', 5( '    ', A ,'    |' ) )
c
	End
