When would you advise to use COMP and COMP-3 variables?

All sort of Mainframes Interview Questions.
Post Reply
Naveen Kumar
New Member
Posts: 2
Joined: Wed Oct 29, 2014 11:06 am

When would you advise to use COMP and COMP-3 variables?

Post by Naveen Kumar »

Hi ,

When would you advise to use COMP and COMP-3 variables? In today's world what are the advantage of these variables have over PIC X() Usage DISPLAY variables when memory is not a problem?

Interviewer has already mentioned about memory and that was the answer I wanted to say; now what can be the advanatage ?
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: When would you advise to use COMP and COMP-3 variables?

Post by William Collins »

Memory was never, or rarely, a problem which would lead to the use of binary or packed-decimals. Disk space more so, but not really.

The benefits of binary and packed-decimal were, and remain, performance. A USAGE DISPLAY (the default if no usage specified) field has to be converted if arithmetic is carried out with it, then converted back if a result is to be stored there.

Also, when using a field for subscripting, USAGE DISPLAY will be converted to binary.

So, to avoid the conversions, you define the field as how it will be used.
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.”