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
What are the rules of the move verb?
What is the difference between binary search and sequential search?
What is the difference between PIC 9.99 and 9v99 in COBOL?
What is a report item?
What are the cobol coding sheets?
how do you reference the ksds vsam file formats from cobol programs
What is a scope terminator give example?
1.Is it possible to move the data from 99.99 to 99v99? 2.What is the CICS-vsam Compilation process? 3.In My GDG 5 generation will be there GDG3 got an abend what will happen? 4.In my GDG first generation is +1 And I want to add the new generation what will happen previous generation? 5.How can you give the PIC clause below conditions A). s9 (reddy), B). s9 (5) occurs 5 times? 6.How override the proc from a particular step? and what is symbolic and override Procs?
How do you define a variable of comp-1 and comp-2?
Difference between cobol and cobol-ii?
Explain the configuration section of a cobol program with examples of syntax.
Name the sections present in data division.
how do you reference the fixed unblock file formats from cobol programs
What happens when we move a comp-3 field to an edited (say z (9). Zz-)?
Write a program to explain size error.