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

bytes taken for comp sync


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

New User


Joined: 10 Jan 2008
Posts: 4
Location: Chennai

PostPosted: Thu Jan 10, 2008 9:35 am
Reply with quote

how many bytes will be taken to store a variable declared as COMP SYNC ?
normally a varible declared as COMP will take 2 bytes if it is 9(1) to 9(4).
4 bytes if it is 9(5) to 9(9).
8 bytes if it is 9(10) to 9(18).
what chane will come in this when we include sync with that?
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Thu Jan 10, 2008 11:40 am
Reply with quote

Hi,

Folowing information might be useful.

Quote:

COMP binary number
S9 to S9(4) - stored as 2 bytes
S9(5) to S9(9) - stored as 4 bytes
S9(10) to S9(18) - stored as 8 bytes
NOT aligned on a specific boundary
also known as COMP-4

COMP SYNC binary number on a specific boundary
S9 to S9(4) - stored as 2 bytes on halfword
S9(5) to S9(9) - stored as 4 bytes on fullword
S9(10) to S9(18) - stored as 8 bytes on fullword

Using COMP SYNC can cause "slack bytes" to be embedded within the WORKING STORAGE because of the forced alignment. This can affect questions as to the size of table entry, or computing the size of a record.

Anything on an 01 level is automatically on a doubleword boundary.



KSK
Back to top
View user's profile Send private message
ahalyah

New User


Joined: 13 Dec 2007
Posts: 25
Location: india

PostPosted: Thu Jan 10, 2008 11:54 am
Reply with quote

Hi,
COMP SYNC is used for faster address resolution.
For ex.
01 ws-rec.
05 ws-var1 pic x(2).
05 ws-var2 pic X(3) comp sync.

then it will store ws-var2 not immedietly after 2 bytes. It will store in 5 th byte. So introduces slack bytes b/n them. But address resolution is faster. Means it will fetch the data from half word or full word boundaries.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Jan 10, 2008 6:56 pm
Reply with quote

Is this extra documentation/maintenance complexity really gaining you enough CPU nanoseconds to justify it?
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Jan 11, 2008 1:03 am
Reply with quote

Hi Varun...

Do you have a specific problem involving SYNC or is this a ques that you were wondering about in general?
Back to top
View user's profile Send private message
varunvasudevan

New User


Joined: 10 Jan 2008
Posts: 4
Location: Chennai

PostPosted: Fri Jan 11, 2008 9:38 am
Reply with quote

Actully my doubt is , on what basis the word boundary will be decided.?
is it always 4 bytes or will it be the size of particular element in a group with wich we mention SYNC clause?

for ex:
01 group.
05 ele1 pic x(10).
05 ele2 pic 9(6) comp SYNC.
05 ele3 pic s9(4)v99 comp3.

in the above example SYNC declared with 'ele2 pic 9(6) comp' . normally it will take 4 bytes in memory.So for this group 4 bytes wll be word boundy.
so my quest is, insted of 'ele2 pic 9(6) comp' , if it was 'ele2 pic 9(14) comp sync' what would be the size of word boundary? 9(14) comp will take 8 bytes. so will it be 8 bytes?
Back to top
View user's profile Send private message
khyati kumar

New User


Joined: 04 Jan 2008
Posts: 15
Location: Pune

PostPosted: Fri Jan 11, 2008 3:51 pm
Reply with quote

How to redefine comp-3 variable?

Suppose I have comp-3 valiable S9(11)V99 comp-3 and I have to move this value to ZZZ,ZZZ,ZZZ,ZZ9.99.So please let me know any suggestion what to do because while moving this variable i am getting S0c7 so i want to redefine ?
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 COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
Search our Forums:

Back to Top