View previous topic :: View next topic
|
Author |
Message |
pravinj
New User
Joined: 10 Jun 2008 Posts: 24 Location: india
|
|
|
|
We have a requirement to convert serial number stored in HEX format to displayable format. Input field will be in fact be an alphanumeric field storing the hex characters in it.
Code: |
For example,
Input serial number: 17B46
Expected output : 97094 |
Input is the HEX equivalent of the output stored in string format.
Please let me know on how we could approach it. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What's with the ASCII? You'll need to find out what ASCII is, 'cos generally you won't find it on the mainframe.
If you have a fullword binary number and you want to display it, you define it and DISPLAY it.
Code: |
05 A-FULLWORD-NUMBER COMP PIC 9(9) or PIC S9(9).
DISPLAY A-FULLWORD-NUMBER
|
Or even better, move it to a numeric-edited field. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
every byte is usually represented in it' s HEX form
so Your definition of hex is WRONG!
since this is a COBOL forum why not talk about the proper PIC' s
also the term ASCII has no place in the MAINFRAME !
wiser to review Your understanding of data and number representation
the POP ( Principles of OPerations ) will tell all You might want to know on the subject! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you read about how numeric data is stored/used in COBOL. The COBOL Language Reference is available via the link to "IBM Manuals" at the top of the page.
If you find something in the manual that is not clear, post what you found and your doubt. Someone will be able to clarify. |
|
Back to top |
|
|
|