Return to the RPG Tips
Display an ASCII vs EBCDIC Character Map
I loved Raul's suggestion of a character map in ReXX, but I'll post an RPG solution for the list to work on: h debug dftactgrp(*no) actgrp('QILE') bnddir('QC2LE') * dbgview(*list) d H2C pr Extproc('cvthc') d RecP * value d SrcP * value d SizeP 10I 0 value d* Translate EBCDIC/ASCII d transChr pr Extpgm('QDCXLATE') d XLStrLen 5p 0 d XLStr like(chrA) d XLTable 10a d ChrEP s * inz d ChrXP s * inz d chrX s 2 d chrA s 1 d Size s 10i 0 d E2ATable s 10 Inz('QASCII') d outMsg s 24 d XLStrLen s 5p 0 d ds d chrE 2 2 d i 1 2u 0 c eval ChrXP=%Addr(chrX) c eval ChrEP=%Addr(chrE) c eval Size=%len(chrX) c 64 do 255 i c callp H2C(ChrXP : c ChrEP : c Size) c eval chrA = chrE c eval XLStrLen = %len(chrA) c callp transChr(XLStrLen: ChrA: E2ATable) c eval outMsg = %trim(%editc(i: 'Z')) + '-' + c chrX + '-' + c chrE + '-' + c chrA c outMsg dsply 'BUCK' c enddo c eval *InLR = *On This uses the QASCII translate table. Specific code page translation requires iconv(), I think. Buck Calabro
[report a broken link by clicking here]