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
 

 

Group level SYNC vs Elementary SYNC

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

New User


Joined: 25 Dec 2006
Posts: 4
Location: chicago

PostPosted: Mon Apr 02, 2007 8:34 pm    Post subject: Group level SYNC vs Elementary SYNC
Reply with quote

Hi,
What is the difference between these two types of statement in GroupLevel 01. Everything is same except SYNC.
Any help is appreciated.

Code:

01  INEXIT01-IOAREA SYNC.                                       
    05  ACCEPT-CODE                PIC X     VALUE 'Y'.         
        88 RECORD-ACCEPTED                   VALUE 'Y'.         
        88 RECORD-DELETED                    VALUE 'N'.         
        88 RECORD-INSERTED                   VALUE 'I'.         
    05  EXIT-ID                    PIC X(8)  VALUE 'INEXIT01'. 
    05  INSERTED-RECORD-INFO.                                   
        10 MAX-INSERTED-REC-LENGTH PIC S9(4) COMP SYNC VALUE +0.
        10 INSERTED-REC-LENGTH     PIC S9(4) COMP SYNC VALUE +0.


$$$$$$$$$$$$$AND$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

Code:


01  INEXIT01-IOAREA.                                           
    05  ACCEPT-CODE                PIC X     VALUE 'Y'.         
        88 RECORD-ACCEPTED                   VALUE 'Y'.         
        88 RECORD-DELETED                    VALUE 'N'.         
        88 RECORD-INSERTED                   VALUE 'I'.         
    05  EXIT-ID                    PIC X(8)  VALUE 'INEXIT01'. 
    05  INSERTED-RECORD-INFO.                                   
        10 MAX-INSERTED-REC-LENGTH PIC S9(4) COMP SYNC VALUE +0.
        10 INSERTED-REC-LENGTH     PIC S9(4) COMP SYNC VALUE +0.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Apr 02, 2007 8:50 pm    Post subject:
Reply with quote

Hello,

There is no reason to specify SYNC on an 01 level - it is automatically aligned by the compiler.
Back to top
View user's profile Send private message
priya

Moderator


Joined: 24 Jul 2003
Posts: 568
Location: Bangalore

PostPosted: Sat Feb 16, 2008 12:08 pm    Post subject: Reply to: Group level SYNC vs Elementary SYNC
Reply with quote

Quote:
There is no reason to specify SYNC on an 01 level - it is automatically aligned by the compiler.


Can you please clarify this?

I still hope, the compiler assumes SYNC only for 01 level elementary items, not for group items.

If you specfiy the SYNC clause for 01 level group item, its applied to all the elements of the group, except DISPLAY and COMP-3 items.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Sun Feb 17, 2008 12:08 am    Post subject: Group level SYNC vs Elementary SYNC
Reply with quote

As been said, SYNC at an "01" is unnecessary. However, if your group-level needs to match that of a Assembler DSECT, which contains fields defined using the "D", "F" and/or "H" aligned directives (Doubleword, Fullword, Halfword) or you need to match an existing COBOL layout which contains SYNC items, then you must define SYNC elementary items where needed.

Otherwise, SYNC can be more of a maintenance headache than anything and for the most part, is basically obsolete unless you need to use it based upon the above or similar criteria.

HTH....

Regards,

Bill
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Feb 17, 2008 6:57 am    Post subject:
Reply with quote

Hello,

Quote:
I still hope, the compiler assumes SYNC only for 01 level elementary items, not for group items.
ALL level 01 entries (group or elementary) are SYNCronized. And from Enterprise COBOL via the "Manuals" link above:
Quote:
In the working-storage section, the compiler aligns all level-01 entries on a doubleword boundary


Quote:
If you specfiy the SYNC clause for 01 level group item, its applied to all the elements of the group, except DISPLAY and COMP-3 items.
Unless i misunderstand, this is incorret. The 01 is automatically aligned by the compiler, but there is no aligment for elementary fields contained beneath the 01.

As Bill mentioned, there may be other code (typically assembler) that requires some particular boundary alignment (SYNC).
Back to top
View user's profile Send private message
priya

Moderator


Joined: 24 Jul 2003
Posts: 568
Location: Bangalore

PostPosted: Sun Feb 17, 2008 12:34 pm    Post subject:
Reply with quote

Quote:
ALL level 01 entries (group or elementary) are SYNCronized. And from Enterprise COBOL via the "Manuals" link above:


Yes, you are perfectly right. If its a group item, only the first elemantary item starts from a double word boundary.

Quote:
Unless i misunderstand, this is incorret. The 01 is automatically aligned by the compiler, but there is no aligment for elementary fields contained beneath the 01.


No I disagree. As per ANSI 2002 standard, all the elementary items of a group are SYNCed, if SYNC clause is specified for the group.

And the recent version of VS COBOL II manual also says:

Quote:
The SYNCHRONIZED clause be specified for level-01 group items, in which
case every elementary item within the level-01 group item is synchronized.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Feb 17, 2008 11:22 pm    Post subject:
Reply with quote

Hello,

Quote:
No I disagree. As per ANSI 2002 standard, all the elementary items of a group are SYNCed, if SYNC clause is specified for the group.

And the recent version of VS COBOL II manual also says:

Quote:

The SYNCHRONIZED clause be specified for level-01 group items, in which
case every elementary item within the level-01 group item is synchronized.
That "quote" does not look like it was taken directly from the IBM manual.

It is usually not a good idea to disagree with the manual published by the vendor icon_confused.gif

This code:
Code:
       01  WS-DDD SYNC.                           
           05 WS-DDDA PIC X(5).                   
           05 WS-DDDB PIC 9(5).                   
           05 WS-DDDC PIC 9(5) VALUE 10000.       

ONLY aligns WS-DDD (and thus WS-DDDA). The other 2 fields are NOT sync'ed (as per the quoted manual).
These are the corresponding displacements generated by the compiler:
Code:
 BLW=00000+0E0         0CL15   
 BLW=00000+0E0,0000000 5C     
 BLW=00000+0E5,0000005 5C     
 BLW=00000+0EA,000000A 5C     

Note the "B" and "C" fields are not re-aligned. They are contiguous.

If i've left anything unclear, please advise.
Back to top
View user's profile Send private message
priya

Moderator


Joined: 24 Jul 2003
Posts: 568
Location: Bangalore

PostPosted: Sun Feb 17, 2008 11:47 pm    Post subject: Reply to: Group level SYNC vs Elementary SYNC
Reply with quote

No, its a quote from the VS COBOL II Manual. Please check:

Code:
 x The SYNCHRONIZED clause be specified for level-01 group items, in which
 x case every elementary item within the level-01 group item is synchronized.


http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/IGYL1101/2.7.11?DT=19930312093006
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Feb 17, 2008 11:57 pm    Post subject: Reply to: Group level SYNC vs Elementary SYNC
Reply with quote

Interesting,

The IBM manuals typically use better grammar. . . .

But that quote not withstanding, this:
Quote:
This code:
Code:
       01  WS-DDD SYNC.                           
           05 WS-DDDA PIC X(5).                   
           05 WS-DDDB PIC 9(5).                   
           05 WS-DDDC PIC 9(5) VALUE 10000. 

ONLY aligns WS-DDD (and thus WS-DDDA). The other 2 fields are NOT sync'ed (as per the quoted manual).
These are the corresponding displacements generated by the compiler:
Code:
 BLW=00000+0E0         0CL15   
 BLW=00000+0E0,0000000 5C     
 BLW=00000+0E5,0000005 5C     
 BLW=00000+0EA,000000A 5C       


Note the "B" and "C" fields are not re-aligned. They are contiguous.

is what happens when an 01 group is specified with sync and the elemenatry fields are not re-aligned.
Back to top
View user's profile Send private message
priya

Moderator


Joined: 24 Jul 2003
Posts: 568
Location: Bangalore

PostPosted: Mon Feb 18, 2008 12:00 am    Post subject:
Reply with quote

Yes, its synchronized actually.

As you didnt specify any USAGE clause, the default is DISPLAY which has no effect on SYNC Clause.

Quote:
If you specfiy the SYNC clause for 01 level group item, its applied to all the elements of the group, except DISPLAY and COMP-3 items.


Try to declare as:

Code:
01  WS-DDD SYNC.                           
           05 WS-DDDA PIC X(5).                   
           05 WS-DDDB PIC 9(5) COMP.                   
           05 WS-DDDC PIC 9(5) VALUE 10000.


And you will get:

Code:
 BLW=00000+0E0         0CL15   
 BLW=00000+0E0,0000000 5C     
 BLW=00000+0E8,0000008 5C     
 BLW=00000+0EC,000000C 5C 
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 Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Sync sort - Transpose TS70363 SYNCSORT 5 Tue Jun 28, 2016 3:18 am
No new posts Select first 2 group data vice_versa DFSORT/ICETOOL 10 Mon Jun 13, 2016 2:21 pm


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