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: 7309
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
Search our Forums:

Back to Top