COMP-1 and COMP-2 in COBOL.

All sort of Mainframes Interview Questions.
Post Reply
bscott
New Member
Posts: 6
Joined: Mon Oct 20, 2014 2:47 pm

COMP-1 and COMP-2 in COBOL.

Post by bscott »

Hi,

I have been asked an interview question recently which goes like this:

What do you mean by COMP-1 and COMP-2 in COBOL?

I answered it like this :

COMP-1 refers to a short or single-precision floating-point format, and it occupies storage of 4 bytes. COMP-2 refers to Long or double-precision floating-point format, and it occupies storage of 2 bytes.

The next question from interviewer left me speechless, He said, this is bookish definition tell me some practical use of it. Which I could not tell, could someone please help me with this.
raghvan obrai
New Member
Posts: 3
Joined: Thu Oct 30, 2014 5:00 pm

Re: COMP-1 and COMP-2 in COBOL.

Post by raghvan obrai »

You have answered it so well. What else would someone look for an answer than this?

Even if you get selected don't work for them.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: COMP-1 and COMP-2 in COBOL.

Post by Robert Sample »

If you are dealing with scientific numbers which exceed the limit of exact decimals (18 digits normally, 31 digits if ARITH(EXTEND) is specified at compile time), then COMP-1 or COMP-2 would be required. Which to use would depend upon how many digits of precision were needed -- COMP-1 will not exceed 7 digits. It is rare to use either in COBOL but not unheard of.
bscott
New Member
Posts: 6
Joined: Mon Oct 20, 2014 2:47 pm

Re: COMP-1 and COMP-2 in COBOL.

Post by bscott »

That means for regular use of COBOL, where most of the applications are written for Banking we don't use COMP-1 and COMP2 that usually, right?
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”