Solved

ebcdic to ascii conversion

Posted on 2001-08-30
1
353 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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 demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now