Solved

ebcdic to ascii conversion

Posted on 2001-08-30
1
356 Views
Last Modified: 2013-12-03
anyone have a VB routine to convert EBCDIC files to ASCII? Preferably:
1 : Convert an entire file (whose contents are known to be all display)
2 : Convert fields of specific length
0
Comment
Question by:lance_keen
1 Comment
 
LVL 3

Accepted Solution

by:
JackThornton earned 50 total points
ID: 6442406
There is an ASCII to EBCDIC (and, therefore, visa-versa) chart at:

http://www.natural-innovations.com/boo/asciiebcdic.html

The simplest/most efficient way to do the conversion is to build yourself a 256-byte lookup table using a VB array. You can make a routine that will initialize this array like so:

lookupTable(0) = &H00
lookupTable(1) = &H01
...
lookupTable(&H81) = &H61

etc.

the last example shows that EBCDIC &H81 (lower case 'a') is equivalent to ASCII code &H61. You want to index the array with EBCDIC and store the equivalent ASCII value there for later retrieval.

Then you just read data a "chunk" at a time into an array, do a conversion like so:

destinationData(x) = lookupTable(sourceData(x))

hope this helps

- jack
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question