Convert EBCDIC to ASCII
Convert EBCDIC to ASCII
Convert EBCDIC to ASCII
Convert EBCDIC to ASCII
Convert EBCDIC to ASCII
Convert EBCDIC to ASCII Convert EBCDIC to ASCII Convert EBCDIC to ASCII Convert EBCDIC to ASCII Convert EBCDIC to ASCII Convert EBCDIC to ASCII Convert EBCDIC to ASCII Convert EBCDIC to ASCII
Convert EBCDIC to ASCII Convert EBCDIC to ASCII
Convert EBCDIC to ASCII
Go Back  Xtreme Visual Basic Talk > > > Convert EBCDIC to ASCII


Reply
 
Thread Tools Display Modes
  #1  
Old 07-31-2013, 09:24 PM
bokaraton bokaraton is offline
Centurion
 
Join Date: Sep 2003
Posts: 126
Default Convert EBCDIC to ASCII


Hi,

Does anyone know of a good software that will convert a ebcdic file to ascii?

I've been researching this process and it seem really complicated. If you know of any documentation that outlines this process that would really help too.

Cheers.
b
Reply With Quote
  #2  
Old 08-01-2013, 02:14 AM
Flyguy's Avatar
FlyguyConvert EBCDIC to ASCII Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,164
Default

This article on Microsoft Support even has source code provided:
http://support.microsoft.com/kb/216399
Reply With Quote
  #3  
Old 08-01-2013, 03:42 AM
dilettante's Avatar
dilettanteConvert EBCDIC to ASCII dilettante is offline
Underclocked lifestyle

Forum Leader
* Guru *
 
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,524
Default

I find your question troubling because you left out many important details:
Which EBCDIC? There are many, just as there are many ANSI encodings.

ASCII? Huh? Maybe you mean ANSI since there are only a few places where you'd use true ASCII in Windows. So this raises the same sort of question: Which ANSI?

Those questions fade if we can assume the common Latin Printable subset of possible characters to deal with.

But what about line-ends in this EBCDIC you have? It may use CR, or LF, or even CRLF, or some EBCDIC-unique control character. Or perhaps it is even a fixed record length file with no line delimiters at all?

How large are these files of yours?
That hoary old MS KB article basically works but it is slow as molasses. It probably can trace its origins to Win 3.1 or so.

Since 32-bit Windows came along we have some better alternatives because Windows supports several EBCDIC encodings depending on which codepages got installed (North America, European, etc. versions of Windows). VB6 was never updated to support this directly but it can make the required API calls pretty easily.

Or VB6 and even VBScript can make use of ADO's Stream object to perform such conversions.


I have attached a simple self-contained demo VB6 program. It makes a bunch of assumptions such as (a.) passing through any line delimiters and (b.) US EBCDIC. As it runs it creates its own test data based on a small input text file (included).

If you have other requirements (fixed-length records, line delimiter remapping, etc.) you may have to add a little complexity to it.

Without VB6 it won't help you much, but the guts of it are just pairs of character set mapping APIs that go to and from "Unicode" (UTF-16LE) since that's the easiest path to take.

If you do have VB6 you should be able to create a simple conversion utility program based on the demo.
Attached Files
File Type: zip To From EBCDIC.zip (5.4 KB, 9 views)
Reply With Quote
  #4  
Old 08-01-2013, 12:24 PM
dilettante's Avatar
dilettanteConvert EBCDIC to ASCII dilettante is offline
Underclocked lifestyle

Forum Leader
* Guru *
 
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,524
Default

If your files are small or you only need this now and then on a desktop PC where you have lots of free RAM you can use a simple WSH script as well:

Code:
<job>
  <reference object="ADODB.Stream" />
  <object id="stmIn" progId="ADODB.Stream" />
  <object id="stmOut" progId="ADODB.Stream" />
  <script language="VBScript">
    Option Explicit
    Dim strData

    'Convert EBCDIC US to ASCII.
    With stmIn
      .Open
      .Type = adTypeText
      .Charset = "ibm037" 'Maps to EBCDIC US codepage 037, US and
                          'Canadian English, Dutch, Protuguese.
      .LoadFromFile "ebcdic.dat"
      strData = .ReadText()
      .Close
    End With

    With stmOut
      .Open
      .Type = adTypeText
      .CharSet = "ascii" 'An alias for "iso-8859-1" which maps to
                         'codepage 1252.
      .WriteText strData
      .SaveToFile "ascii.txt", adSaveCreateOverWrite
      .Close
    End With

    MsgBox "Complete.", vbOkOnly, WScript.ScriptName
  </script>
</job>
This also doesn't address line-end mapping but simply does a literal conversion of the entire file.

Note that this is a "modern" .WSF file (new in 1999 or so) instead of a naked .VBS file.
Attached Files
File Type: zip ASC to EB.zip (554 Bytes, 7 views)

Last edited by dilettante; 08-01-2013 at 12:30 PM.
Reply With Quote
  #5  
Old 08-01-2013, 06:42 PM
bokaraton bokaraton is offline
Centurion
 
Join Date: Sep 2003
Posts: 126
Default

Quote:
Originally Posted by Flyguy View Post
This article on Microsoft Support even has source code provided:
http://support.microsoft.com/kb/216399
Thank you for your reply. This is kind of what I need. Would be great if there's an application that already does this so I am having to code it.
Reply With Quote
  #6  
Old 08-01-2013, 06:48 PM
bokaraton bokaraton is offline
Centurion
 
Join Date: Sep 2003
Posts: 126
Default

Quote:
Originally Posted by dilettante View Post
I find your question troubling because you left out many important details:
Which EBCDIC? There are many, just as there are many ANSI encodings.

ASCII? Huh? Maybe you mean ANSI since there are only a few places where you'd use true ASCII in Windows. So this raises the same sort of question: Which ANSI?

Those questions fade if we can assume the common Latin Printable subset of possible characters to deal with.

But what about line-ends in this EBCDIC you have? It may use CR, or LF, or even CRLF, or some EBCDIC-unique control character. Or perhaps it is even a fixed record length file with no line delimiters at all?

How large are these files of yours?
That hoary old MS KB article basically works but it is slow as molasses. It probably can trace its origins to Win 3.1 or so.

Since 32-bit Windows came along we have some better alternatives because Windows supports several EBCDIC encodings depending on which codepages got installed (North America, European, etc. versions of Windows). VB6 was never updated to support this directly but it can make the required API calls pretty easily.

Or VB6 and even VBScript can make use of ADO's Stream object to perform such conversions.


I have attached a simple self-contained demo VB6 program. It makes a bunch of assumptions such as (a.) passing through any line delimiters and (b.) US EBCDIC. As it runs it creates its own test data based on a small input text file (included).

If you have other requirements (fixed-length records, line delimiter remapping, etc.) you may have to add a little complexity to it.

Without VB6 it won't help you much, but the guts of it are just pairs of character set mapping APIs that go to and from "Unicode" (UTF-16LE) since that's the easiest path to take.

If you do have VB6 you should be able to create a simple conversion utility program based on the demo.
Thank you for your reply. I think it's IBM EBCDIC. Do you know of a good software I can purchase that will allow me to do what you're describing? The files I have are at least 60 mb in size. I've tried some converters provided for free online but they cannot handle more than a few mb.
Reply With Quote
  #7  
Old 08-01-2013, 07:23 PM
dilettante's Avatar
dilettanteConvert EBCDIC to ASCII dilettante is offline
Underclocked lifestyle

Forum Leader
* Guru *
 
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,524
Default

Well there are several "IBM EBCDICs" but usually the "US" version is good enough.

I don't know of any utilities prebuilt for this outside of larger software suites such as Windows Cobol compiler systems or data integration and transfer products like:

http://www.ipswitchft.com/products/m...ral/index.aspx

Your best bet is to hire a programmer, since there isn't much to this it ought to be cheap enough. Most places with such a need have programmers on staff. My VB6 demo posted above doesn't have any problem with a 60MB file.


We don't do general PC consulting and we don't do custom programming here. This is a forum site for programmers to help other programmers.
Reply With Quote
  #8  
Old 08-04-2013, 06:54 PM
dilettante's Avatar
dilettanteConvert EBCDIC to ASCII dilettante is offline
Underclocked lifestyle

Forum Leader
* Guru *
 
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,524
Default

Other things that can complicate the process include:
  • Binary or packed-decimal fields.
  • Characters with no clean mapping between EBCDIC and ASCII (or ANSI).
Reply With Quote
  #9  
Old 08-06-2013, 06:13 PM
bokaraton bokaraton is offline
Centurion
 
Join Date: Sep 2003
Posts: 126
Default

Yeah you're right...i tried some of the online converters and some of the characters with no clean mapping did not convert properly.
Reply With Quote
  #10  
Old 07-20-2015, 09:13 AM
Chuy Chuy is offline
Newcomer
 
Join Date: Jul 2015
Posts: 1
Default

I used a variation of the solution offered by dilettante because the file I needed to convert was huge:

<job>
<reference object="ADODB.Stream" />
<object id="stmIn" progId="ADODB.Stream" />
<object id="stmOut" progId="ADODB.Stream" />
<script language="VBScript">
Option Explicit
Dim strData, rawData, fileName
Dim ctr, recSize, blockSize

fileName = "RMMKHH.txt"
recSize = 509
blockSize = recSize * 100000

dim objFS
dim objIN, objOUT
set objFS = CreateObject("Scripting.FileSystemObject")
set objIN = objFS.OpenTextFile(fileName)

ctr = 0
do until objIN.AtEndOfStream
rawData = objIN.Read(blockSize)

set objOUT = objFS.CreateTextFile("temp.txt")
objOUT.Write rawData
objOUT.Close

'Convert EBCDIC US to ASCII.
stmOut.Open
stmOut.Type = adTypeText
stmOut.CharSet = "ascii" 'An alias for "iso-8859-1" which maps to codepage 1252.

stmIn.Open
stmIn.Type = adTypeText
stmIn.Charset = "ibm037" 'Maps to EBCDIC US codepage 037, US and Canadian English, Dutch, Portuguese.
stmIn.LoadFromFile "temp.txt"

do while not stmIn.EOS
strData = stmIn.ReadText(recSize)
stmOut.WriteText strData & vbCrLf
loop

stmIn.Close
stmOut.SaveToFile fileName & "_" & right("000" & ctr,4) & ".ascii", adSaveCreateNotExist ' adSaveCreateOverWrite
stmOut.Close
ctr = ctr + 1
loop
objIN.Close

MsgBox "Complete.", vbOkOnly, WScript.ScriptName

</script>
</job>


You just have to replace fileName and recSize to fit your need. With little effort you can beef up this script to be interactive.
Reply With Quote
  #11  
Old 09-10-2015, 10:53 AM
Roger-U Roger-U is offline
Centurion
 
Join Date: Apr 2008
Location: Surrey, UK
Posts: 112
Default

Gosh! not much help here.. but I remember back in1973 building a hardware logic card to do this for a magnetic tape deck... all in 7400 series TTL logic .. those were the days
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Convert EBCDIC to ASCII
Convert EBCDIC to ASCII
Convert EBCDIC to ASCII Convert EBCDIC to ASCII
Convert EBCDIC to ASCII
Convert EBCDIC to ASCII
Convert EBCDIC to ASCII Convert EBCDIC to ASCII Convert EBCDIC to ASCII Convert EBCDIC to ASCII Convert EBCDIC to ASCII Convert EBCDIC to ASCII Convert EBCDIC to ASCII
Convert EBCDIC to ASCII
Convert EBCDIC to ASCII
 
Convert EBCDIC to ASCII
Convert EBCDIC to ASCII
 
-->