zOs/SQL/EXUNIEBC

with c (c, l, all) as
(
  select '', 0, ' abcXYZ0189' from sysibm.sysDummy1
  union all select substr(all, l+1, 1), l+1, all
     from c where l < length(all) and l < 9e9
)
select c, hex(char(c, 1))
    , row_number() over (order by cast(c as char(1) ccsid ebcdic)) ebc
    , row_number() over (order by cast(c as char(1) ccsid unicode)) uni
    , row_number() over (order by cast(c as char(1) ccsid ascii  )) asc
    from c
    order by l