January 16, 2004 at 10:46 am
Can anyone recommend a good script or tool to convert EBCDIC to ASCII (SQLServer readable format)?
We acquired some 3rd party data that we were led to believe was going to be in ASCII fixed field. It turned out to be an EBCDIC .dat binary file from an IBM390. A programmer at the government agency that sold us the data said he has a Perl script that he has modified to convert some of the fields, but it may take him a while to get to converting the rest. (I offered to do the modifications if he could provide me with the script, but I get the feeling he doesn't want to share it).
Thanks for any suggestions.
January 19, 2004 at 8:00 am
This was removed by the editor as SPAM
January 19, 2004 at 3:41 pm
Never tried this before but you might try
http://www.crystalsoftware.com.au/textpipe/ebcdic_ascii.html?google6
http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;216399
--------------------
Colt 45 - the original point and click interface
January 19, 2004 at 7:39 pm
See http://www.iconv.com - an online site with conversion stuff. May be ok if you have a one time need.
January 22, 2004 at 2:43 pm
Thanks for the replies Phill and FPerkins.
Fortunately, the vendor (after a couple of attempts to sort out field mappings) has been able to provide me with converted data.
In the meantime, I checked out your suggestions. I was able to convert at least the text fields using info from http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;216399 and by writing this quick and dirty function:
Function EBCDICtoASCII()
Dim sConvert as string, sASCII as string ', sa,sb,...
Dim iCount as byte
iCount = 0
Open "c:\Input.DAT" For Input As #1 ' Open file for input.
Open "c:\Output.txt" For Output As #2 ' Open file for output.
Do While iCount < 10 ' sample Loop until end of file.
' Read fields into variables:
Input #1, sa, sb, sc, sd, se, sf, sg, sh, si, sj
sConvert = sa & sb & sc & sd & se & sf & sg & sh & si & sj
sASCII = Translate(sConvert, EBCDIC_To_ASCII_Table())
Write #2, sASCII
iCount = iCount + 1
Loop
Close #1 ' Close files.
Close #2
End Function
Number datatype fields would require more work to figure out how to unpack them.
I tried http://www.iconv.com, but they currently support only files up to 1MB. That may increase over time as they get more donations, according to an email response from the site. Unfortunately, the smallest of my files is 30MB.
Thanks again.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply