HP3000-L Archives

December 2000, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Wirt Atmar <[log in to unmask]>
Reply To:
Date:
Fri, 22 Dec 2000 15:46:29 EST
Content-Type:
text/plain
Parts/Attachments:
text/plain (17 lines)
Ron,

> How can I split a s9(4) binary field (16 bits), into 2 8 bit fields.
>  I've seen where 2 "X" are used but I can't convert them to numeric data.

It's obvious that you probably want to do this in COBOL and I know nothing
more about COBOL than how to spell it, but in virtually any other language
you could do something like this:

     For the upper byte: U = int(A/256)

     For the lower byte   L = A and 255  or  L = A mod 256

where A is the original 16 bit number, and U and L are 8-bit numbers.

Wirt Atmar

ATOM RSS1 RSS2