|"It's all coming back to me now."
05 FIELD1 PIC 9(5) VALUE 0 BINARY.
05 FIELD2 PIC 9(4) VALUE 0 BINARY.
05 FIELD3 PIC 9(4) VALUE 0 BINARY.
05 FIELD4 PIC 9(8) VALUE 0 BINARY.
05 FIELD5 PIC 9(4) VALUE 0 BINARY.
05 FIELD6 PIC S9(04) VALUE 0 COMP.
05 FILED7 PIC S9(15)V99 VALUE 0 COMP-3.
05 FIELD8 PIC S9(15)V99 VALUE 0 COMP-3.
Your data should consist of big-endian
data as follows:
FIELD1, FIELD4 four unsigned bytes, binary.
FIELD2, FIELD3, FIELD5 two unsigned bytes each, binary.
DATA.FIELD6 two bytes, binary, but two's complement signed.
DATA.FIELD7-FIELD8 nine-byte fields consisting of seventeen binary-coded-decimal (BCD) digits (four bits = "one nybble" each) followed by a sign-indicator in the rightmost "nybble" as described above. The rightmost two digits are implicitly understood to be right of the decimal point.
I am not immediately aware of any Perl package which will directly handle "BCD representation." Although I do, of course, expect that Many Monks will promptly correct me on this point! Because, "this being Perl, surely it must be there."
Edited: Thanks for pointing out what I originally had missed – that FIELD4 requires to be a four-byte field.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.