Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I print field contents in hexidecimal? 2

Status
Not open for further replies.

bungalow

Programmer
Jun 23, 2000
1
US
I need to print the contents of a troublsome<br>field at a particular manipulation point,<br>TO PAPER, and I want it in its hexidecimal<br>(packed) format.<br><br>Something like:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;01 MY-PACKED-FIELD PIC 9999 COMP-3.<br>&nbsp;&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;&nbsp;DISPLAY 'Content:' HEX MY-PACKED-FIELD<br><br>(if such a parameter as 'HEX' existed)<br>and if the contents of the field were<br><br>&nbsp;&nbsp;&nbsp;&nbsp;x'1B4CF35D'<br><br>the printed line would be:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Content:1B4CF35D<br><br>I am on an IBM VSE mainframe using Cobol II.<br><br>Thanks to anyone that can help me with this<br>problem.
 
Hi B,<br><br>Ive used this approach with MVS/COBOLII, I'm sure it will work with VSE. <br><br>P.S. I don't know why this post doesn't align properly; my apologies anyway.<br>&nbsp;<br><br>W S.<br><br>01 my-wrk-fld.<br>&nbsp;&nbsp;&nbsp;05 my-packed-fld&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pic 9(004) comp-3.<br>&nbsp;&nbsp;&nbsp;05 filler&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pic x(001) value x'0C'.<br>01 my-packed-wrk-fld&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redefines<br>&nbsp;&nbsp;&nbsp;my-wrk-fld&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pic 9(005) comp-3.<br><br>01 my-unpacked-fld&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pic 9(005).&nbsp;&nbsp;<br>01 redefines my-unpacked-fld.<br>&nbsp;&nbsp;&nbsp;05 my-display-fld&nbsp;&nbsp;&nbsp;&nbsp;pic x(004).<br>&nbsp;&nbsp;&nbsp;05 fil&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pic x(001).<br><br>P D.<br><br>move your-packed-fld to my-packed-fld<br>move my-wrk-fld&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to my-unpacked-fld<br>inspect my-display-fld converting x'FAFBFCFDFEFF'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;&nbsp;'ABCDEF'<br>DISPLAY 'PACKED FIELD &gt;' my-display-fld '&lt;'<br><br><br>The idea is to get the numerics to look like Fn. The unpack (move #2) does that but leaves you with FAs FBs, etc. inspect/convert changes them to C1s C2s etc.<br><br>Hope this helps. If you have any Ques or comments, fire away.<br><br>Regards, Jack&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;
 
Hello again B,<br><br>Here's another approach:<br><br>DISPLAY 'CONTENT &gt;' MY-PACKED-FLD '&lt;'<br><br>Then use SDSF to look at your SYSOUT. Save the <br>SYSOUT to a flat file. Use ISPF EDIT to look at the <br>file; set HEX ON; and look at the bytes between the<br>&gt; &lt;. I don't have access to a mainframe at the mom-<br>ent, here's what it looks like on SPFPC (ASCII mode):<br><br>******* ******************* top of data *******...<br>0000001 &gt; 4\&lt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;313532222222222222....<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;D24CC0000000000000....<br>******* ******************* bottom of data ****...<br><br>Again, the alignment!! Anyway, hope you get the idea.<br><br>Jack&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top