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

What is the difference between NEXT SENTENCE and CONTINUE?

2 Answers   Mphasis,


What is the difference between SEARCH and SEARCH ALL?

6 Answers   Cognizant,


given the following piece of code: CALL SUB-PGM USING A, B, C. CALL SUB-PGM USING A, C, C. (a) Both CALL statements will always produce same result. (d) Both CALL statements may produce different result. (c) Compile-time error because SUB-PGM is a dataname. (d) Compile-time error because A, B, C are used twice.

2 Answers   TCS,


I have to write to a outfile where the number of records in that file should be the header of that file using IMS.. can anyone help me in this issue

0 Answers   IBM,


What is diff betn PS and ESDS file? What is the diffrent compiler options in cobol and there discription? What is retrive nth maximum salary from salary DB2 table. Can we redefine COM-3 variable with varchar variable?

4 Answers  






When would you use in-line perform?

2 Answers  


what is the difference between implicit and explicit scope terminator with example? 

1 Answers  


Read a flat file and write last but one (I have n records in a file I have to write n-1th) record in another flat file. Could you please provide me the code in COBOL?

1 Answers  


I have File 1 occurs 5 times with Employee-ID,Employee-Name,Employee-Dept (EEE and MECH). I have File 2 occurs 10 times with Employee-ID,Employee-Name,Employee-Dept (EEE,CIVIL,CHEMICAL and MECH). In FIle 1 and FIle 2 , for matching Employee-DEPT (Only MECH) , we need to move entire records from file1 to file 2. We should not use 2D array. Your help is needed here.

0 Answers   Steria,


what are the steps to sort in a cobol program?

2 Answers   Patni,


I have a files containing both duplicate and non-duplicate records.The file is already sorted by a key.I want to determine those records that are duplicate and records that are non-duplicate.If duplicate the record is move to a duplicate file and if non-duplicate that will be move to valid file.thank you

1 Answers  


which one is the best of com and com-3.using of real time ?

7 Answers   Cap Gemini,


Categories