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
 

 

HEX to ASCII conversion

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
pravinj

New User


Joined: 10 Jun 2008
Posts: 24
Location: india

PostPosted: Mon May 07, 2012 4:47 pm    Post subject: HEX to ASCII conversion
Reply with quote

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
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon May 07, 2012 4:52 pm    Post subject: Reply to: HEX to ASCII conversion
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Mon May 07, 2012 4:56 pm    Post subject: Reply to: HEX to ASCII conversion
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon May 07, 2012 9:04 pm    Post subject:
Reply with quote

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
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 Comparex utility to Syncsort conversion mistah kurtz SYNCSORT 11 Fri Jul 22, 2016 1:53 pm
No new posts changing z/os unicode conversion service meykh2014 All Other Mainframe Topics 0 Tue Jul 12, 2016 10:49 am


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