Solved

ebcdic to ascii conversion

Posted on 2001-08-30
1
355 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

786 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