benefits with SYNC

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
User avatar
rangab
Active Member
Posts: 56
Joined: Fri Mar 17, 2006 3:21 pm

benefits with SYNC

Post by rangab » Wed Feb 04, 2009 8:54 pm

Hi,

What is the benefit of declaring a field with SYNC?

Code: Select all

05  WS-TOP-MAX-TABLE-SIZE            PIC S9(04) COMP SYNC   
                                               VALUE +1000.
Please explain.

Thanks.
========
Ranga...:-0)
========
Learn Which You Don't Know - Teach Others Which They Don't Know.

User avatar
rangab
Active Member
Posts: 56
Joined: Fri Mar 17, 2006 3:21 pm

Post by rangab » Wed Feb 04, 2009 8:59 pm

In continuation to my post, I found another record structure that uses SYNC !!

Code: Select all

01 MASTER-DESTINATION-HEADER-RCD SYNC.          
   05 MSTR-HEADER-ID                 PIC  X(04).
   05 MSTR-HOLDING-SOURCE            PIC  X(01).
   05 MSTR-TLR-CODE                  PIC  X(05).
   05 MSTR-DETAIL-DATA-BYTE-CNT      PIC  9(10).
   05 MSTR-FILLER                    PIC  X(60).
Please explain.
========
Ranga...:-0)
========
Learn Which You Don't Know - Teach Others Which They Don't Know.

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Thu Feb 05, 2009 10:17 am

Hi,

SYNC is an abbreviation for SYNCHRONIZED and has the same meaning. The SYNCHRONIZED clause is an optional clause in a data description entry.

The SYNCHRONIZED clause specifies the alignment of an elementary item on a natural boundary in storage. The SYNCHRONIZED clause can appear at the elementary level or at the group level in which case, every elementary item within this group level item is synchronized- this you've already shown in the examples you post.. :)

Format of SYNC is:

Code: Select all

   -SYNC---------   -LEFT--  
                    -RIGHT-  
LEFT: Specifies that the elementary item is to be positioned so that it will begin at the left character position of the natural boundary in which the elementary item is placed.

RIGHT: Specifies that the elementary item is to be positioned such that it will terminate on the right character position of the natural boundary in which it has been placed.
Regards,
Anuj

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Thu Feb 05, 2009 10:30 am

Hi,

The SYNCHRONIZED clause is never required, but can improve performance on some systems for binary items used in arithmetic.

Just one note of caution: if you specify SYNC in variables in a non 01 level group item, then move it to another group, those fields may not be SYNCed properly.

May be a good idea to SYNC both groups.
Regards,
Anuj

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Thu Feb 05, 2009 10:32 am

Hi,

And here is a link to IBM Manuals, search on "SYNC"

http://publib.boulder.ibm.com/infocente ... b4ls37.htm
Regards,
Anuj

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others