MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

COMP-3 variables storage bytes display needed

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
mfuser
Banned


Joined: 01 Mar 2005
Posts: 105
Topics: 58

PostPosted: Thu Oct 05, 2006 4:19 pm    Post subject: COMP-3 variables storage bytes display needed Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Thu Oct 05, 2006 5:03 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
mfuser
Banned


Joined: 01 Mar 2005
Posts: 105
Topics: 58

PostPosted: Fri Oct 06, 2006 1:22 am    Post subject: Reply with quote

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.

Code:

3
3
4
4
4
4

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Fri Oct 06, 2006 5:08 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
mfuser
Banned


Joined: 01 Mar 2005
Posts: 105
Topics: 58

PostPosted: Fri Oct 06, 2006 7:31 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group