Answer Posted / rajini
The SYNCHRONIZED clause is sometimes used with USAGE IS
COMP or USAGE IS INDEX items. It is used to optimize speed
of processing but it does so at the expense of increased
storage requirements.
Many computer memories are organized in such a way that
there are natural addressing boundaries - such as word
boundaries. If no special action is taken some data items
in memory may straddle theses boundaries. This may cause a
processing overhead as the CPU may need two fetch cycles to
retrieve the data from memory.
The SYNCHRONIZED clause is used to explicitly align COMP
and INDEX items along their natural word boundaries.
Without the SYNCHRONIZED clause, data-items are aligned on
byte boundaries.
The word SYNC can be used instead of SYNCHRONIZED.
For the purpose of illustrating how the SYNCHRONIZED clause
works let us assume that a COBOL program is running on a
word-oriented computer where the CPU fetches data from
memory a word at a time.
01 three-byte pic x(3) value 'dog'.
01 two-byte pic s9(4) comp .
In this program we want to perform a calculation on the
number stored in the variable TwoBytes (as declared in the
diagram below). Because of the way the data items have been
declared, the number stored in TwoBytes straddles a word
boundary.
In order to use the number, the CPU has to execute two
fetch cycles - one to get the first part of the number in
Word2 and the second to get the second part of the number
in Word3. This double fetch slows down calculations.
01 three-byte pic x(3) value 'dog'.
01 two-byte pic s9(4) comp sync .
Now consider the impact of using the SYNCHRONIZED clause.
The number in TwoBytes is now aligned along the word
boundary, so the CPU only has to do one fetch cycle to
retrieve the number from memory. This speeds up processing
but at the expense of wasting some storage (the second byte
of Word2 is no longer used).
| Is This Answer Correct ? | 9 Yes | 1 No |
Post New Answer View All Answers
How to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that
Which Search verb is equivalent to PERFORM…VARYING?
what is the difference between COBOL2 AND COBOL390?
How did the release of cobol/370 version 1.3 improve the performance of release 1.1?
i need a small 3d program using inline and outline.
Why occurs cannot be used in 01 level in COBOL?
How to print 10 to 1 if the input have only 10 digit number?
State the various causes of s0c1, s0c5 and s0c7.
HOw can I get the negative sign while deduct high value from low value
How to know whether the module is dynamical or statistical?
Explain the configuration section of a cobol program with examples of syntax.
Differentiate between structured cobol programming and object-oriented cobol programming.
How many bytes S(8) comp field occupy and its maximum value?
When is inspect verb is used in cobol?
)If there are 10 steps in GDG, if I want to refer the step2 after step5 . what should I do?