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

Regarding SYNC clause


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
daves

New User


Joined: 30 Mar 2007
Posts: 7
Location: Bangalore

PostPosted: Thu Apr 12, 2007 10:47 pm
Reply with quote

For example:-
01 ws-test.
02 ws-var1 pic x(02)
02 ws-var2 pic s9(06)comp sync.

so if i am storing 10 in ws-var1, in 0th place 1 is stored and 1st place 0 is stored.
and ws-var2 as 4bytes...in book it is give that it starts from 4th position.....2,3 are slack bytes...
[b]my doubts.
1)what is the total size in this case,is it 2(ws-var1)+4(ws-var2)=6.If 6 is the size then 0,1 is used for storing 10, 2,3 slack bytes...it has only 2bytes left........then how can it store?
**2)if s9(10)comp sync then range is 8byte so do it start from 8th position...make 2 to 7 places as slack bytes?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Apr 12, 2007 11:23 pm
Reply with quote

daves wrote:
For example:-
01 ws-test.
02 ws-var1 pic x(02)
02 ws-var2 pic s9(06)comp sync.

so if i am storing 10 in ws-var1, in 0th place 1 is stored and 1st place 0 is stored.
and ws-var2 as 4bytes...in book it is give that it starts from 4th position.....2,3 are slack bytes...
[b]my doubts.
1)what is the total size in this case,is it 2(ws-var1)+4(ws-var2)=6.If 6 is the size then 0,1 is used for storing 10, 2,3 slack bytes...it has only 2bytes left........then how can it store?
**2)if s9(10)comp sync then range is 8byte so do it start from 8th position...make 2 to 7 places as slack bytes?
Actually ws-var2 is 8 bytes, comp items are half or full words and 9(6) is too big for a half word.

So let's try ws-var1 = x(2) and ws-var2 = s9(6) comp sync:
The 01 lines up on a double word,
var1 occupies the first two bytes,
var2 needs to be full word aligned so there are 2 slack bytes,
var2 occupies the next 4 bytes
ws-test has a length of 8 with the sync and 5 without the sync.

Did this answer your question?
There is a good example and explanation in the section on Slack bytes within records
Back to top
View user's profile Send private message
daves

New User


Joined: 30 Mar 2007
Posts: 7
Location: Bangalore

PostPosted: Thu Apr 12, 2007 11:40 pm
Reply with quote

Hi William,

I got my answer n the explaination i needed from the link u provided.

Thnx 4 helping me out
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 To search DB2 table based on Conditio... DB2 1
No new posts Sync logic between VSAM files and DB2... COBOL Programming 9
No new posts NOT IN clause in COBOL pgm COBOL Programming 8
No new posts SUSBSCRIPT WITH SIGN IN PIC CLAUSE COBOL Programming 3
No new posts usage of CASE in WHERE clause DB2 10
Search our Forums:

Back to Top