IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Convert a 2 Byte HEX value into a 3 Byte Alphanumeric value


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
SyntelShinto

New User


Joined: 30 May 2007
Posts: 10
Location: Mumbai

PostPosted: Wed May 30, 2007 4:24 pm
Reply with quote

Hi All,

I need to convert a 2 Byte HEX value into a 3 Byte Alphanumeric value

Please help me on the same.

For example my input is hex'C1C2'

I need to display it in 3 byte alphanumeric like ' AB'
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed May 30, 2007 5:01 pm
Reply with quote

what is the problem in this?
if you have x'c1c2' two bytes, what is the defn of this?
if x(02) then move it to x(03) justified right and display.
Back to top
View user's profile Send private message
SyntelShinto

New User


Joined: 30 May 2007
Posts: 10
Location: Mumbai

PostPosted: Thu May 31, 2007 8:54 am
Reply with quote

Hi Abhijit,

I think i mentioned worngly, My requirement is to convert the HEX value into the corresponding Decimal value and display it.

Like if we are passing X'FF' it should convert to decimal equivalent of 255.


Could you please suggest,
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu May 31, 2007 11:54 am
Reply with quote

Looks like a totally new question to me, but still, where is the problem?
try this-
Code:
77 hex-var pic x(02) value x'00ff'.
77 num-var redefines hex-var pic 9(04) comp.

display num-var.
Back to top
View user's profile Send private message
SyntelShinto

New User


Joined: 30 May 2007
Posts: 10
Location: Mumbai

PostPosted: Thu May 31, 2007 12:40 pm
Reply with quote

Thanks Abhijit Now i got it ....,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
Search our Forums:

Back to Top