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

How to move Hex values to alphanumeric field


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

New User


Joined: 03 Jul 2006
Posts: 6

PostPosted: Thu Sep 12, 2013 4:16 pm
Reply with quote

I have hex value as X'0F1D'. I want to move to X(4) variable as 0F1D

So, that If I display alphanumeric field, I should able to see as 0F1D

-----------

If Hex as value X'FF' it should come as FF
For X'1dFF0D1C' as 1dFF0D1C

The target alphanumeric field will have twice the size of hex value field.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Thu Sep 12, 2013 5:14 pm
Reply with quote

There are lots of ways. Here's [http://www.ibmmainframes.com/viewtopic.php?p=115071#115071]one[/url].

A simple way is to have a table of 256 two-byte values, and the use each byte of your input as a subscript

Code:
01  subscript-name BINARY PIC 9(4) VALUE ZERO.
01  FILLER REDEFINES subscript-name.
    05  FILLER PIC X.
    05  input-byte-here PIC X.


MOVE each input byte successively to input-byte-here and use subscript-name to put each character pair into your output.
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 Combining Multiple Row Values into Si... DB2 3
No new posts Packed decimal to Alphanumeric COBOL Programming 2
No new posts How to read unpacked field created in... DFSORT/ICETOOL 12
No new posts Trim values of parameters in JCL JCL & VSAM 2
No new posts Negative value - packed field - Natur... Java & MQSeries 0
Search our Forums:

Back to Top