Page 1 of 1

Read hexadecimal value from a file

PostPosted: Wed Nov 10, 2010 8:31 am
by pucca71
Hi,

I have to read a file that has hexadecimal values as :
.......f
00000008
00000016
or
.......*
00000005
000002DC
or
....Be..
0000C830
000525FD


My question is, how to declare the variable to hold this value ? Fixed decimal (15) is not working at all. I need to do some aritmetical operations with them.

Thanks !

Re: Read hexadecimal value from a file

PostPosted: Wed Nov 10, 2010 9:06 am
by dick scherrer
Hello,

How was this data defined by the process that created the file?

As shown, the 8 bytes could be multiple values or just a single value.

Re: Read hexadecimal value from a file

PostPosted: Wed Nov 10, 2010 5:10 pm
by Akatsukami
These are certainly not packed decimal (= FIXED DECIMAL) numbers; a packed decimal number must have a sign (A-F, although you'll only see C, D, and F these days) as the low-order nybble, and decimal digits (0-9) in the other nybbles. The first example has a non-sign (6) in the sign nybble; the second and third examples have non-decimal digits in other positions.

As Mr. Scherrer says, it is necessary to know what they were intended to be before they can be re-used.

Re: Read hexadecimal value from a file

PostPosted: Wed Nov 10, 2010 5:47 pm
by pucca71
Thanks both for your prompt response ! :D
This was a requirement and was told to me that the field in that position will be fixed dec (15,2). In unit testing phase, I found those values, so as you perfectly say, need to ask the analyst to find out which was the original field definition.

I will come back !

Thank you!

Re: Read hexadecimal value from a file

PostPosted: Thu Nov 11, 2010 2:00 am
by dick scherrer
Good luck - someone will be here :)

d