IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

EBCDIC to HEXDECIMAL Conversion


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
raghav08
Currently Banned

New User


Joined: 03 Jun 2008
Posts: 94
Location: Bangalore

PostPosted: Tue Sep 21, 2010 4:24 pm
Reply with quote

Hi.


How to find the hexadecimal value of a alphanumeric (or EBCDIC) in COBOL?

For example, I want to dispaly the hexadecimal value of string 'HELLO' as 'C8C5D3D3D6' (provided not to use any readymade cross table!)

Thanks.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 21, 2010 5:09 pm
Reply with quote

What research have you done yourself? Have you looked into the LE functions?

Quote:
(provided not to use any readymade cross table!)
Who put such a ridiculous restriction on your solution?
Back to top
View user's profile Send private message
raghav08
Currently Banned

New User


Joined: 03 Jun 2008
Posts: 94
Location: Bangalore

PostPosted: Tue Sep 21, 2010 5:16 pm
Reply with quote

Hello.

icon_smile.gif no research

I want to know -

1) Is there any COBOL function that provides HEXDECIMAL values of a character string.

2) Apart from cobol-function (if any) or cross reference table, is it possible to generate hexadecimal values of a character string.

Thanks.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Sep 21, 2010 5:21 pm
Reply with quote

1) no
2) yes

since You have not cared to research, no reason for us to waste time on you icon_evil.gif
before replying i searched the forum to be sure,
the issue has been debated and solved quite a few times
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 21, 2010 5:38 pm
Reply with quote

If you click on the manuals link at the top of the page, find the COBOL Language Reference and Programming Guide manuals, you can find out for yourself every possible function that can be used in COBOL.

Since the code is simple and easy to use, a conversion table is the best way to implement this type of functionality.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 21, 2010 5:40 pm
Reply with quote

Quote:
since You have not cared to research, no reason for us to waste time on you icon_evil.gif
before replying i searched the forum to be sure,
the issue has been debated and solved quite a few times
enrico -- but, but ... this is research! icon_biggrin.gif
Back to top
View user's profile Send private message
raghav08
Currently Banned

New User


Joined: 03 Jun 2008
Posts: 94
Location: Bangalore

PostPosted: Tue Sep 21, 2010 5:40 pm
Reply with quote

Hi,

Refrerred past posts where in COMP-3 used to get hex value.

Thanks.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Sep 21, 2010 5:50 pm
Reply with quote

Quote:
enrico -- but, but ... this is research!

when i <bash> people I want to be sure that I am reasonably right
that' s why I research ( even if I do not post the links ) icon_biggrin.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Sep 21, 2010 5:56 pm
Reply with quote

Take the 1 char field and populate two 1 char work fields,
that are the last byte of two separate definitions of a 2 byte binary field.

shift the first 4 bits right
shift the second 4 bits left and then 4 bits right.

for each, if the binary fields are less than 10, add 240
if the binary fields > 10, then add 182.
then concatenate the two separate 1 char work fields to provide the 'expanded' representation of the 1 byte field.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Sep 21, 2010 6:13 pm
Reply with quote

Here's a recent posting -

www.ibmmainframes.com/viewtopic.php?t=51027&highlight=hex2char

Bill
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts file manager is doing string conversion IBM Tools 3
No new posts SMF Record Date conversion failing CLIST & REXX 1
No new posts EBCDIC and ASCII CICS 7
Search our Forums:

Back to Top