View previous topic :: View next topic
|
Author |
Message |
varunvasudevan
New User
Joined: 10 Jan 2008 Posts: 4 Location: Chennai
|
|
|
|
how many bytes will be taken to store a variable declared as COMP SYNC ?
normally a varible declared as COMP will take 2 bytes if it is 9(1) to 9(4).
4 bytes if it is 9(5) to 9(9).
8 bytes if it is 9(10) to 9(18).
what chane will come in this when we include sync with that? |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
Hi,
Folowing information might be useful.
Quote: |
COMP binary number
S9 to S9(4) - stored as 2 bytes
S9(5) to S9(9) - stored as 4 bytes
S9(10) to S9(18) - stored as 8 bytes
NOT aligned on a specific boundary
also known as COMP-4
COMP SYNC binary number on a specific boundary
S9 to S9(4) - stored as 2 bytes on halfword
S9(5) to S9(9) - stored as 4 bytes on fullword
S9(10) to S9(18) - stored as 8 bytes on fullword
Using COMP SYNC can cause "slack bytes" to be embedded within the WORKING STORAGE because of the forced alignment. This can affect questions as to the size of table entry, or computing the size of a record.
Anything on an 01 level is automatically on a doubleword boundary.
|
KSK |
|
Back to top |
|
|
ahalyah
New User
Joined: 13 Dec 2007 Posts: 25 Location: india
|
|
|
|
Hi,
COMP SYNC is used for faster address resolution.
For ex.
01 ws-rec.
05 ws-var1 pic x(2).
05 ws-var2 pic X(3) comp sync.
then it will store ws-var2 not immedietly after 2 bytes. It will store in 5 th byte. So introduces slack bytes b/n them. But address resolution is faster. Means it will fetch the data from half word or full word boundaries. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
Is this extra documentation/maintenance complexity really gaining you enough CPU nanoseconds to justify it? |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Varun...
Do you have a specific problem involving SYNC or is this a ques that you were wondering about in general? |
|
Back to top |
|
|
varunvasudevan
New User
Joined: 10 Jan 2008 Posts: 4 Location: Chennai
|
|
|
|
Actully my doubt is , on what basis the word boundary will be decided.?
is it always 4 bytes or will it be the size of particular element in a group with wich we mention SYNC clause?
for ex:
01 group.
05 ele1 pic x(10).
05 ele2 pic 9(6) comp SYNC.
05 ele3 pic s9(4)v99 comp3.
in the above example SYNC declared with 'ele2 pic 9(6) comp' . normally it will take 4 bytes in memory.So for this group 4 bytes wll be word boundy.
so my quest is, insted of 'ele2 pic 9(6) comp' , if it was 'ele2 pic 9(14) comp sync' what would be the size of word boundary? 9(14) comp will take 8 bytes. so will it be 8 bytes? |
|
Back to top |
|
|
khyati kumar
New User
Joined: 04 Jan 2008 Posts: 15 Location: Pune
|
|
|
|
How to redefine comp-3 variable?
Suppose I have comp-3 valiable S9(11)V99 comp-3 and I have to move this value to ZZZ,ZZZ,ZZZ,ZZ9.99.So please let me know any suggestion what to do because while moving this variable i am getting S0c7 so i want to redefine ? |
|
Back to top |
|
|
|