Page 1 of 1

Cobol program to get data from Large table

Posted: Wed Sep 21, 2016 5:54 pm
by sivasaras
I have a table having 7 million records but I want to get only the 2016 data for the employees having the grade from 1 TO 100 .
Is that possible to get total count of each grade through a DB2 query.

I have a program which I have to run 100 times to get the total count for a grade.

Is there any simple way to extract from table.

Please suggest your thoughts.

Posted: Sat Sep 24, 2016 11:44 am
by chaat
declare grade_count cursor for
select grade, count(*)
from db2.table
where grade between 1 and 100
group by grade


this cursor will return 100 rows with the grade and the count for that grade.

Posted: Thu Mar 15, 2018 12:43 pm
by Genforst
Your comments make me even more experienced and talk to my friends.