View previous topic :: View next topic
|
Author |
Message |
Sweta Saraogi
New User
Joined: 07 Feb 2007 Posts: 5 Location: India
|
|
|
|
will it help the processing, if the counters in a cobol program are defined as comp-2. How? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Probably not.
What kind of counters are these - amounts, quantities, record counts?
What will happen with the counters? Will they be printed or kept in some record(s) for further arithmetic?
For the most part, comp-3 is a good chioce for "counters" or "accumulators". |
|
Back to top |
|
|
Sweta Saraogi
New User
Joined: 07 Feb 2007 Posts: 5 Location: India
|
|
|
|
These are record counters not to be displayed or printed anywhere. Just some logic in the program based on this counter like termination of loop etc. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You do not need floating-point fields for simple accumulators. Actually, comp-2 is very rarely used in business applications. Most business functions do not require floating point arithmetic. |
|
Back to top |
|
|
Shobana Bhaskar
New User
Joined: 02 Mar 2007 Posts: 35 Location: Pennsylvania, US
|
|
|
|
Hi Dick,
Why and how Comp-3 is good choice for "counters" or "accumulators"??
Thanks |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
COMP-3 is a good choice because they are easy to use for both calculation and presentation. There are underlying packed-decimal assembler instructions for arithmetic and in order to "edit" output for reporting or on a screen, the "sending" field must be packed-decimal. If the variable definition is not packed-decimal, it must be converted internally to packed-decimal for use anyway. |
|
Back to top |
|
|
|