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: 7306

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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am


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