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
 

 

How to move Hex values to alphanumeric field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to move Hex values to alphanumeric field
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Thu Sep 12, 2013 5:14 pm    Post subject: Reply to: How to move Hex values to alphanumeric field
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    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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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