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
which is Best IBM Mainframe Training and Placement Institute in Ameerpet Hyderabad
Which mode is used to operate the sequential file?
how can i see junk values in dclgen or in hostvariable of comp ?
What is the Purpose of Pointer in the string?
Have you used comp and comp-3 in your project? And how?
input 1 input2 ouput1 output2 output 3 1 re 300 1 re 200 1 re 300 3 rc 500 1 re 200 2 rr 400 1 re 300 2 rr 400 1 rc 400 3 rc 500 1 rc 400 2 rr 700 2 rr 700 5 tt 900 5 tt 900 2 inputs r in flat file and output 1 is matched records,ouptput2 is unmatched of input1,output3 is unmatched of input2! how vl u get the output files using sequential order and to check with each and every records! let me know the procedure division ?
In which area will you utilize 88 level items in cobol?
When is inspect verb is used in cobol?
i have 10 names in an array and my name is one of them also array is not in sorted order i need to display my name using index how will i do this
What is the local-storage section?
What are INPUT PROCEDURE and OUTPUT PROCEDURE?
Can we change the password using ALTER? anyone tried and changed?
How do get the result of your program directly on your pc?
How do you get the data to code the BMS macro?
What is an in line perform? When would you use it? Anything else you wish to say about it.