View previous topic :: View next topic
|
Author |
Message |
Pranjal
New User
Joined: 17 Mar 2006 Posts: 4
|
|
|
|
How much space in terms of bytes will the following variables take and how is it calculated?
S9(4) COMP
S9(5) COMP
S9(8) COMP
S9(9) COMP
S9(10) COMP |
|
Back to top |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi,
COMP is a binary storage format . The sign stored in a COMP field will be in the most significant bit. Bit is ON if -ve, off if +ve.
S9(4) COMP - 2 bytes
S9(5) COMP - 2 bytes
S9(8) COMP - 4 bytes
S9(9) COMP - 4 bytes
S9(10) COMP - 5 bytes
Hope this is what you had expected. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi,
The best place to find the ans to ques like yours is in the manuals. From the Zos Pgming Reference Manual:
Digits in PICTURE clause
Storage occupied
1 through 4
2 bytes (halfword)
5 through 9
4 bytes (fullword)
10 through 18
8 bytes (doubleword)
Scroll to the top of this page; clk "manuals".
Scroll down to manual selections and clk on your choice. |
|
Back to top |
|
|
Pranjal
New User
Joined: 17 Mar 2006 Posts: 4
|
|
|
|
Thanks for the replies. I must be checking the mauals first. |
|
Back to top |
|
|
KS
New User
Joined: 28 Feb 2006 Posts: 91 Location: Chennai
|
|
|
|
Hi,
The COMP occupies Int(n/2) 4 bytes and COMP-3 occupies Int((n/2)+1) bytes.
So using this we get the results as :
S9(4) COMP - Int(4/2) = 2 bytes
S9(5) COMP - Int(5/2) = 2 bytes
S9(8) COMP - Int(8/2) = 4 bytes
S9(9) COMP - Int(9/2) = 4 bytes
S9(10) COMP - Int(10/2) =5 bytes
Thanks,
KS |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
KS,
The info I offered above was cut & pasted from IBM's eCOBOL Language Reference Manual (SC27-1408-01). Where did you get your info? |
|
Back to top |
|
|
KS
New User
Joined: 28 Feb 2006 Posts: 91 Location: Chennai
|
|
|
|
HI mmwife,
Sorry all , I was wrong on tht..
A binary number with a picture description,
- less than 4 or fewer decimal digits will occupy 2 bytes.
- 5 to 9 decimal digits will occupy 4 bytes.
- 10 to 18 bytes occupies 8 bytes.
Regret the inconvienience caused.
Thanks,
KS |
|
Back to top |
|
|
kamran
New User
Joined: 01 May 2005 Posts: 55
|
|
|
|
Pranjal wrote: |
How much space in terms of bytes will the following variables take and how is it calculated?
S9(4) COMP
S9(5) COMP
S9(8) COMP
S9(9) COMP
S9(10) COMP |
Hi ,
I have written a rexx routines named copyflds to compute the lenght and offset of each feild in a cobol copy member.
I think you don't need to change it much but you can customize it upon your name conventions.
One of The systax of calling it is:
TSO COPYFLDS dataset-name copy-member-name
which copy-member-name is the name of the cobol copy member name
and dataset-name is the name of the dataset which the copy members is reside in.
please copy both attach files COPYFLDS and COPYPICS into a dataset which is concatenated in your user sysproc ddname .
because I prepared it just for my site, I didn't prepared it any document so if there is any problem using it please put a message here. |
|
Back to top |
|
|
kamran
New User
Joined: 01 May 2005 Posts: 55
|
|
|
|
Sorry I don't know why the mentioned bellow files didn't attached, So I will try it once!.
I think the problem was that I didn't select any extention for the files.
So use the attached files to this one!
Hi ,
I have written a rexx routines named copyflds to compute the lenght and offset of each feild in a cobol copy member.
I think you don't need to change it much but you can customize it upon your name conventions.
One of The systax of calling it is:
TSO COPYFLDS dataset-name copy-member-name
which copy-member-name is the name of the cobol copy member name
and dataset-name is the name of the dataset which the copy members is reside in.
please copy both attach files COPYFLDS and COPYPICS into a dataset which is concatenated in your user sysproc ddname .
because I prepared it just for my site, I didn't prepared it any document so if there is any problem using it please put a message here.[/quote] |
|
Back to top |
|
|
new2cobol
New User
Joined: 04 Jan 2006 Posts: 77 Location: Bangalore
|
|
Back to top |
|
|
dneufarth
Active User
Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
Back to top |
|
|
|