Read hexadecimal value from a file



IBM's cross-platform compiler PL/I for MVS, VM & VSE, OS/390 and Enterprise PL/I for z/OS

Read hexadecimal value from a file

Postby pucca71 » Wed Nov 10, 2010 8:31 am

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 !
Thank you so much.
Pucca.
User avatar
pucca71
 
Posts: 19
Joined: Wed Sep 22, 2010 6:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: Read hexadecimal value from a file

Postby dick scherrer » Wed Nov 10, 2010 9:06 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Read hexadecimal value from a file

Postby Akatsukami » Wed Nov 10, 2010 5:10 pm

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Read hexadecimal value from a file

Postby pucca71 » Wed Nov 10, 2010 5:47 pm

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!
Thank you so much.
Pucca.
User avatar
pucca71
 
Posts: 19
Joined: Wed Sep 22, 2010 6:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: Read hexadecimal value from a file

Postby dick scherrer » Thu Nov 11, 2010 2:00 am

Good luck - someone will be here :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to PL/I

 


  • Related topics
    Replies
    Views
    Last post