You could always use lookup tables here is a simple shell script to generate two "DAT" files into the "/tmp/" folder and are 256 bytes in size...
You just need to compare byte for byte and convert accordingly or join the two files together and convert bytes 0 to 255 against bytes 256 to 511 and vice-versa.
A simple lookup library of your own...
Needless to say this is in its simplest form but is a starter...
Code:
#!/bin/bash
> /tmp/ASCII.DAT
> /tmp/EBCDIC.DAT
character=0
char=""
for character in {0..255}
do
char=`printf '\\\\x'"%02x" $character`
printf "$char" >> /tmp/ASCII.DAT
done
dd if=/tmp/ASCII.DAT of=/tmp/EBCDIC.DAT conv=ebcdic
ls -l /tmp/*.DAT
hexdump -C /tmp/ASCII.DAT
hexdump -C /tmp/EBCDIC.DAT
echo ""
echo "You now have two very, VERY basic, 256 byte lookup tables to access."
echo "1) /tmp/ASCII.DAT..."
echo "2) /tmp/EBCDIC.DAT..."
echo ""
exit 0
Results on OSX 10.7.5, default bash terminal...
Code:
Last login: Sun Aug 3 10:42:53 on ttys000
AMIGA:barrywalker~> chmod 755 ASC2EBC.sh
AMIGA:barrywalker~> ./ASC2EBC.sh
0+1 records in
0+1 records out
256 bytes transferred in 0.000021 secs (12201612 bytes/sec)
-rw-r--r-- 1 barrywalker wheel 256 3 Aug 11:20 /tmp/ASCII.DAT
-rw-r--r-- 1 barrywalker wheel 256 3 Aug 11:20 /tmp/EBCDIC.DAT
00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |................|
00000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |................|
00000020 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&'()*+,-./|
00000030 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |0123456789:;<=>?|
00000040 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f |@ABCDEFGHIJKLMNO|
00000050 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f |PQRSTUVWXYZ[\]^_|
00000060 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f |`abcdefghijklmno|
00000070 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f |pqrstuvwxyz{|}~.|
00000080 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |................|
00000090 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f |................|
000000a0 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af |................|
000000b0 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf |................|
000000c0 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf |................|
000000d0 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df |................|
000000e0 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef |................|
000000f0 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff |................|
00000100
00000000 00 01 02 03 37 2d 2e 2f 16 05 25 0b 0c 0d 0e 0f |....7-./..%.....|
00000010 10 11 12 13 3c 3d 32 26 18 19 3f 27 1c 1d 1e 1f |....<=2&..?'....|
00000020 40 5a 7f 7b 5b 6c 50 7d 4d 5d 5c 4e 6b 60 4b 61 |@Z.{[lP}M]\Nk`Ka|
00000030 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 7a 5e 4c 7e 6e 6f |..........z^L~no|
00000040 7c c1 c2 c3 c4 c5 c6 c7 c8 c9 d1 d2 d3 d4 d5 d6 ||...............|
00000050 d7 d8 d9 e2 e3 e4 e5 e6 e7 e8 e9 ad e0 bd 9a 6d |...............m|
00000060 79 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 |y...............|
00000070 97 98 99 a2 a3 a4 a5 a6 a7 a8 a9 c0 4f d0 5f 07 |............O._.|
00000080 20 21 22 23 24 15 06 17 28 29 2a 2b 2c 09 0a 1b | !"#$...()*+,...|
00000090 30 31 1a 33 34 35 36 08 38 39 3a 3b 04 14 3e e1 |01.3456.89:;..>.|
000000a0 41 42 43 44 45 46 47 48 49 51 52 53 54 55 56 57 |ABCDEFGHIQRSTUVW|
000000b0 58 59 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |XYbcdefghipqrstu|
000000c0 76 77 78 80 8a 8b 8c 8d 8e 8f 90 6a 9b 9c 9d 9e |vwx........j....|
000000d0 9f a0 aa ab ac 4a ae af b0 b1 b2 b3 b4 b5 b6 b7 |.....J..........|
000000e0 b8 b9 ba bb bc a1 be bf ca cb cc cd ce cf da db |................|
000000f0 dc dd de df ea eb ec ed ee ef fa fb fc fd fe ff |................|
00000100
You now have two very, VERY basic, 256 byte lookup tables to access.
1) /tmp/ASCII.DAT...
2) /tmp/EBCDIC.DAT...
AMIGA:barrywalker~> _
Hi everyone,
I have a 70MB EBCDIC file, with record length 102, block size 32742 and IBM standard label.
I commanded
dd if=input file of=outputfie ibs=32742 cbs=102 conv=ascii
but I still don't get a viewable file under ASCII.
Can anyone told me what's the problem?
Do I need... (12 Replies)
Hi,
we have source file with EBCDIC format(Main Frame files) where we receving from source system.
I would like to convert the EBCDIC format file to unix systemformat(ex: .csv,txt )
I have wrote script like:
dd if=<SRCPATH>yyy.xxx.RB065 of=<SRCPATH>/output.csv ibs=800 cbs=80... (8 Replies)
Hi,
I want to convert ebcdic values to ascii values. Are there anyany specific c++ libraries with g++ compiler, which can do it ?
gcc version 4.1.2 20080704 (Red Hat 4.1.2-54) (0 Replies)
I have a file in my Unix ( SOLARIS ) with EBCDIC format...I want this file to read in ASCII OR unicode...Is it possible with UNIX to convert this file on ASCII OR UNICODE format from EBCDIC format?
I was searching through web and found only conversion table :(
Request Rejected
Below is... (16 Replies)
Hi All ,
We have a mainframe file which is in EBCDIC format.We dont have direct access to mainframe ,client has provided us the mainframe file in unix box.The mainframe file is containing pact data(COMP1 ,COMP2 etc) which are unreadble.Can anyone suggest me how to convert this kind of ebcdic... (7 Replies)
So, i have this requirement where i need to check the file format, whether it's EBCDIC or ASCII, and based on format retrieve the information from that file:
my file is:
file1.txt-->this ebcdic file
file2.txt-->ascii file
i tried below code:
file=file1.txt
type="`file $file`"
i get... (7 Replies)
Hi,
I have a input file which is EBCIDIC and it has packed decimals.
Can anyone help me to convert EBCIDIC file to ASCII(Need to convert even Packed decimal values also to normal format).
Thanks
swapna (12 Replies)
Hi,
We have a mainframe file which is in EBCDIC format.We dont have direct access to mainframe ,client has provided us the mainframe file.The mainframe file is containing pact data(COMP1 ,COMP2 etc) which are unreadble.Can anyone suggest me how to convert this kind of ebcdic file to ascii... (11 Replies)