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.
COMP-1 and COMP-2 in COBOL.
-
- New Member
- Posts: 3
- Joined: Thu Oct 30, 2014 5:00 pm
Re: COMP-1 and COMP-2 in COBOL.
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.
Even if you get selected don't work for them.
- Robert Sample
- Global Moderator
- Posts: 1903
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: COMP-1 and COMP-2 in COBOL.
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.
Re: COMP-1 and COMP-2 in COBOL.
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?
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