Page 1 of 1

Aproach to Convert EBCDIC to ASCII for HEX values in COBOL

PostPosted: Sun Aug 05, 2012 5:40 pm
by PRMOHANTY
Hello All ,

We have a specific situation where we have to port/migrate all existing COBOL applications currently running on Mainframe environment to Linux Environment. ( going ahead the application would run in Linux environment )
Most of the COBOL programs are having inbuilt HEX constants defined in the program which are subsequently used in the program for data comparison.

EX ; 05 VAR-XYZ PIC X VALUE X'C2'.

We know that this HEXADECIMAL is of EBCDIC Collating Sequence in Mainframe.

Now after migrating these COBOL codes to LINUX , we have to convert these constants to HEX equivalent of ASCII.

What is the best approach to translate all these HEX constants in EBCDIC to equivalent ASCII .( On avearge we have 300+ programs in our set-up which has HEX constants defined in them )

Thanks in advance!!

Re: Aproach to Convert EBCDIC to ASCII for HEX values in COB

PostPosted: Sun Aug 05, 2012 5:49 pm
by enrico-sorichetti
unfortunately You will you will have to do it by hand with a cheat sheet to look for correspondences

but probably wiser top review the application to convert everything to good old plain chars

Re: Aproach to Convert EBCDIC to ASCII for HEX values in COB

PostPosted: Sun Aug 05, 2012 6:58 pm
by Robert Sample
A manual approach is probably the best way, and depending upon the code may be the ONLY way.

A more important question to answer, however, is WHY are there hexadecimal constants in the COBOL programs? If the application is parsing network messages, for example, you'd run into a host of issues in attempting to do that on a Linux system. And since there are multiple variants of EBCDIC, as well as different variations of ASCII, somebody needs to build the character conversion table in advance to prevent confusion.

Re: Aproach to Convert EBCDIC to ASCII for HEX values in COB

PostPosted: Sun Aug 05, 2012 7:15 pm
by PRMOHANTY
Thanks a Lot Enrico & Robert for quick response .

I am still wondering that many installations must have already faced this challenge and must have overcome this problem.

Apart from knowing the best approach to resolve this situation , I am also interseted in knowing the various challenges this situation would potentially pose and things I have to consider before applying any solution/approach.

Re: Aproach to Convert EBCDIC to ASCII for HEX values in COB

PostPosted: Sun Aug 05, 2012 7:24 pm
by enrico-sorichetti
I am still wondering that many installations must have already faced this challenge and must have overcome this problem.


the specific problem is due, sorry to say, to a poor application design/programming standards
why use HEX constants ???

Re: Aproach to Convert EBCDIC to ASCII for HEX values in COB

PostPosted: Sun Aug 05, 2012 8:21 pm
by Robert Sample
I have heard of very few sites that use hexadecimal constants in COBOL. Hence, your statement that many installations have already faced this problem is incorrect -- almost no sites would have the issues your site has since they don't use hexadecimal constants.

Re: Aproach to Convert EBCDIC to ASCII for HEX values in COB

PostPosted: Sun Aug 05, 2012 8:24 pm
by Monitor
Probably a programmer without training on COmmon Business Oriented Language with C or Assembler knowledge!
Why not give him a GoBack or in worst case a Stop Run.

Re: Aproach to Convert EBCDIC to ASCII for HEX values in COB

PostPosted: Mon Aug 06, 2012 1:15 am
by dick scherrer
Hello,

In tha case of the x'C2', how is the value used? Is this to be the letter B when used or is this just a pattern of ones and zeros that represent bits that are on or off? Where/how did the x'C2' originate?

Re: Aproach to Convert EBCDIC to ASCII for HEX values in COB

PostPosted: Wed Aug 08, 2012 12:59 am
by PRMOHANTY
The usage of X'C2' would be letter B instead of on or off representation for bits.

Re: Aproach to Convert EBCDIC to ASCII for HEX values in COB

PostPosted: Wed Aug 08, 2012 1:21 am
by dick scherrer
Hello,

Then it would be far better to use "B" as the value instead of x'C2'. . .

It should not be too difficult to identify where the x'..' values are specified and then change them to the appropriate character(s). You really don't want to deal with ascii/ebcdic flip-flops . . . imho.