Hi All,
how is sign is stored in S9(17) comp-3 variable.
Answer with an Example will be of great help.
Answer Posted / viswanathan
Hi,
suppose s9(3)v9(4) comp 3 is the data type then
3+4 = 7 half bytes will be used for data.
the last half byte will be used for sign
in this example number of digits is odd(7).
so total size occupied will be 7/2 + 1/2 =4 bytes
first seven half bytes from left will have data part. so the
right most half byte will have sign value.
if this right most half byte value is D (1101) then it is -ve
if it is C (1100) or F (1111) then it is considered as +ve.
example 2
S9(4)v(2) comp 3
here number of digits is even (4+2=6),so number of bytes
used will be 6/2 +1 =4 bytes.
in this example first half byte will be having 0000 value
this will be ignored while reading from data. the next six
half bytes will be having the six digits of data. and then
the last half byte will be having the sign value as said in
the example 1.
example 3
s9(4) comp3
4-even
first half byte no data(0000). next 4 half bytes data. the
last half byte will have sign value
Thanks
Viswanathan
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
Explain sorting techniques in cobol program? Provide the sort file definition, the sort statement, its syntax and meaning
Can a Search can be done on a table with or without Index?
2 input fles: 2 flat files, with different number of records. both are having unique key for each record and already sorted in ascending order . match these files using unique key and in output only matching key value has to be written. please procide cobol logic
i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?
How to find out the closest prime number of an input number? I believe it has something to do with SEARCH and COBOL Linear Array.
What is rmode(any) ?
What is the difference between perform … with test after and perform … with test before?
What is the default value(s) for an initialize? What keyword will allow for an override of the default?
what are decleratives in cobol?
write a cobol logic. i have file that has 10 records .1 record go to first output file and second record goes to 2 output and etc
Define static linking and dynamic linking.
What happens when we move a comp-3 field to an edited (say z (9). Zz-)?
Write a cobol program making use of the redefine clause.
Can you please let me know the centre name of INS certification in Kolkata.
What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?