Ebcdic to ascii


 
Thread Tools Search this Thread
Top Forums Programming Ebcdic to ascii
# 15  
Old 08-03-2014
Quote:
Originally Posted by tostay2003
Hi Don,

a) Are there any libraries for cobol conversion to ANY other formats?
b) Similarly are there any libraries for ebcdic to ascii

We want to use libraries instead of implementing C++ code for which we do not have much expertise

Thanks & Regards,
Asif
  1. You can search the web as easily as I can.
  2. I already told you you could use iconv() from libc. And bigearsbilly already told you you could use the dd utility. But, as I have repeatedly told you those COBOL data formats are binary; not EBCDIC.
# 16  
Old 08-03-2014
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~> _

# 17  
Old 08-03-2014
Wisecracker, he doesn't actually want EBCDIC, he's just parroting the term... And hasn't answered any of our questions enough for us to have the ability to help him.
# 18  
Old 08-11-2014
This might help with a translation. It was written for COBOL, but could be adapted for other languages as well http://home.comcast.net/~wporter211/...ascebc.cob.txt
# 19  
Old 08-11-2014
wbport, he doesn't actually want EBCDIC, he's just parroting the term... And hasn't answered any of our questions enough for us to even be able to try to help him.
# 20  
Old 08-11-2014
The person who started this thread hasn't responded to questions raised more than a week ago. This thread is closed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

EBCDIC to ASCII conversion

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)
Discussion started by: swapna_1990
11 Replies

2. UNIX for Advanced & Expert Users

EBCDIC to ASCII conversion

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)
Discussion started by: swapna_1990
12 Replies

3. UNIX for Beginners Questions & Answers

Check if file is EBCDIC or ASCII format

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)
Discussion started by: gnnsprapa
7 Replies

4. Shell Programming and Scripting

Need help for EBCDIC TO ASCII conversion through UNIX

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)
Discussion started by: STCET22
7 Replies

5. UNIX for Advanced & Expert Users

Conversion from EBCDIC to Ascii OR unicode

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)
Discussion started by: joshilalit2004
16 Replies

6. UNIX for Advanced & Expert Users

Conversion of data - ebcdic to ascii

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)
Discussion started by: tostay2003
0 Replies

7. Shell Programming and Scripting

EBCDIC Format to ASCII

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)
Discussion started by: koti_rama
8 Replies

8. UNIX for Dummies Questions & Answers

Help! EBCDIC format to ASCII

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)
Discussion started by: hrchl86
12 Replies

9. UNIX for Dummies Questions & Answers

Conversion from EBCDIC to ASCII

when i try to convert a mainframe EBCDIC file to ASCII ,i dont see correct file this is the source file ... (3 Replies)
Discussion started by: venkatvelpula
3 Replies

10. Shell Programming and Scripting

ascii to ebcdic conversion

Hello, I need a program for ascii to ebsdic conversion. If anybody can help, it'll be greatly appreciated. Thanks. (1 Reply)
Discussion started by: er_ashu
1 Replies
Login or Register to Ask a Question