View previous topic :: View next topic |
Author |
Message |
mfuser Banned
Joined: 01 Mar 2005 Posts: 105 Topics: 58
|
Posted: Thu Oct 05, 2006 4:19 pm Post subject: COMP-3 variables storage bytes display needed |
|
|
Members,
I have two variables declared as :
Code: |
01 A PIC 9(05) COMP-3
01 B PIC S9(05) COMP-3.
|
A variable takes 2 bytes of internal storage and B variable takes 3 bytes of internal storage.Despite of the Rule followed for calculating the bytes occupied for COMP-3 variables can we display / know how many bytes of storage each variable A and B takes that is ouput should be 2 and 3 respectively. Can we know by any means ? |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12370 Topics: 75 Location: San Jose
|
Posted: Thu Oct 05, 2006 5:03 pm Post subject: |
|
|
Quote: |
A variable takes 2 bytes of internal storage and B variable takes 3 bytes of internal storage.
|
mfuser,
you are wrong. Both A and B both occupy 3 bytes. How did you come up with 2 bytes for A? Any way here is a way to find the length.
Code: |
01 WS-VAR1 PIC 9(06) COMP-3.
01 WS-VAR2 PIC S9(06) COMP-3.
PROCEDURE DIVISION.
DISPLAY LENGTH OF WS-VAR1
DISPLAY LENGTH OF WS-VAR2
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
mfuser Banned
Joined: 01 Mar 2005 Posts: 105 Topics: 58
|
Posted: Fri Oct 06, 2006 1:22 am Post subject: |
|
|
Kolusu,
Thanks for your help.
Code: |
01 A PIC 9(05) COMP-3
|
A takes 3 bytes because 5/2 = 2.5 so take out fraction part and add 1 so it becomes 3.
Some practise examples:
Code: |
01 A PIC 9(05) COMP-3.
01 B PIC S9(05) COMP-3.
01 C PIC 9(05)V99 COMP-3.
01 D PIC S9(05)V99 COMP-3.
01 WS-VAR1 PIC 9(06) COMP-3.
01 WS-VAR2 PIC S9(06) COMP-3.
|
Please let me know how the bytes storages are respectively as given in the output so that i will be clear in understanding. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12370 Topics: 75 Location: San Jose
|
Posted: Fri Oct 06, 2006 5:08 am Post subject: |
|
|
Quote: |
A takes 3 bytes because 5/2 = 2.5 so take out fraction part and add 1 so it becomes 3.
|
mfuser,
Now re-read your first post and about the no: of bytes for A.
Quote: |
Please let me know how the bytes storages are respectively as given in the output so that i will be clear in understanding.
|
huh ? Not a clue as to what you are talking. if you are talking about how Comp-3 items are stored then read this
http://www.mvsforums.com/helpboards/viewtopic.php?p=34067#34067
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
mfuser Banned
Joined: 01 Mar 2005 Posts: 105 Topics: 58
|
Posted: Fri Oct 06, 2006 7:31 am Post subject: |
|
|
Kolusu,
Thanks for your help.I am interested in knowing how is the storage bytes
Code: |
3 A
3 B
4 C
4 D
4 WS-VAR1
4 WS-VAR2
| respectively for variables.
I had displayed for variable A i want to know about other variables also.Please let me know about that and also if A is correct or wrong. |
|
Back to top |
|
|
|
|