Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Doubt on SYNC Clause

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
chikkamurali

New User


Joined: 13 Mar 2005
Posts: 3
Location: hyderabad

PostPosted: Tue Mar 29, 2005 9:24 am    Post subject: Doubt on SYNC Clause
Reply with quote

hi friends,

when we code SYNC Clause with comp&comp1 it will introduce slack bytes.can u explain the effective reason for this.and please explain me indetail about SYNC Clause.
Back to top
View user's profile Send private message

chandramouli.v

New User


Joined: 21 Mar 2005
Posts: 12

PostPosted: Tue Mar 29, 2005 12:18 pm    Post subject: Re: Doubt on SYNC Clause
Reply with quote

If u use sync clause it will store data internally on word boundaries
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat May 14, 2005 8:53 pm    Post subject:
Reply with quote

Hi Murali,

When arith is performed the compiler generates the appropriate assembler instructions to do this. Some of these instructions require that the data be aligned on half, full, or double word boundaries.

If the data is not so aligned, the compiler allocates appropriately aligned work fields, moves the data there and uses them for the arith. When finished the data is moved back (if necessary); so you can see how this affects performance.

When SYNC is used these moves are not necessary.

P.S. You rarely see SYNC used today.
Back to top
View user's profile Send private message
brain_s390

New User


Joined: 06 May 2005
Posts: 58
Location: Mumbai

PostPosted: Sun May 15, 2005 12:12 am    Post subject: Re: Doubt on SYNC Clause
Reply with quote

For binary data items, the address resolution is faster if they are located at word boundaries in the memory.

E.g: The memory word size is 4 bytes which means that each word will start from an address divisible by 4. If 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. If we specify SYNC clause then the binary data item will start from address 4. The disadvantage is the wastage of memory which is overshadowed as the access to this comp field is much faster !!
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun May 15, 2005 5:27 am    Post subject:
Reply with quote

It's been a long time since I contemplated this stuff, but as I remember if the field was a halfwd binary item SYNC would align it on a halfwd boundary; if a fwd or a cOMP-1, on a fwd bound; if a dblwd or a COMP-2, on a dblwd bound.

But, a word to the wise: if you don't have a VERY good reason to use it, DON'T. There's a lot more to it than was discussed here. Check your COBOL Ref Manual.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Doubt in MFS abdulrafi IMS DB/DC 2 Fri Oct 21, 2016 3:09 pm
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts Sync sort - Transpose TS70363 SYNCSORT 5 Tue Jun 28, 2016 3:18 am
No new posts How to sync memebers in some datasets... Lord.of.Wind Compuware & Other Tools 2 Thu Apr 21, 2016 12:48 pm
No new posts [SQL0029] INTO clause missing from em... HABBIE DB2 2 Fri Sep 04, 2015 3:54 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us