What is the difference between COMP & COMP-3 ?

Answer Posted / raghunandan modak

COMP is a binary storage format while COMP-3 is packed
decimal format.

For comp-3 you can refer following examples -

Packed Decimal fields: Sign is stored as a hex value in
the last nibble (4 bits ) of the storage.

The actual number of bytes occupied in the file is about
half that. To calculate the number of bytes from the PIC,
add 1 (for the sign) to the total number of digits, divide
by 2, and round up if necessary. For example:

PIC S9(7) COMP-3. Byte size = (7 + 1) / 2 = 4
PIC S9(5)V99 COMP-3. Byte size = (5 + 2 + 1) / 2 = 4
PIC S9(6) COMP-3. Byte size = (6 + 1) / 2 = 3.5,
rounded to 4
Comp-3 fields reserve a nibble for the sign, even
for "unsigned" values, so the following fields are still 4
bytes:
PIC 9(7) COMP-3. Byte size = (7 + 1) / 2 = 4
PIC 9(6) COMP-3. Byte size = (6 + 1) / 2 = 3.5,
rounded to 4.

Is This Answer Correct ?    47 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?

709


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

678


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

700


) How do u handle errors in BMS macro

1502


How to remove 2 duplicate records and copy only one using job control language?

734






How arrays can be defined in COBOL?

661


What are various search techniques in cobol? Explain.

641


How do get the result of your program directly on your pc?

1874


what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.

8152


What are different data types in cobol?

685


What is the Purpose of POINTER Phrase in STRING command in COBOL?

713


What is comp-1 and comp-2?

756


HOw can I get the negative sign while deduct high value from low value

1783


What is inspect in cobol ?

793


What is the difference between comp and comp-3 usage?

672