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 can we find that module can be called – whether DYNAMICALLY or STATICALLY?
What is the use of intialize verb?
1.give the details about WHEN OTHER. 2. how many form are available in evaluate.
How do you reference the fixed block file formats from cobol programs
what is difference between cobol and cobol/400
Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.
Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?
What are the different types of condition in cobol and write their forms.
How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?
Can a Search can be done on a table with or without Index?
What is the difference between comp and comp-3?
How to remove the spaces at the end of each record in the output file of variable length, via cobol program?
How to know whether the module is dynamical or statistical?
What is an in line perform? When would you use it? Anything else you wish to say about it.
What is difference between static and dynamic call in cobol?