Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hexadecimal value of @, '.', >.... 3

Status
Not open for further replies.

claudeb

Programmer
Nov 23, 2000
140
CA
Hi, is there a way or a web site where i could find the hexadecimal value of certain special characters like: @, '.', >, # etc
Thanks
 
Do you want the ebcidic representation or the hexadecimal value??

If you can find the binary representation then it should be straightforward to turn that into hex..

Not really sure why you would want it though as it would only really have meaning to the op. system. Let me know if it was any help. Feedback is helpful.
 
Hi,

of course there is!

It depends on the characterset you are using, for example, EBCDIC on the mainframe is different from ASCII on the PC.

Suppose you do an accept in your COBOL environment and with a redefines, you get the binairy value of it.

Not tested example:

Code:
  01  INPUT-CHAR       PIC X.
  01  EXAMINE-VALUE  PIC S9(4) BINAIRY.
  01  EXAMINE-VALUE-RED REDEFINES EXAMINE-VALUE.
       03  EVR-FIRST-BYTE PIC X.
       03  EVR-SECND-BYTE PIC X.
  01 DISPLAY-VALUE    PIC ZZZ9. 

        ACCEPT INPUT-CHAR FROM CONSOLE.
        MOVE LOW-VALUE TO EVR-FIRST-BYTE.
        MOVE INPUT-CHAR TO EVR-SECND-BYTE.
        MOVE EXAMIN-VALUE TO DISPLAY-VALUE.
        DISPLAY 'INPUT-CHAR ' INPUT-CHAR ' HAS A DECIMAL VALUE OF '
          DISPLAY-VALUE.

Some decimal values for the characters you mentioned are:

CHR$(046) = .
CHR$(060) = <
CHR$(062) = >
CHR$(064) = @

I hope this is helpful!

Greetings,

Crox





 
by the way, those decimal codes are for ASCII
 
If you know base 10, you can convert to base 2 and then to base 16. Let me know if it was any help. Feedback is helpful.
 
Better to tell the whole story. I have been asked to change a file to a &quot;Tab Delimited&quot; file. I learned from another forum that &quot;Tab&quot; is X'05' in hexa.
if X'05' is the hexa representation for &quot;Tab&quot;, what is the hexa representation for plain 5 (decimal) ?
I work on a main frame.
Thanks to all. Was it a good feed back ?
 
Aaah yes, that does seem to throw a spanner into the works! I would have thought that x'05' would be 5, just as x'00' would be 0 and x'A' would be 10?? If the other thread is correct then I am obviously wrong. Help...
 
I checked the meaning of
(British and Australian) To put/throw a spanner in the works (Am throw a (monkey) wrench in something) is to be the cause of spoiling a plan.
interesting.
Back to my question. I &quot;see&quot; tabs in my file. With a utility i have, i also did a dump. X'05' is a effectively &quot;tab&quot;.
Thanks.
 
No chance of you doing a dump with all the chars you want in it is there??
And yes, I guess a spanner is an english version of a wrench, sorry about the colloquialisms. Sorry I couldn't have been more help.
 
Hi,

a plain 5 is hexadecimal x'F5' on IBM's mainframe.

But when it has a sign, for example +5 it is x'C5', -5 is x'D5'.

If you specify comp-3 or packed-decimal you have x'5F', x'5C' or x'5D' for 5, +5 and -5.

There exists quick references for this containing the ASCII and EBCDIC character sets. But if you are on the mainframe,
you probably have ISPF. So you go into an edit session,
type in the stuff you are interested in, just new text... and give the primary command:

==> HEX ON

after that, you see the hexadecimal values for all the characters you where editing.....

Regards,

Crox
 
it kills me to realize that i did know a &quot;plain&quot; 5 is a X'5F' in hexa. i am sorry to waste yout time. god i don't feel particuleraly smart today !
thanks Crox, thanks pipk.
 
Actually you have just described the ebcidic character set where 5 is represented by '11111001' i.e. F5.
 
You wrote:
--------------
Better to tell the whole story. I have been asked to change a file to a &quot;Tab Delimited&quot; file. I learned from another forum that &quot;Tab&quot; is X'05' in hexa.
if X'05' is the hexa representation for &quot;Tab&quot;, what is the hexa representation for plain 5 (decimal) ?
--------------
I looked up the SPECIAL-NAMES clause, because I had been able to define a class called &quot;DISPLAYABLE&quot; by listing the EBCDIC values of all sets of displayable characters in collating order. I wanted to see if I could set up a SPECIAL-NAME for a class that I would call &quot;TAB.&quot; And have it defined only as the single value X '05'. I believe that this can be done, but I'm not sure.

You would set it up like this: In your ENVIRONMENT DIVISION, you place a CONFIGURATION SECTION.

Then you would set it up in the following way:

SPECIAL-NAMES.
CLASS TAB IS X'05'.

Then you could use IF TAB MOVE TO [wherever, or do whatever].

I'm not 100% sure that you can set up a hex literal like this in a special-names class. Anyone else know?

If not, then you could set up a variable in Working Storage named TAB-CHAR and define it as a PIC X(2) and give it the value X'05' and go from there i.e. IF [character] = TAB-CHAR MOVE TO [whatever, or do whatever].

Or you could set it up as a literal, stating IF [character] = X'05' MOVE TO [whatever, or do whatever].

I welcome anyone else's insights into this intriguing and knotty problem.

Nina Too
 
Hi Claude,

The Appendix of any COBOL manual should contain both ASCII & EBCIDIC conversion tables.

Nina,

I think you can, but it's less esoteric to define a simple variable w/an 88 level, e.g.:

05 tab-fld pic x value x'05'.
88 tab value x'05'.
Jack
 
You're right about the 88 being less esoteric. Just put down a value for TAB as X'05'. Then test whether TAB is true or not.

But I did want to see if I could do this as a special-name or not in case I need to ever deal with classes of these sorts of characters.

I did once set up a special-name class called 'DISPLAYABLE' because the program I wrote was reading off of a TSQ onto a map (in CICS). And the TSQ was full of undisplayable characters which blew up the map sky high. So I had to find a way to replace the undisplayable characters with displayable characters for map display.

By the way, where can you find ordinal values for these undesplayable characters i.e. TAB, or RETURN? Because I looked this up in my IBM COBOL Reference Guide. It had a very nice EBCDIC collating guide. But conveniently left out all the undisplayable characters.

Nina Too
 
Hi Nina,

Any cobol reference (i.e. vs, II, 370, LE, etc.) has an appendix that contains an ASCII/EBCIDIC conversion table. They will probably duplicate what you have on your card. The Ordinal, Decimal, and Hex representations for unprintables will follow in sequence, e.g.:

There's a gap between ord 128 and ord 130, so:
Code:
ORD    SYM     DEC   HEX 
128     &quot;      127   7F
130     a      129   81
the vals for 129 would be
129            128   80
This, of course was the smallest gap, but you just keep adding 1 for each entry in the gap.

Why they didn't include them in the table is anybody's guess. My guess: they wanted to save paper and ink. :)

Regards, Jack.
 
Claude,

I just reread your original post. There should be a law against that kind of language on the internet!

Jack
 
Thanks.

But I wanted to know about specific undisplayable characters. For instance, what is the ordinal value for TAB? What is the ordinal value for RETURN/ENTER? What is the ordinal value for BACKSPACE? Etc. What are the hex values for these specific undisplayable characters?

How did the person in the other forum know that the hex value for TAB is X'05'?

If anyone knows where in the COBOL reference manual that this is, please let me know. We have the IBM COBOL reference manuel on TSO Bookmanager. I found the ASCII and EBCIDIC collation tables, and the conversion tables. But all of them leave out the values for undisplayable characters.

I know that this has gotten a bit esoteric. But I'm curious.

Nina Too
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top