IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Comp interview questions


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Deepak1518780

New User


Joined: 14 Jun 2018
Posts: 2
Location: India

PostPosted: Sat Sep 22, 2018 7:26 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8578
Location: Dubuque, Iowa, USA

PostPosted: Sun Sep 23, 2018 3:02 am
Reply with quote

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
View user's profile Send private message
Deepak1518780

New User


Joined: 14 Jun 2018
Posts: 2
Location: India

PostPosted: Sun Sep 23, 2018 7:31 am
Reply with quote

Thanks for reply, I want t know where we need to define comp1 and comp2.

Thanks
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Sun Sep 23, 2018 3:32 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8578
Location: Dubuque, Iowa, USA

PostPosted: Sun Sep 23, 2018 6:12 pm
Reply with quote

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
View user's profile Send private message
sergeyken
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1146

PostPosted: Sun Sep 23, 2018 7:37 pm
Reply with quote

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... sterb050.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts How to add 2 digits to COMP-3 file? DFSORT/ICETOOL 11
No new posts Unable to display comp variable COBOL Programming 4
No new posts Write 9(07) comp-3 data into output file DFSORT/ICETOOL 4
No new posts S9(11)V9(02) to S9(9)V9(2) COMP-3 SYNCSORT 2
No new posts Replace comp-3 field value to comp-3 ... DFSORT/ICETOOL 5
Search our Forums:

Back to Top