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

Group level SYNC vs Elementary SYNC


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Mon Apr 02, 2007 8:50 pm
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sun Feb 17, 2008 12:08 am
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

Moderator Emeritus


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

PostPosted: Sun Feb 17, 2008 6:57 am
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
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

Moderator Emeritus


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

PostPosted: Sun Feb 17, 2008 11:22 pm
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
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.


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

Moderator Emeritus


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

PostPosted: Sun Feb 17, 2008 11:57 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to load to DB2 with column level ... DB2 6
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Splitting group records based on deta... DFSORT/ICETOOL 8
Search our Forums:

Back to Top