View previous topic :: View next topic
|
Author |
Message |
Deepak1518780
New User
Joined: 14 Jun 2018 Posts: 2 Location: India
|
|
|
|
In an interview, I was asked what is use of comp,comp1,comp2
In real word.Where we need need to define variable using comp, comp1, comp2
Pls revert me.
Thanks |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
I think you might do better on Beginners and Students Forum as this forum is for experts, and your question is definitely a beginner's question.
COMP-1 and COMP-2 are short and long floating point respectively. You would use them when you need the larger values (but less precision) that floating point allows you.
COMP is integer binary. You would use COMP for counters, subscripts, and the like where you don't want to take the resources required to convert into and out of zoned decimal for arithmetic.
COMP-3, which you did not mention, is packed decimal and is often used for arithmetic variables as well since there is no need for conversion (which the compiler will do automatically) before the value can be used in a COMPUTE (or other arithmetic) statement. |
|
Back to top |
|
|
Deepak1518780
New User
Joined: 14 Jun 2018 Posts: 2 Location: India
|
|
|
|
Thanks for reply, I want t know where we need to define comp1 and comp2.
Thanks |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Quote: |
I want t know where we need to define comp1 and comp2 |
Please read and understand the answers given to you. Robert's reply gave you this information.
Please also refer to the COBOL Language Reference Manual - available via the links in the forum (very top line) or by googling.
Topic moved to the interview questions part of the forum. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
Thanks for reply, I want t know where we need to define comp1 and comp2. |
Where? You define them in a COBOL program, in the LINKAGE SECTION or FILE SECTION or WORKING-STORAGE SECTION.
And if you don't know what a floating point variable is, then you DEFINITELY do not belong in this forum but in the Beginners forum instead. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2131 Location: USA
|
|
|
|
Robert Sample wrote: |
I think you might do better on Beginners and Students Forum as this forum is for experts, and your question is definitely a beginner's question.
COMP-1 and COMP-2 are short and long floating point respectively. You would use them when you need the larger values (but less precision) that floating point allows you.
COMP is integer binary. You would use COMP for counters, subscripts, and the like where you don't want to take the resources required to convert into and out of zoned decimal for arithmetic.
COMP-3, which you did not mention, is packed decimal and is often used for arithmetic variables as well since there is no need for conversion (which the compiler will do automatically) before the value can be used in a COMPUTE (or other arithmetic) statement. |
I'm seriously in doubt if the TS has any idea of the following:
- floating point,
- larger values,
- less precision,
- integer binary,
- counters, subscripts,
- resouces required,
- convert into and out,
- zoned decimal,
- arithmetic,
- packed decimal,
- conversion,
- compiler,
- automatically,
- the value,
- compute,
- statement.
So, the explanation of three unclear words by using 33 more unclear words doesn't make any sense... |
|
Back to top |
|
|
|