Quote:
|
Originally Posted by db2dcs
What is the compatible COBOL host variable structure to receive the result of a SELECT COUNT(*) ?
Is it integer type: PIC S9(9) USAGE COMP?
It seems that is the type favored by our compiler.
If so, what if the count reached 1 billion (1,000,000,000) ?
My result may one day exceed 999,999,999. If that is true, what host variable structure should I use?
thanks to anyone who can assist.
db2dcs
|
The assumption is that if you use SELECT COUNT(*) and the answer is greater than 2,147,483,648 (you were off by about 1 billion), then there would be some rather serious cobwebs on your skeleton as you sit at the computer waiting for the query to return with an answer.
If you want to know how many rows there are in the table, then execute runstats and look at the CARD column on SYSCAT.TABLES (which is a BIGINT and goes up to 9,223,372,036,854,775,807). I believe that on the mainframe DB2 it is called CARDF.