IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Uses of USAGE SYNC Clause


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rahul_desai29

New User


Joined: 15 Mar 2006
Posts: 10
Location: fl;jds

PostPosted: Wed Mar 15, 2006 12:03 pm
Reply with quote

Quote:


HI, ALL
I Want to know the uses of using USAGE SYNC

RAHUL
Back to top
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Wed Mar 15, 2006 12:39 pm
Reply with quote

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

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Fri Mar 24, 2006 9:10 am
Reply with quote

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

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Fri Mar 24, 2006 10:16 am
Reply with quote

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

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Fri Mar 24, 2006 11:13 am
Reply with quote

Hey Ekta,

That explains.

Thanks
ap_mainframes
Back to top
View user's profile Send private message
cheryala

New User


Joined: 20 Mar 2006
Posts: 46

PostPosted: Fri Mar 24, 2006 1:06 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts To search DB2 table based on Conditio... DB2 1
No new posts STEM usage in REXX CLIST & REXX 14
No new posts z/OS Modules Usage report using SMF 42 DFSORT/ICETOOL 2
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts JCL and TAPE drives: how to maximize ... JCL & VSAM 9
Search our Forums:

Back to Top