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

Advantage of defining counters as COMP-2


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sweta Saraogi

New User


Joined: 07 Feb 2007
Posts: 5
Location: India

PostPosted: Wed Mar 28, 2007 9:49 pm
Reply with quote

will it help the processing, if the counters in a cobol program are defined as comp-2. How?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Mar 28, 2007 10:00 pm
Reply with quote

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

New User


Joined: 07 Feb 2007
Posts: 5
Location: India

PostPosted: Wed Mar 28, 2007 10:09 pm
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Mar 28, 2007 10:28 pm
Reply with quote

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

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Mon Apr 02, 2007 1:40 pm
Reply with quote

Hi Dick,

Why and how Comp-3 is good choice for "counters" or "accumulators"??

Thanks
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Apr 02, 2007 7:33 pm
Reply with quote

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
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Defining a struct PL/I & Assembler 3
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
Search our Forums:

Back to Top