What is the difference between COMP & COMP-3 ?

Answers were Sorted based on User's Feedback



What is the difference between COMP & COMP-3 ?..

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

What is the difference between COMP & COMP-3 ?..

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

Post New Answer

More COBOL Interview Questions

example for sub strings ? and refernce modifications whit output pls

0 Answers   College School Exams Tests, IBM,


What is EIBCALEN? Why it is used?

9 Answers   ADP,


give the examples of strings in cobol

1 Answers   IBM,


i have mainprogram and subgram...if i compile mainprogram without stop run..what will u get in compilation time?

1 Answers   HCL,


how to convert vsam table into DB2 table?

1 Answers   IBM, Wipro,






How do we get current date from system with century in COBOL?

0 Answers   Winsol Solutions,


Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?

6 Answers   ABC, IBM, Mphasis, Wipro,


What is the difference between Structured COBOL Programming and Object Oriented COBOL ?

1 Answers  


i have a sequencial file contains multiple records, i want to extract one row which contains various fields like order number,date,warehouse,.ect.. in to the another file by accepting the order number from jcl. how can i do it. pls help me..

4 Answers   CGI,


How will you find the currepted records in a file

2 Answers  


what is sysncpoint?

1 Answers   IBM,


I have a occurs for 100 times but it has executed 101 time what could be the reason?

4 Answers  


Categories