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
What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?
Name the divisions, which are available in a cobol program?
How do define dynamic array in cobol. how do you define single dimensional array and multidimensional array in your cobol?
) How do u handle errors in BMS macro
How to remove 2 duplicate records and copy only one using job control language?
How arrays can be defined in COBOL?
What are various search techniques in cobol? Explain.
How do get the result of your program directly on your pc?
what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.
What are different data types in cobol?
What is the Purpose of POINTER Phrase in STRING command in COBOL?
What is comp-1 and comp-2?
HOw can I get the negative sign while deduct high value from low value
What is inspect in cobol ?
What is the difference between comp and comp-3 usage?