View previous topic :: View next topic
|
Author |
Message |
raghav08 Currently Banned New User
Joined: 03 Jun 2008 Posts: 94 Location: Bangalore
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
raghav08 Currently Banned New User
Joined: 03 Jun 2008 Posts: 94 Location: Bangalore
|
|
|
|
Hello.
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
1) no
2) yes
since You have not cared to research, no reason for us to waste time on you
before replying i searched the forum to be sure,
the issue has been debated and solved quite a few times |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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! |
|
Back to top |
|
|
raghav08 Currently Banned New User
Joined: 03 Jun 2008 Posts: 94 Location: Bangalore
|
|
|
|
Hi,
Refrerred past posts where in COMP-3 used to get hex value.
Thanks. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
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 ) |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
Back to top |
|
|
|