?
Solved

ebcdic to ascii conversion

Posted on 2001-08-30
1
Medium Priority
?
362 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
JackThornton earned 200 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

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 accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

770 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