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

Explain about different table spaces.

0 Answers  


What is the difference between subscript and index?

1 Answers  


What are differences between COBOL and java ? why we are giving more preference to COBOL ?

3 Answers   TCS,


how can we fetch 3 records in cobol pgm any coding pls ?

3 Answers   CGI,


1.Is it possible to move the data from 99.99 to 99v99? 2.What is the CICS-vsam Compilation process? 3.In My GDG 5 generation will be there GDG3 got an abend what will happen? 4.In my GDG first generation is +1 And I want to add the new generation what will happen previous generation? 5.How can you give the PIC clause below conditions A). s9 (reddy), B). s9 (5) occurs 5 times? 6.How override the proc from a particular step? and what is symbolic and override Procs?

0 Answers   IBM,






Hi pls anybody tell me about " ANALYSIS DOCUMENT PREPARATION AND ESTIMATION OF TASK " (in real time project)."I want to update a sequential file in my project" for that purpose i need both structures i mean analysis document and estimation of task.

0 Answers  


which of the following can be used as a check protection symbol a.Z b.S c.* d.+

2 Answers   TCS,


what are decleratives in cobol?

0 Answers   GGG, Satyam,


what are the working storage fields in BMS macro?

2 Answers   IBM,


Minimum how many Number of Paragraphs are there in ID- Divison?

7 Answers   IBM,


diffrence between z(2) and z9(2)

4 Answers   Cap Gemini,


Which of the following paragraphs is compulsory in every COBOL program? (a) SPECIAL-NAMES (b) PROGRAM-ID (c) FILE-CONTROL (d) OBJECT-COMPUTER

4 Answers  


Categories