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)

I would use SAS!!!!!! Who comes up with these types of problems??

Hi.

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:

-- 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

1 Like

Thanks for the reply.
Can i have the perl script which does the conversion from packed decimal to normal format

Hi.

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

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.

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 :

CURR-MAINT-DATE USAGE COMP-3    PIC S9(7).
PREV-MAINT-DATE USAGE COMP-3    PIC S9(7).
PREV-CNCY-CODE            PIC X(03).
CNCY-CONV-DATE  USAGE COMP-3    PIC S9(07).
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 :

FR-CUST-NAMETYPE  PIC X(1).
TO-CUST-NAMETYPE  PIC X(1).
FILLER             PIC X(448).  

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

Can you confirm that if the record layout for EVENT-TYPE = 1 can be written as:

CURR-MAINT-DATE USAGE DISPLAY    PIC S9(7) SIGN IS LEADING SEPARATE CHARACTER. .
 PREV-MAINT-DATE USAGE DISPLAY    PIC S9(7) sign as above. 
PREV-CNCY-CODE            PIC X(03).
 CNCY-CONV-DATE  USAGE DISPLAY    PIC S9(07) sign as above.
 CNCY-CONV-TIME                  PIC  9(07). 
FILLER             PIC X(416)

That is, there is no valid data in the filler.
Also, for EVENT-TYPES 3 through 900, are there other layouts that include packed decimal?
I am puzzled by the date and time fields as they are signed and also that sizes of 8 and 6 respectively would be more appropriate,and require the same amount of disk space. Is there a possibility that they are negative, and if so should these also be changed to leading separate character?

Hi,

Filler contains only spaces and this is just to make sure the length of the record is same irrespective of the EVENT_TYPE.

Date and TIME are packed decimals and there is nothing that we need to round off and all.Just need to pass what we get from source.

Thanks alot for your reply..

I meant CDATE-EVENT and TIME-EVENT, not the sub fields in EVENT-DATA.

Yes the CDATE-EVENT and TIME-EVENT, are the sub fields in EVENT-DATA.

Do you know the file recording mode? Probable modes are fixed record length, no record separator; or fixed record length with record separator.
What operating environment does the file reside in?
If I leave the signed fields without a leading separate character, negative numbers will end in a lower case letter in the units column, so depending upon what you intend to do with the file, you may still have to do more conversion.
Approximately how many records are in the file?

The file is a fixed width without any filed seperator.
The file is not huge approximatly 20k records.
From packed to normal format should be proper ie., we should not remove any signs..