Ebcidic to ASCII (Packed decimals are there)

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Ebcidic to ASCII (Packed decimals are there)
# 1  
Old 10-01-2013
Ebcidic to ASCII (Packed decimals are there)

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)
# 2  
Old 10-01-2013
I would use SAS!!!!!! Who comes up with these types of problems??
# 3  
Old 10-01-2013

A few thoughts:

1) Write a COBOL program to read the records in the native format and write ASCII format.

2) Use perl to convert files, using something like the perl module Convert::IBM390 -- functions for manipulating mainframe data:
Convert::IBM390 supplies various functions that you may find useful when working with IBM System/3[679]0 data. No functions are exported automatically; you must ask for the ones you want. "use ... qw(:all)" exports all functions.

By the way, this module is called "IBM390" because it will deal with data from any mainframe operating system. Nothing about it is specific to z/OS, or z/VM, z/VSE, i5/OS, z/TPF....

When transmitting EBCDIC data to your Perl environment via FTP, be sure to use the "binary" option. This will leave the data unconverted so that the module recognizes it. By default, FTP will translate the data to ASCII; this will convert the character fields correctly but garble other formats, such as packed-decimal and binary.

This function is much like Perl's built-in "unpack". It takes an EBCDIC record (structure) and unpacks it into a list of values. If called in scalar context, it will return only the first unpacked value. The TEMPLATE is patterned after Perl's unpack template but allows fewer options.
-- The CPAN Search Site - search.cpan.org

If you don't want to or cannot write such codes:

3) Google for software or services to help. I think I did a search like that last year, and most of the hits were for proprietary products and services.

Best wishes ... cheers, drl
This User Gave Thanks to drl For This Post:
# 4  
Old 10-01-2013
Thanks for the reply.
Can i have the perl script which does the conversion from packed decimal to normal format
# 5  
Old 10-01-2013
Originally Posted by Anusha_Reddy
Thanks for the reply.
Can i have the perl script which does the conversion from packed decimal to normal format
You or someone will need to write the perl script that calls the module noted above, just as the COBOL program would need to be written. In the case of perl, you also may need to get the perl module from the cpan web site.

Best wishes ... cheers, drl

Last edited by drl; 10-01-2013 at 11:13 AM..
# 6  
Old 10-01-2013
If you send me, or post the file layout I will give you a quote to write a Cobol program to do this.
EBCDIC to ASCII is not a one for one translation. Do you know if the file contains untranslatable characters, and if so what you want to do about those?
I have done this writing a ksh script using 'cut' to create two files. one with all the display fields and the other with all the packed fields, then used dd to convert the display file, and a script using hd to unpack the packed fields, then put everything back together again.
# 7  
Old 10-03-2013
Thanks alot.

My File Layout is:
            SEGMENT-LENGTH        PIC S9(4).
            CLIENT-NUM            PIC 9(04).
            APPLICATION-NUM       PIC X(12).
            APPLICATION-SUFFIX    PIC 9(2).
            CDATE-EVENT           PIC S9(7).
            TIME-EVENT            PIC S9(7).
            EVENT_REDEFINES       PIC S9(7)
            CICS-TRANS-CODE       PIC X(04).
            OPERATOR-ID     PIC X(6).
            CUSTOMER-ID     PIC 9(09).
            ACCOUNT-NUMBER  PIC X(19).
            TRACKING-NUM    PIC X(6).
            TYPE-EVENT      PIC X(3).
            EVENT-DATA     PIC X(450)

EVENT-DATA --> This column contains some set of columns and the columns varies based on the event types ie., based on the value from TYPE-EVENT column.

Incase if TYPE-EVENT=1 then the number of columns in the EVENT-DATA is :
PREV-CNCY-CODE            PIC X(03).
CNCY-CONV-TIME                  PIC  9(07).
FILLER             PIC X(428)

Incase if TYPE-EVENT=2 then the number of columns in the EVENT-DATA is :
FILLER             PIC X(448).

Like this i have TYPE-EVENT from 1 to 900 so please help me with the script

Last edited by Franklin52; 10-03-2013 at 07:43 AM.. Reason: Please use code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert Hex to Ascii in a Ascii file

Hi All, I have an ascii file in which few columns are having hex values which i need to convert into ascii. Kindly suggest me what command can be used in unix shell scripting? Thanks in Advance (2 Replies)
Discussion started by: HemaV
2 Replies

2. UNIX for Dummies Questions & Answers

applying unix command in EBCIDIC file

Hi, I'm having a general query. If we do cat <file name> on a Ebcidic format file then many unknown characters are displayed in my screen. Can we change the character set related to EBCIDIC in session level and apply the cat command on a EBCIDIC file? By doing so can we able to see the... (2 Replies)
Discussion started by: poova
2 Replies

3. Shell Programming and Scripting

how to convert data from ASCII to Packed Decimal

Hi All, Please let me know if it is possible to convert data from ASCII to Packed Decimal through Unix? Basically we have ASCII file with numeric data we want to convert that files data to Packed decimal format to send it to main frame. Please let me know if we can do it through unix script.... (1 Reply)
Discussion started by: aloktiwary
1 Replies

4. UNIX for Dummies Questions & Answers

Viewing Ebcidic files

I am having trouble viewing these files from my unix session. vi comes back with line too long. Also an m_dump with the relevant dml comes back with problems. How can I view this as a text file? Also is there an easy way to view specific records within. Eg I have a policy id (4 Replies)
Discussion started by: trek88
4 Replies

5. Shell Programming and Scripting

convert Regular decimals to Packed decimals

Hi, I am trying to find if there is a way to convert regular decimal values to Paced decimal values. I tried to find a c program but I could get a Packed converted to regular decimal not the other way round. If not unix please let me know if any other progrimming language I can use to do... (2 Replies)
Discussion started by: mgirinath
2 Replies

6. Shell Programming and Scripting

conversion of EBCIDIC to ASCII format

Hi all, I need help on above said subject. I have a flat file which is in EBCDIC format,i want to convert into ASCII fromat using 'MFSORT'. file contains COMP-3 value in some positions. Can you please provide the SCRIPT SYNTAX.(assume that file is of 80 byte length and it is having COMP-3... (2 Replies)
Discussion started by: vijayakumarg
2 Replies

7. UNIX for Dummies Questions & Answers

EBCDIC to ASCII conv for packed decimals.

By using dd command in Unix one can convert EBCDIC file into ASCII. It fails when it comes to having packed decimals within the EBCDIC file. The resultant of it has garbage chars. How can we have EBCDIC file convertedinto ASCII, which has packed decimal data in it? Thanks in advance. (3 Replies)
Discussion started by: videsh77
3 Replies

8. Shell Programming and Scripting


can anyone get a script for converting EBCIDIC data to Unix ina file.. in shell... thanks in advance! (3 Replies)
Discussion started by: bourne
3 Replies

9. Shell Programming and Scripting

ebcidic file coversion to ascii

I want to convert an ebcidic( variable length) file to ascii. Is it possible to do it using a unix scripting.if so, how (7 Replies)
Discussion started by: rintingtong
7 Replies

10. UNIX for Dummies Questions & Answers

Packed Decimal

How do we create a text file with COBOL "Packed Decimal" value in UNIX ? (1 Reply)
Discussion started by: gaddeg
1 Replies
Login or Register to Ask a Question