Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Byte usage of PIC S9 1

Status
Not open for further replies.

drexan

Programmer
Oct 31, 2000
1
0
0
US
I need to know how many bytes does a PIC S9(09) occupy. Does the sign count as one byte? Thank you for your reply.
 
Hi,

The sign does not occupy a byte.

On the mainframe a value of +123 means x'f1f2c3', -123 is x'f1f2d3', value 123 in an unsigned field is x'f1f2f3'
 
Hi Crox !
What are these f1f2f3? what does the f stands for?Also in this convention how does 0 represented?
please pardon me if you see this as a silly question.

Thanks
 
The F's in this description are hexademical F's. In EBCDIC on the IBM mainframe, the internal code for the characters 0-9 are F0-F9. (In ASCII, it's 30-39.) Since the F's (or 3's) aren't really conveying any useful information when we already know that the field is being treated as a number, the F (or 3) from the high-order half-byte of the last character of the field is changed to a different value to indicate the sign, positive or negative. That is why the S in the picture clause does not take up any additional room. Hope this helps.

Betty Scherber
Brainbench MVP for COBOL II
 
BettyScherber,

I've just recently started learning COBOL. Thanks very much for that explanation. Here's a Tip Vote from me.
"When the night has been to lonely, and the road has been too long." then you need to go to bed. (Quote is from the movie/soundtrack "The Rose")
 
signed characters of 7-9 ie S9(7) through S9(9) takes 4 bytes
unsigned characters of 9(8) and 9(9) take 4 bytes
 
Actually HRayT, a picture clause of S9(7) will occupy 7 bytes, as well as PIC S9(9) taking up 9 bytes. This is the case unless the numeric fields are defined as comp or comp-3, etc.
 
You are very much correct greenguy, converting from comp to character was assumed.
 
Then the previous post was only half correct....a picture clause of S9(7) will take 4 bytes, however, a picture clause of S9(9) will take 5 bytes....

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top