What is the difference between COMP & COMP-3 ?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / vampire
comp has boundaries
01-04 halfword
05-09 fullword
10-18 doubleword
comp is always fast compare to comp3
comp storage is only binary
only using for small data
comp-3 is takes like this
(n+1)/2
it is much powerful than comp when handling huge data
storage is binary and packed decimal
| Is This Answer Correct ? | 10 Yes | 0 No |
Write a cobol program making use of the redefine clause.
In a file if a column account number conatain value 0001234.. how can we move the value to another variable without zero. value may contain any type such as 00123405. we need the value 1234 or 12305. how can we do that in cobol. Please help.
What is the figurative constant in cobol?
I have two questions here. 1. How to read a flat file in reverse order? 2. How to read a VSAM KSDS file in reverse order? In both the cases we donot know the total number of records.
What are the different rules for performing sort operation?
level number 77 is used to define a)group data b)elementary data c)redefine d)none
How to use the same COBOL program in Batch and CICS on lines? explain with an example
How to read a 100 record from a file through cobol?
whn do i get soc7 abend while moving alphanumeric to numeric or while moving numeric to aplhanumeric please reply ASAP?
How many types of sorts are there in cobol?
What is XDC ?
How do you differentiate between cobol and cobol-ii?