Subject: | |
From: | |
Reply To: | |
Date: | Fri, 19 Feb 2010 12:10:33 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Greg,
In reading your question I was left wondering if you were having a
problem with COBOL COMP (Binary number) or COBOL COMP-3 (Packed Decimal
digits).
If your issue is with COMP-3 , you are going to have to do some bit
manipulation. In order to process the field correctly you need to look
at 4 bits at a time, which will be in the range 0-9. The last 4 bits
will be either an 0xC (positive), 0xD (negative), or 0xF (unsigned).
This should help.
With respect to COMP you need to remember that the HP3000 stores data
with numbers from MSB (most significant bit) to LSB (least significant
bit). IIRC - this is referred to as Big-Endian. IIRC - PC's are
Little-Endian which means that you would need to reverse the order of
the bits to get valid data out of the COMP fields.
Scott Petersen.
Greg Terterian wrote:
> Friend of mine asked me if I can:
>
> << Can you ask our HP buddies and find out what the formula is to convert comp fields to readable format
>
> I know what its doing but I just don’t get the formula
> I know it is packing the information into 4 bytes for example 5500 = 7)
>
> How to get something into pure binary form
>
> I am trying to read the 100 byte string which contains some packed fields (I do have the layout) in Visual Basic and need to update SQL from VB>>
>
> Any ideas or directions will be highly appreciated.
>
> Thank you
> Greg
>
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
> .
>
>
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|