Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Advantage of defining counters as COMP-2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Advantage of defining counters as COMP-2
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

Site Director


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

PostPosted: Wed Mar 28, 2007 10:00 pm    Post subject:
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    Post subject: Re: comp-2 definition
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

Site Director


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

PostPosted: Wed Mar 28, 2007 10:28 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon Apr 02, 2007 7:33 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Need help to populate date in COMP-3 ... chetanambi DFSORT/ICETOOL 3 Tue Jun 21, 2016 12:25 pm
No new posts comparing comp-3 and unpacked numbers juares castro COBOL Programming 3 Mon May 30, 2016 6:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us