Page 1 of 2

Need to convert from hex to displayable format.

PostPosted: Fri Dec 25, 2009 8:46 pm
by syannigeri
Hi,

I have a file which is in hex, S9(09)V99 Comp-3. How can i convert this to displayable format?

1. There is a way to convert using file aid, Let me know how to do using file aid?
2. Also Let me know how to convert using cobol, Let me know the PIC clause to be moved to, to get data in displayable format?

Thanks
Shanakrgouda

Re: Need to convert from hex to displayable format.

PostPosted: Sat Dec 26, 2009 10:33 am
by Robert Sample
What have you researched in the File Aid manual so far?
What have you researched in the COBOL manuals so far?

Re: Need to convert from hex to displayable format.

PostPosted: Sat Dec 26, 2009 6:44 pm
by syannigeri
1. In File aid i know, I need to create a Copy book in HEX and Another in normal layout(PIC value of normal layout is not known).
2. Using cobol, I am not sure of the move statement

You guys need to confirm the below move will work or not?

MOVE S9(09)V99 COMP-3 to X(5) will work?
I calcualated X(5) using 9/2 = 4 +1..

What will happen to the Sign bit and the decimal bit?

Is that correct? Else let me know the method to convert HEX to a Displyable format...

Re: Need to convert from hex to displayable format.

PostPosted: Sun Dec 27, 2009 12:48 am
by Robert Sample
There is no decimal bit -- implied decimal point means implied; it is not explicit. Assuming you mean "human-readable" when you say "Displayable", your move will not provide you with the desired result. Moving to a variable defined as PIC 9(10).99 SIGN LEADING SEPARATE will let you see all the digits as well as the sign and decimal point. This does, however, take extra bytes for the sign and decimal point. Also, your calculation is off -- there are 11 digits in your number, not 9 (you must also consider the digits after the decimal point) so it actually requires six bytes to store the number not 5.

A File Aid copybook that contains the appropriate PIC for the variable will automatically display the value for you.

Re: Need to convert from hex to displayable format.

PostPosted: Sun Dec 27, 2009 7:49 am
by syannigeri
Thanks Robert for you valuable reply..

What will be the value of sign bit , when we move

MOVE PIC 9(10).99 SIGN LEADING SEPARATE to PIC X(06) ?

Thanks
Shankargouda

Re: Need to convert from hex to displayable format.

PostPosted: Sun Dec 27, 2009 8:55 am
by dick scherrer
Hello,

What will be the value of sign bit
There is no "sign bit" - neither in the comp-3 input nor the "displayable" output.

The sign of a packed-decimal (comp-3) data item is the low-order nibble (1/2 byte) of the least significant byte. Valid signs for a packed-decimal field are C (positive), D (negative), and F (implied positive). To see this view a comp-3 field in tso/ispf using HEX ON.

Re: Need to convert from hex to displayable format.

PostPosted: Mon Dec 28, 2009 2:27 am
by Robert Sample
If you move PIC 9(10).99 SIGN LEADING SEPARATE to a PIC X(06) field, you'll lose the most significant digits -- what will actually be moved will be the last 3 digits before the decimal point, the decimal point, and the 2 digits after the decimal point. Asking about the "sign bit" indicates you have no understanding of how numbers are stored internally on a z/OS machine. You really, really, really need to spend several hours in manuals to grasp the fundamental differences between the internal representations of PIC X, numeric USAGE DISPLAY, numeric USAGE COMP, and numeric USAGE COMP-3 fields.

Asking about things like sign bits and decimal bits shows how much you need to hit the books -- giving you the right answers will not improve your understanding of the concepts that you have no clue about yet (such as internal representations). Study the manuals. Study the manuals. Study the manuals.

Re: Need to convert from hex to displayable format.

PostPosted: Mon Dec 28, 2009 4:18 am
by dick scherrer
Hello,

Study the manuals. Study the manuals. Study the manuals.
And a good place to start your "manual bookmark collection" is here:

http://publibz.boulder.ibm.com/cgi-bin/ ... 0/CONTENTS

This is the Table of Contents page for the Enterprise COBOL Language Reference Manual. In addition to the Table of COntents and the Appendix entries at the back of the manual, the material is also searchable by using the tubelight/flashlight near the top-left of each page.

Re: Need to convert from hex to displayable format.

PostPosted: Wed Dec 30, 2009 10:39 pm
by syannigeri
COMP IS BINARY
COMP-3 IS PACKED DECIMAL

Is this forum not to discuss things and learn?
Or Its just to get ready made solutions ? :evil:

Re: Need to convert from hex to displayable format.

PostPosted: Mon Jan 04, 2010 6:06 am
by dick scherrer
Hello,

Your reply
COMP IS BINARY
COMP-3 IS PACKED DECIMAL

Is this forum not to discuss things and learn?
Or Its just to get ready made solutions ?
is most confusing. . . :?

You needed to post a short definition of comp and comp-3? Why?

It is our intent to provide you with ways to "discuss and learn" - -but most of the burden is yours. We try to provide guidance and when someone tries something that does not work, we try to help diagnose.

We typically do not provide "ready made custom solutions".

When you collect your thoughts, someone will be here.