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


Please Help Members By Posting Answers For Below Questions

How to print 10 to 1 if the input have only 10 digit number?

806


Name the divisions, which are available in a cobol program?

677


what is the use of outrecord?

1765


What is static and dynamic call in cobol?

590


What are the different rules for performing sort operation?

755






can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

1835


Can a Search can be done on a table with or without Index?

798


)If there are 10 steps in GDG, if I want to refer the step2 after step5 . what should I do?

1520


How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)

2718


If you are current on the owner of a set, what is the difference between an obtain next and obtain first? Actually in which topic will we use dis???Plz explain it clearly

2656


Define static linking and dynamic linking.

658


What is a report item?

736


What is the difference between PIC 9.99 and PIC9v99?

771


How do define dynamic array in cobol. how do you define single dimensional array and multidimensional array in your cobol?

700


Explain how to differentiate call by context by comparing it to other calls?

681