Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Perl Unpack Cobol Binary File and Fields

by Anonymous Monk
on May 04, 2020 at 21:49 UTC ( [id://11116455]=note: print w/replies, xml ) Need Help??


in reply to Perl Unpack Cobol Binary File and Fields

For BINARY data, IBM uses big-endian byte order: the most-significant byte is stored first, not last as with Intel microprocessors. The format is 2's complement.
  • Comment on Re: Perl Unpack Cobol Binary File and Fields

Replies are listed 'Best First'.
Re^2: Perl Unpack Cobol Binary File and Fields
by Anonymous Monk on May 04, 2020 at 21:51 UTC
    BINARY, COMP, and COMP-4 are synonyms. Binary-format numbers occupy 2, 4, or 8 bytes of storage. If the PICTURE clause specifies that an item is signed, the leftmost bit is used as the operational sign.

    A binary number with a PICTURE description of four or fewer decimal digits occupies 2 bytes; five to nine decimal digits, 4 bytes; and 10 to 18 decimal digits, 8 bytes. Binary items with nine or more digits require more handling by the compiler.
      Full disclosure: "if the picture does not specify that the binary operand is "signed," COBOL will automagically disregard two's complement. (However, not the case here.)
        (The S picture-character indicates a signed value.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11116455]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-20 00:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found