Hi All,
how is sign is stored in S9(17) comp-3 variable.
Answer with an Example will be of great help.

Answers were Sorted based on User's Feedback



Hi All, how is sign is stored in S9(17) comp-3 variable. Answer with an Example will be of great h..

Answer / sudhakar

In comp-3 format sign is stoted in the last nibble along
with data for e.g +1234 last digit is +4 it comes as D

Is This Answer Correct ?    12 Yes 4 No

Hi All, how is sign is stored in S9(17) comp-3 variable. Answer with an Example will be of great h..

Answer / blessy

it is stored as hex value in the last nibble(4 bits) of the
storage. for eg: if the number is +100, it stores hex 0C in
the last byte. as 2D if the number is -102 .

Is This Answer Correct ?    8 Yes 0 No

Hi All, how is sign is stored in S9(17) comp-3 variable. Answer with an Example will be of great h..

Answer / rtrt

9

Is This Answer Correct ?    12 Yes 5 No

Hi All, how is sign is stored in S9(17) comp-3 variable. Answer with an Example will be of great h..

Answer / srinivas adilapuram

The sign is stored seperately as rightmost half-a-byte
regardless of whether 'S' is specified in the PIC clause or not.

Thanks
Srinivas

Is This Answer Correct ?    6 Yes 0 No

Hi All, how is sign is stored in S9(17) comp-3 variable. Answer with an Example will be of great h..

Answer / 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

More COBOL Interview Questions

How can I find the maximum value of a field in a file while reading the file dynamically? without using sort function. Suppose i have a file with fields Timestamp, description, teamname, teamnumber.. i have read the file till end and find the maximun value of timestamp which is not in sorted order.. can we use function max(timestamp)?

1 Answers   CGI,


Determine the total no of bytes in the following. 01 rec1. 02 a pic x(6) 02 b redefines a. 03 c occus 6 times pic 9. 02 d occurs 6 times pic 9. 03 e pic x(5) 03 f pic 999.

12 Answers  


What will happen if we move SPACES to numeric field and ZEROES to alphabetic field?

7 Answers   T systems,


What is Redefines clause?

8 Answers  


What is the difference between goback, stop run and exit program in cobol?

0 Answers  






HI THIS IS ANIL. HOW TO PASS A RECORDS OF A FILE(PS OR PDS) TO AN ARRAY?

2 Answers  


how to display date in reverse order if the pic clause of the is numeric suppose date is 09032010 ==> need to print in 20100309 (pic clause is numeric)

6 Answers  


Can the OCCURS clause be at the 01 level?

8 Answers   Oracle,


Difference between next and continue clause

4 Answers   Kanbay,


is it mandatory to give data division before procedure division ? wht happens if i give procedure division first thn data division ? reply soon

2 Answers   Patni,


1)what is use of linkage section? 2)what is difference between comp and comp-3

1 Answers   Cap Gemini,


What do you do to resolve SOC-7 error?

2 Answers   Sun Life, Wipro,


Categories