Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to convert hex to character format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
Radha3

New User


Joined: 17 Apr 2008
Posts: 4
Location: Bangalore

PostPosted: Fri Apr 18, 2008 10:37 am    Post subject: How to convert hex to character format
Reply with quote

Hi can anyone anyone help regarding this query

I have a field ABCD PIC X(1) that stores values in
hexadecimal format eg. X'21'

There is another field AAAA PIC X(2)

I want to move ABCD to AAAA so that value in AAAA
comes out to be 21.
Back to top
View user's profile Send private message

vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Fri Apr 18, 2008 1:07 pm    Post subject:
Reply with quote

Hi,

Code:
01 ABCD PIC X(1).



if u force the value 21 to store in to variable ABCD the value get truncated

and i guess hexadecimal of numeric 21 is 2B.

afterwards you can convert hexdecimal to numeric or watever u like to change.

there are functions in COBOL to convert hex to other formatts and vice versa.
Back to top
View user's profile Send private message
Radha3

New User


Joined: 17 Apr 2008
Posts: 4
Location: Bangalore

PostPosted: Fri Apr 18, 2008 2:24 pm    Post subject: Reply to: How to convert hex to character format
Reply with quote

What are those functions which are available in COBOL? Can you please tell me..
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: Fri Apr 18, 2008 7:39 pm    Post subject:
Reply with quote

Hello,

Quote:
if u force the value 21 to store in to variable ABCD the value get truncated
This is incorrect (or at least mis-understood in terms of the request). The request is how to "move" an x'21' (perfectly valid in one byte) to 2 bytes that contain x'F2F1' or 21.

Quote:
and i guess hexadecimal of numeric 21 is 2B.
Has nothing to do with the request.

One way is to define an array of 2-byte entries of all of the values from x'00' to x'FF' and then use the single byte as the displacement into the array.

If i remember, someone also posted a way to "calculate" this and a search in the forum could find it.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Apr 18, 2008 7:46 pm    Post subject:
Reply with quote

You might play with one by Bill O'Boyle....
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts FTP data transfer from PC to Mainfram... AJAYREDDY All Other Mainframe Topics 8 Wed Aug 23, 2017 9:59 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us