View previous topic :: View next topic
|
Author |
Message |
HozE
New User
Joined: 21 Feb 2007 Posts: 6 Location: Mumbai
|
|
|
|
hi ALL,
I recently came across a variable defined as SPPPP99999
Any comments on how much memory will be occupied??? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
As this is something i'd not seen before, thought i'd give it a try.
Don't know what i expected, but what i got would not have been what i expected<g>. Maybe i've just done it "wrong".
The code
Code: |
01 SP9WORK. BLW=00000+098 0CL5
05 SP9 PIC SPPPP99999. BLW=00000+098,0000000 5C
000-MOVEM.
MOVE SPACES TO SP9WORK.
MOVE 123 TO SP9.
DISPLAY SP9WORK.
DISPLAY SP9.
MOVE SPACES TO SP9WORK.
MOVE 987654321 TO SP9.
DISPLAY SP9WORK.
DISPLAY SP9.
|
The output
Code: |
0000{
0000{
0000{
0000{
|
|
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
HozE wrote: |
hi ALL,
I recently came across a variable defined as SPPPP99999
Any comments on how much memory will be occupied??? |
It would be 5 bytes, the S shares a the byte with the last 9, and the Ps don't take up any bytes. Never have used the P except for training classes. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Thoughts about how i got all zeros in the result? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
dick scherrer wrote: |
Hello,
Thoughts about how i got all zeros in the result? |
With the P on the left SPPPP99999 is a very small number with the decimal point before the leftmost P (.000099999).
Code: |
5.3.11.1.1 P symbol
Because the scaling position character P implies an assumed decimal point (to the left of the Ps, if the Ps are leftmost PICTURE characters; to the right of the Ps, if the Ps are rightmost PICTURE characters), the assumed decimal point symbol, V, is redundant as either the leftmost or rightmost character within such a PICTURE description.
In certain operations that reference a data item whose PICTURE character-string contains the symbol P, the algebraic value of the data item is used rather than the actual character representation of the data item. This algebraic value assumes the decimal point in the prescribed location and zero in place of the digit position specified by the symbol P. The size of the value is the number of digit positions represented by the PICTURE character-string. These operations are any of the following:
Any operation requiring a numeric sending operand.
A MOVE statement where the sending operand is numeric and its PICTURE character-string contains the symbol P.
A MOVE statement where the sending operand is numeric-edited and its PICTURE character-string contains the symbol P and the receiving operand is numeric or numeric-edited.
A comparison operation where both operands are numeric.
In all other operations the digit positions specified with the symbol P are ignored and are not counted in the size of the operand. |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Thanks Craig
'Preciat it.
Gee, i could've found it if i'd looked
d |
|
Back to top |
|
|
|