Solved

ebcdic to ascii conversion

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel Use VBA to get user's Mac Address for their computer 5 409
Slow process to read Excel 15 164
windbg taking it's time 32 107
Developing a front end to SPLUNK 1 104
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

732 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