I have a file which contains some hex data.  When I unpack it using "H", it
gives me what I want, almost.

Original file:
rtrates.rtrates

Perl Script:
rtrates.pl

Results:
rtrates.out

What the results are supposed to look like:
rtrates.txt

The problem I'm having is that although the first two fields come out fine
(one is a 2-digit number, and the other is a 4 digit number), the other
fields are odd.

Examples:

Number should be               unpack returns
..6700                                          8f00
..6800                                          8d00
..6900                                          8b00
..7000                                          7000
..7100                                          7100
..7200                                          7800
..7300                                          7900

I spent several hours on this yesterday.  I noticed that the '3' in 7300
becomes a '9', which is the square.  The '2' in 7200 comes out as an '8',
which is the cube.  No pattern there, though.  Both the pairs (7200 - 7800)
and (7300 - 7900) are a difference of 600, which doesn't happen in any of
the other pairs.  If the letters in the other numbers are hex, then how
come they increment by 2 instead of one ('b to d', instead of 'b to c' or
'b to a'?)  I even tried some old algebra from high school, and tried
(using the last two listed there) [7x + 9y = 7300] and [7x + 8y = 7200],
and solved for x and y, but got useless numbers as a result (at least, they
weren't whole numbers, so they seemed useless to me).

Does anyone have any ideas?  I've asked some of the AS/400 people here at
work (the original file comes from an AS/400, and is downloaded via FTP
using the ASCII formatting), and they don't know.  When I look at the
file's raw data on the AS/400 it looks the same as it does in the included
rtrates.rtrates file.

I know this is only peripherally related to Perl, but I know that there are
a lot of really talented people in this group, so I thought one of you
might have a magic answer.

Thank you,
Shawn


(See attached file: rtrates.txt)(See attached file: rtrates.pl)(See
attached file: rtrates.out)(See attached file: rtrates.rtrates)


Shawn
(Anything following this line is crap thrown in by my company's e-mail
system.  Please ignore it.  I hate e-mail footers that sound threatening.)


**********************************************************************
This e-mail and any files transmitted with it may contain 
confidential information and is intended solely for use by 
the individual to whom it is addressed.  If you received
this e-mail in error, please notify the sender, do not 
disclose its contents to others and delete it from your 
system.

**********************************************************************

Attachment: rtrates.txt
Description: Binary data

Attachment: rtrates.pl
Description: Binary data

Attachment: rtrates.out
Description: Binary data

Attachment: rtrates.rtrates
Description: Binary data

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to