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
 

 

SYNC variables value same as group?

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

New User


Joined: 18 Jul 2008
Posts: 59
Location: Bangalore

PostPosted: Tue Feb 14, 2012 5:36 pm    Post subject: SYNC variables value same as group?
Reply with quote

Will the length of 01 level group variable having SYNC variables be same as that of a group without SYNC definition. Below scenario will be helpful.

01 WS-SYNC-GROUP.
05 WS-NUM-DATA PIC S9(9) COMP-5 SYNC.
05 WS-TEXT PIC X(16).

01 WS-NON-SYNC-GROUP.
05 WNS-NUM-DATA PIC S9(9) COMP-5.
05 WNS-TEXT PIC X(16).

Is LENGTH OF WS-SYNC-GROUP = LENGTH OF WS-NON-SYNC-GROUP ?
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Tue Feb 14, 2012 5:47 pm    Post subject:
Reply with quote

Don't post your question at the end of a thread inactive for almost 4 years. I've split it into a new topic.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Tue Feb 14, 2012 5:50 pm    Post subject:
Reply with quote

The answer to your question is that it depends upon the data. Data definitions:
Code:
      WORKING-STORAGE SECTION.
      01  WS-SYNC-GROUP.
          05  WS-X                    PIC X(01).
          05  WS-NUM-DATA             PIC S9(9) COMP-5 SYNC.
          05  WS-TEXT                 PIC X(16).

      01  WS-SYNC-GROUP-2             SYNC.
          05  WS-X                    PIC X(01).
          05  WS-NUM-DATA             PIC S9(9) COMP-5 SYNC.
          05  WS-TEXT                 PIC X(16).

      01  WS-NON-SYNC-GROUP.
          05  WS-X                    PIC X(01).
          05  WNS-NUM-DATA            PIC S9(9) COMP-5.
          05  WNS-TEXT                PIC X(16).

      01  WS-SYNC-GROUP-3.
          05  WS-X                    PIC X(01).
          05  WS-NUM-DATA             PIC S9(9) COMP-5 SYNC.
          05  WS-TEXT                 PIC X(16).

      01  WS-SYNC-GROUP-4             SYNC.
          05  WS-X                    PIC X(01).
          05  WS-NUM-DATA             PIC S9(9) COMP-5 SYNC.
          05  WS-TEXT                 PIC X(16).

      01  WS-NON-SYNC-GROUP-2.
          05  WNS-X                   PIC X(01).
          05  WNS-NUM-DATA            PIC S9(9) COMP-5.
          05  WNS-TEXT                PIC X(16).
generates compiler output of
Code:
SYNC-GROUP . . . . . . . . . . . . . . . . BLW=00000  000               DS 0CL24
S-X. . . . . . . . . . . . . . . . . . . . BLW=00000  000   0 000 000   DS 1C
S-NUM-DATA . . . . . . . . . . . . . . . . BLW=00000  004   0 000 004   DS 1F
S-TEXT . . . . . . . . . . . . . . . . . . BLW=00000  008   0 000 008   DS 16C
SYNC-GROUP-2 . . . . . . . . . . . . . . . BLW=00000  018               DS 0CL24
S-X. . . . . . . . . . . . . . . . . . . . BLW=00000  018   0 000 000   DS 1C
S-NUM-DATA . . . . . . . . . . . . . . . . BLW=00000  01C   0 000 004   DS 1F
S-TEXT . . . . . . . . . . . . . . . . . . BLW=00000  020   0 000 008   DS 16C
NON-SYNC-GROUP . . . . . . . . . . . . . . BLW=00000  030               DS 0CL21
S-X. . . . . . . . . . . . . . . . . . . . BLW=00000  030   0 000 000   DS 1C
NS-NUM-DATA. . . . . . . . . . . . . . . . BLW=00000  031   0 000 001   DS 4C
NS-TEXT. . . . . . . . . . . . . . . . . . BLW=00000  035   0 000 005   DS 16C
SYNC-GROUP-3 . . . . . . . . . . . . . . . BLW=00000  048               DS 0CL24
S-X. . . . . . . . . . . . . . . . . . . . BLW=00000  048   0 000 000   DS 1C
S-NUM-DATA . . . . . . . . . . . . . . . . BLW=00000  04C   0 000 004   DS 1F
S-TEXT . . . . . . . . . . . . . . . . . . BLW=00000  050   0 000 008   DS 16C
SYNC-GROUP-4 . . . . . . . . . . . . . . . BLW=00000  060               DS 0CL24
S-X. . . . . . . . . . . . . . . . . . . . BLW=00000  060   0 000 000   DS 1C
S-NUM-DATA . . . . . . . . . . . . . . . . BLW=00000  064   0 000 004   DS 1F
S-TEXT . . . . . . . . . . . . . . . . . . BLW=00000  068   0 000 008   DS 16C
NON-SYNC-GROUP-2 . . . . . . . . . . . . . BLW=00000  078               DS 0CL21
NS-X . . . . . . . . . . . . . . . . . . . BLW=00000  078   0 000 000   DS 1C
NS-NUM-DATA. . . . . . . . . . . . . . . . BLW=00000  079   0 000 001   DS 4C
NS-TEXT. . . . . . . . . . . . . . . . . . BLW=00000  07D   0 000 005   DS 16C
Note that some of the groups have length 24 and some have length 21. If you don't understand why, click on the Manuals link at the top of the page and read the COBOL Language Reference manual on what SYNC does.
Back to top
View user's profile Send private message
mushreyas

New User


Joined: 18 Jul 2008
Posts: 59
Location: Bangalore

PostPosted: Tue Feb 14, 2012 8:04 pm    Post subject: Reply to: SYNC question
Reply with quote

Thanks Bob for the quick and detailed response. I thought the slack bytes will be allocated internally and doesn't actually alter the length visible to user.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Feb 14, 2012 8:08 pm    Post subject: Reply to: SYNC question
Reply with quote

Can affect not only the length of a group item, including the 01, but, obviously, the location of fields following the "synchronisation".
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Tue Feb 14, 2012 8:18 pm    Post subject:
Reply with quote

Slack bytes are allocated internally -- but they count as part of the group data and hence must be considered by the programmer. This will be be especially critical if you're putting slack bytes in an FD 01, where they will actually increase the LRECL of the file.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Feb 16, 2012 5:44 am    Post subject: Reply to: SYNC question
Reply with quote

mushreyas,

To answer your original ques: yes

If your proposed 01 group is already at a doubleword boundary, no slack bytes are added by the compiler and SYNC does nothing; if it is not positioned at the dw boundary the compiler adds the slack bytes before the 01 and again SYNC does nothing.

So the real issue here is that the compiler aligns 01 levels on a doubleword boundary, therefor the SYNC clause is unnecessary in your example.
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: Thu Feb 16, 2012 6:45 am    Post subject: Reply to: SYNC question
Reply with quote

I've found that defining elementary binary-fields with SYNC is to ensure proper mapping/alignment in a parmlist targeted for Assembler sub-programs, who have H, F and D aligned definitions in a DSECT.

Otherwise, I generally don't use them because they're more of a nuisance, especially for newbies during maintenance.

Years ago, using OS/VS COBOL, they were used as optimized subscripts, but because of builtin compiler optimization nowadays, they've fallen out of favor.

Just my two cents.... icon_wink.gif

Mr. Bill
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 find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts Need Help with : IFTHEN(WHEN=GROUP) Sumanta_89 DFSORT/ICETOOL 1 Wed Apr 19, 2017 5:23 pm
No new posts Group elements using ICETOOL Learncoholic DFSORT/ICETOOL 2 Fri Apr 14, 2017 11:01 am
No new posts Why TS/OP would Not contact site supp... RahulG31 All Other Mainframe Topics 4 Wed Mar 22, 2017 7:46 am


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