EBCDIC to ASCII Utility for DOS/Win?

From: Hans Franke <Hans.Franke_at_mch20.sbs.de>
Date: Wed Nov 29 06:58:03 2000

> Don't let me scare anyone, but this question is actually for _work_.
> :-) The mainframe guys asked me if I knew of any utilities for
> translating from EBCDIC to ASCII on a DOS or Windows PC, as they have
> a user who keeps getting big (12MB) data dumps from another company in
> EBCDIC, and they're getting tired up uploading it to the mainframe and
> back down just to get the EBCDIC->ASCII translation done. Any
> suggestions? Web searching has turned up very little of interest.

    TITLE CONVERT

    DOSSEG
    .MODEL SMALL,C
    .186

    INCLUDE COLUMBUS.MAC
    INCLUDE DOS.MAC
    INCLUDE MACRO.MAC
    INCLUDE CONST.HA

    .DATA

convtab LABEL BYTE
    BYTE 0, 1, 2, 3,156, 9,134,127
    BYTE 191,141,142, 11, 12, 13, 14, 15
    BYTE 16, 17, 18, 19,157,133, 8,135
    BYTE 24, 25,146,143, 28, 29, 30, 31
    BYTE 128,129,130,131,132, 10, 23, 27
    BYTE 144,145, 22,147,148,149,150, 4
    BYTE 152,153,154,155, 20, 21,158, 26
    BYTE 32,160,226,228,224,225,227,229
    BYTE 231,241,162, 46, 60, 40, 43,124
    BYTE 38,233,234,235,232,237,238,239
    BYTE 236,223, 33, 36, 42, 41, 59,172
    BYTE 45, 47,194,196,192,193,195,197
    BYTE 199,209,166, 44, 37, 95, 62, 63
    BYTE 248,201,202,203,200,205,206,207
    BYTE 204, 96, 58, 35, 64, 39, 61, 34
    BYTE 216, 97, 98, 99,100,101,102,103
    BYTE 104,105,171,187,240,253,254,177
    BYTE 176,106,107,108,109,110,111,112
    BYTE 113,114,170,186,230,184,198,164
    BYTE 181,126,115,116,117,118,119,120
    BYTE 121,122,161,191,208,221,222,174
    BYTE 94,163,165,183,169,167,182,188
    BYTE 189,190, 91, 93,175,168,180,215
    BYTE 123, 65, 66, 67, 68, 69, 70, 71
    BYTE 72, 73,173,244,246,242,243,245
    BYTE 125, 74, 75, 76, 77, 78, 79, 80
    BYTE 81, 82,185,251,252,249,250,255
    BYTE 92,247, 83, 84, 85, 86, 87, 88
    BYTE 89, 90,178,212,214,210,211,213
    BYTE 48, 49, 50, 51, 52, 53, 54, 55
    BYTE 56, 57,179,219,220,217,218,159

    .STACK

    .CODE

    _at_ENTR <CONVERT,M,C>,<>,<>

    _at_WHIL NC
    READ STDIN,buff,512
    _at_BREA
    push ax

;--------- here's the loop :)

    mov cx,ax
    lea si,buff
    mov di,si
    lea bx,convtab
xlp:
    lodsb
    xlat
    stosb
    loop xlb

;--------- Thats it.

    pop cx
    WRITE STDOUT,buff,cx
    _at_BEND

    _at_EXIT 0

    _at_END


The Table is generated acording to IBM NLS RM Vol2 SE09-8002-01
Codeset IBM037 (aka CP037, aka EBCDIC-CP-US/-CA/-WT/-NL)

Take care to use codeset used on the originateing machine and
application - there are tons of EBCDIC versions out there.

Gruss
H.

--
VCF Europa 2.0 am 28./29. April 2001 in Muenchen
http://www.vintage.org/vcfe
http://www.homecomputer.de/vcfe
Received on Wed Nov 29 2000 - 06:58:03 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:33:14 BST