View previous topic :: View next topic
|
Author |
Message |
harpreet_Saini19
New User
Joined: 16 Dec 2015 Posts: 1 Location: India
|
|
|
|
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
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.. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
And hex 40 is a space which is already readable. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
Kerry Ropar
New User
Joined: 14 Sep 2016 Posts: 25 Location: Australia
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
|