IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Convert Hex to readable format.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
harpreet_Saini19

New User


Joined: 16 Dec 2015
Posts: 1
Location: India

PostPosted: Wed Sep 14, 2016 5:46 am
Reply with quote

I have 2 fields in a file shown below:

VARIABLE1 PIC X(01)
VARIABLE2 PIC X(03)

the values for these 2 fields is in HEX format in my input file as shown below:

VARIABLE1
Code:

.
.
.
.
 
.   


VARIABLE2
Code:

   
µ..
uµ.
uµ.
µ..
   
µ..
µ..


If i do HEX ON in the file then the values for these 2 variables looks like:

VARIABLE1
Code:

.
0
2
-
.
1
0
-
.
1
2
-
.
1
2



VARIABLE2
Code:

   
444
000
---
µ..
A20
002
---
uµ.
AA0
402
---
uµ.
AA0
402



I need to convert these 2 variables to readable format and then load these 2 fields to a table.

Please note: I have already searched for such posts on this forum but in all similar posts the data type of such variables was either binary or packed decimal. But in my case the data type of the variables is Alphanumeric.

I hope my query is bit clear to understand..icon_smile.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8568
Location: Dubuque, Iowa, USA

PostPosted: Wed Sep 14, 2016 6:30 am
Reply with quote

Quote:
I hope my query is bit clear to understand.
Nope, not at all. The first variable is a one-byte binary field and hence easy enough to convert to a human-readable format - and there are plenty of examples on this forum to follow. However, the second variable -- what do you mean by "readable format"? Should the first value be converted to 'A02012' (that is, merely convert the hexadecimal to characters representing the same value) for the first one, or 10493970 (which is what X'A02012' converts to), or something else you haven't explained?

And, by the way, hexadecimal values are also binary values -- so your point about alphanumeric is totally irrelevant.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2432
Location: Hampshire, UK

PostPosted: Wed Sep 14, 2016 3:31 pm
Reply with quote

And hex 40 is a space which is already readable.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Wed Sep 14, 2016 4:59 pm
Reply with quote

Is it too difficult to look in the DFSORT manual or attempt some search? The capability is readily available and easy to use.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2508
Location: NY,USA

PostPosted: Wed Sep 14, 2016 6:06 pm
Reply with quote

Do you tend to imply that the copybook fields are alphanumeric and you have these values in it? So far as others have said that's plain conversions from PD/BI to ZD and you will have many examples with handy code.
So if the copybook fields are character field then you will have to ask the people who produced this data set with such data and fix it or change your copybook definition as per the format of the data produced.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Sep 14, 2016 9:01 pm
Reply with quote

harpreet_Saini19,

Welcome to the forums and I'd suggest taking some time to review the responses and answer the questions asked if you have not figured out how to proceed on this.
Back to top
View user's profile Send private message
Kerry Ropar

New User


Joined: 14 Sep 2016
Posts: 25
Location: Australia

PostPosted: Thu Sep 15, 2016 10:07 am
Reply with quote

Hello Harpreet_saini19,

I am fairly new to this forum and this is my first attempt on any post, so wish me luck.

From what I understand, you have packed data coming from some source input (1) which you read into a file which has copybook format of alphanumeric defined for this field in question (2) and you want to load it into a DB2 table (3), and due to the nature of different formats involved you are facing issue.

Please let me know if my understanding is correct ia all tagged points (1/2/3). If yes, may I please request you to share the definitions in DB2 table for the target column.

Kerry.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8568
Location: Dubuque, Iowa, USA

PostPosted: Thu Sep 15, 2016 4:42 pm
Reply with quote

Kerry: terminology is critical in IT where similar terms may mean very different things. The data displayed is NOT "packed" which has a specific meaning in mainframes. The data is non-display or binary but not packed decimal, which would be the implication of calling it "packed".
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 -> DFSORT/ICETOOL

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Date format conversion DFSORT/ICETOOL 4
No new posts COnvert a column with mix of hex ,cha... DB2 5
No new posts Required Date Format in Include Sort ... DFSORT/ICETOOL 6
No new posts To convert numeric to Packed Decimal DFSORT/ICETOOL 9
No new posts how to convert Hex String t char hex PL/I & Assembler 6

Back to Top