define variable c-list as character format 'x' extent 50 no-undo.
define vatriable c-count as integer extent 50 no-undo.
define variable x as integer no-undo.
define variable y as integer no-undo.
define variable top-idx as integer no-undo.
define variable got-one as logical no-undo.
do x = 1 to length(dbfield):
if top-idx = 0 then
assign
y = 1
top-idx = 1
c-list[1] = substring(dbfield,x,1)
c-count[1] = 1
got-one = true.
else
do y = 1 to top-idx:
if c-list[y] = substring(dbfield,x,1) then
assign
c-count[y] = c-count[y] + 1
got-one = true.
end. /* end do y = 1 to top-idx */
if not got-one then
assign
top-idx = top-idx + 1
c-list[top-idx] = substring(dbfield,x,1)
c-count[top-idx] = 1.
assign
got-one = false.
end. /* end do x = 1 to length(dbfield) */
do x = 1 to top-idx:
display
c-list[x]
c-count[x]
with frame fr1
no-labels
down.
down with frame fr1.
end. /* end do x = 1 to top-idx */
Hope this is also useful for you.