Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

EBCDIC to HEXDECIMAL Conversion

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: EBCDIC to HEXDECIMAL Conversion
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: 8053
Location: East Dubuque, Illinois, USA

PostPosted: Tue Sep 21, 2010 5:09 pm    Post subject:
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    Post subject: Reply to: EBCDIC to HEXDECIMAL Conversion
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10254
Location: italy

PostPosted: Tue Sep 21, 2010 5:21 pm    Post subject: Reply to: EBCDIC to HEXDECIMAL Conversion
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: 8053
Location: East Dubuque, Illinois, USA

PostPosted: Tue Sep 21, 2010 5:38 pm    Post subject:
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: 8053
Location: East Dubuque, Illinois, USA

PostPosted: Tue Sep 21, 2010 5:40 pm    Post subject:
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    Post subject: Reply to: EBCDIC to HEXDECIMAL Conversion
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10254
Location: italy

PostPosted: Tue Sep 21, 2010 5:50 pm    Post subject: Reply to: EBCDIC to HEXDECIMAL Conversion
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: 6967
Location: porcelain throne

PostPosted: Tue Sep 21, 2010 5:56 pm    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Sep 21, 2010 6:13 pm    Post subject: Reply to: EBCDIC to HEXDECIMAL Conversion
Reply with quote

Here's a recent posting -

http://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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Conversion of a VB file to FB. isssal DFSORT/ICETOOL 1 Mon Oct 31, 2016 10:23 pm
No new posts EBCDIC to ASCII conversion using OCOPY mistah kurtz All Other Mainframe Topics 5 Tue Sep 06, 2016 2:26 pm
No new posts Converting EBCDIC to Unicode (TimeStamp) muralikrishnan_new COBOL Programming 2 Mon Jul 25, 2016 10:42 pm
No new posts Comparex utility to Syncsort conversion mistah kurtz SYNCSORT 11 Fri Jul 22, 2016 1:53 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us