Link to home
Create AccountLog in
Avatar of SirRoshua

asked on

How do I Convert EBCDIC Character Overpunch Values to ASCII?

This is a difficult question worth 500 points to whom ever can provide a solution ASAP, as I need to have a working solution in place by 4/14/2008.

I have tried everything I know to convert an EBCDIC Character Overpuch Currency Value into ASCII format with a floating point leading sign value.

For example, the following is the original state of the value (the comma I have added to seperate fields as a precursor of an import into SQL):


I need to convert this into the following:


There are approximately 10k records per file with about 15 currency values one after the other. I have no dificulties in inserting the decimal, or dropping of the leading zero's, nor converting the graphic sign into its consituent numerical value, but cannot seem be able to insert the negative sign when needed at the beginning of the value, when I do insert through a simple find and replace command I have only managed to do so at the need of the value string, at which point the value is not treated as numeric or negative, but rather as a text string by Excel (where I need to do further manipulation before importing into SQL) and SQL.

 The full graphic sign table is as follows:
{ = 0
A = 1
B = 2
C = 3
D = 4
E = 5
F = 6
G = 7
H = 8
I = 9
} = -0
J = -1
K = -2
L = -3
M = -4
N = -5
O = -6
P = -7
Q = -8
R = -9

Any assistance would be greatly appreciated!

FYI: I am using UltraEdit v14, File is encoded DOS, from an original .DAT file sent to me from an outside source.
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of SirRoshua


Thanks cactus_data, that was indeed the solution.

To get this to work I had to do the following:

Had to leave it formatted as 000085.7Q in the text editor.
Dropped it into Excel and did the Find/Replace to leave it formulated as 000085.78- ensuring all the columns in question were formatted as TEXT.
Imported into an Access table as suggested where the corresponding columns were formatted as CURRENCY. Access automatically reformatted to an accepted currency format, dropping off the leading zeros and moving the negative from back to front (well actually putting the value in parentheses, but same diff).
Then ran an Append query to move the records in Access table to the SQL database without further any issues.

Thanks for the assist!
Thank cactus_data, you saved my arse on this one, had a deadline looming that would have thrown a lot of dev timeline work out of wack.

Cheers - Roshua!
Thanks for the feedback.

The actual answer to this seems to have disappared. I see "If you have access to Microsoft Access, it reads/imports this format as a numeric value right away. " However 'it' seems to be missing. Where would I find 'it'?
Nothing has vanished; Microsoft Access is "it".

It is for download somewhere at Microsoft's site as a 30 or 90 days (or is it 30 launches?) evaluation version for free.