View previous topic :: View next topic
|
Author |
Message |
rahul_desai29
New User
Joined: 15 Mar 2006 Posts: 10 Location: fl;jds
|
|
|
|
Quote: |
HI, ALL
I Want to know the uses of using USAGE SYNC
RAHUL |
|
|
Back to top |
|
|
nuthan
Active User
Joined: 26 Sep 2005 Posts: 146 Location: Bangalore
|
|
|
|
Hi,
Every time it will start from fresh boundary while occupying bytes.
Let us suppose If my first variable is x(3) and next one is s9(4) comp, then if you do not specify the SYNC clause, S9(4) COMP will start from byte 3 ( assuming that it starts from 0 ). If you specify SYNC, then the binary data item will start from address 4. You might see some wastage of memory, but the access to this computational field is faster. |
|
Back to top |
|
|
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
Hi Nuthan,
Can you expain this more??
I got a impression that you want to say that there if overlapping of data if we dont specify SYNC??
If yes, then how will you identify that where do you nees to use SYNC???
Thanks
ap_mainframes |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi ap
Its nt like overlapping.
suppose if u declare wo variable like that...
01 var-a pic 9(4).
01 var-b pic x(6).
then var-a will occupy the first 4 byte of the word & varb will occupy 5 th byte to 10 th byte of the same word.
But if we declare ...
01 var-a pic 9(4).
01 var-b pic x(6) usage sync.
then var-a will occupy the first 4 byte of the word & var-b will occupy first 6 byte of the next word.
hope it will helpful. |
|
Back to top |
|
|
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
Hey Ekta,
That explains.
Thanks
ap_mainframes |
|
Back to top |
|
|
cheryala
New User
Joined: 20 Mar 2006 Posts: 46
|
|
|
|
HI,
I hope this will give some more idea about the sync clause ...
SYNC clause is specified with COMP, COMP-1 and COMP-2 items. These items are expected to start at half/full/double word boundaries for faster address resolution. SYNC clause does this but it may introduce slack bytes (unused bytes) before the binary item.
01 WS-TEST.
10 WS-VAR1 PIC X(02).
10 WS-VAR2 PIC S9(6) COMP SYNC.
Assumes WS-TEST starts at relative location 0 in the memory, WS-VAR1 occupies zero and first byte. WS-VAR2 is expected to start at second byte. As the comp item in the example needs one word and it is coded with SYNC clause, it will start only at the next word boundary that is 4th byte. So this introduces two slack bytes between WS-VAR1 and WS-VAR2.
Cheers
RSC |
|
Back to top |
|
|
|