On Sun, 22 Jun 2014 07:49:40 +0000, Linda Mooney <
Linda....@COMCAST.NET> wrote:
>Greetings!
>
>I am looking for an EBCDIC viewer for Windows, to view flat datasets that were created on the mainframe. Edit is not necessary for what I need. Can anyone recommend one for me? Originally, I was looking for a plugin for Notepad++, but didn't find one.
>
If the file you want to view has fixed-length records, here is something that is free. The programs dd.exe, cut.exe, and tr.exe from the UnxUtils zip file can be used to convert an EBCDIC file of fixed-length records to ASCII text files. They work on 32-bit and 64-bit systems.
The programs are in a zip file at this site:
http://sourceforge.net/projects/unxutils/
You don't need all the files from the zip file, only those 3.
Extract them and set your "Command Prompt" PATH to include the directory where they are located.
Say you have an EBCDIC file named "ebcdic.bin" that someone may have created by downloading a RECFM=FB LRECL=80 data set from a mainframe with IND$FILE in binary mode, or FTP in binary mode.
To convert that to an ASCII text file named "ascii.txt" run this:
dd if=ebcdic.bin conv=ascii,unblock cbs=80 | cut -c1- >ascii.txt
The "dd" command is going to write ASCII text with only CR as the line separator, but CRLF is usually needed instead. The "cut" command in UnxUtils has the useful property of converting CR end-of-line characters to CRLF, in addition to its normal function of selecting specified columns from each line. Changing the CR to CRLF is not something that "cut" does on unix systems, but the version in UnxUtils happens to do that, which makes it a handy tool for that kind of conversion.
To change the way certain EBCDIC characters are translated, the "tr" command can be used, specifying octal values. In this example, the characters for cent, exclamation point, vertical bar, split vertical bar, left and right square brackets, and not-sign are translated from what "dd" made them to what a code page 1047-to-ISO8859-1 translation would have made them.
The following 3 lines should be entered as one line:
dd if=ebcdic.bin conv=ascii,unblock cbs=80 |
tr \133\041\135\174\325\345\330 \242\174\041\246\133\135\254 |
cut -c1- >ascii.txt
(There is a space between \330 and \242. There is no space before unblock.)
To briefly explain the "tr" command above:
"dd" translated EBCDIC cent to hex 5b (octal 133) but this "tr" will change octal 133 to hex a2 (octal 242), the cent sign in ISO8859-1.
"dd" translated EBCDIC open-bracket to hex d5 (octal 325) but this "tr" will change octal 325 to hex 5b (octal 133), the ASCII open-bracket.
The 6 EBCDIC characters assigned to hex 4a, 4f, 5a, 6a, ad, b0, and bd, as translated by "dd", are re-translated by the "tr". If your data does not have any of these, then you won't need the "tr".
Bill