zoom wrote:I tried couple of tools but didn't get much help.
When i open the data file using Hex editor data looks : 02 01 01 21 7C
when i convert this to EBCDIC text , it is <STX><SOH><SOH><SOS>@ . But my target data should be 20101217.
Help should be appreciated.
Are you sure you have everything the right way around? You are saying you have a file in EBCDIC which you want to have in ASCII for to insert into a database. I'm not "up" on such things, but a database on a mainframe wanting ASCII seems odd.
As NicC says, the field you are using in this example is almost certainly a "packed decimal" field. If you want to convert this to "text" (nothing to do with ASCII at all) then just, in some programming language, "move" the field to a "display" type field. This will give you F0 F2 F0 F1 F0 F1 F2 F1 F7 C7 in the Hex editor and 02010121(7). If you don't "see" the final "7", make sure the field is "unsigned".
If you want to load your example into a database, you will have no problem
already. On IBM machines, the databases can handle "packed" numbers, which is what you have.
You have EBCDIC. EBCDIC is what IBMs speak. EBCDIC is a code with 256 posibilities. ASCII is a code with 128 possibilities.
If you really have any conversion, I'd expect your incoming file to be in ASCII. Then, as long as no one has done anything stupid (like putting any sort of "non-display" data on it) the operating system will handle the conversion, as long as you tell it the input is ASCII (or, indeed, the output is ASCII). There are two sets of translation tables, one for input, one for output. They are "patchable", but I don't know if you can have one specific for you. Ask your techies...
But, I think you just have a misunderstanding. Your data, on the sample, seems to be in EBCDIC. EBCDIC has visual codes (like letters, numbers, symbols) and everything else is valid, 00 to 256, it is just data.
Why you shouldn't have binary/packed in a file for translation is that the translation tables don't know that it is part of a binary/packed field, and would just convert it if it happend to be the value of a character or symbol. Changing your binary/packed value.