Reporting with large number of records could be cumbersome if you view it on web page and download the data to CSV or Excel format.
Especially if you are dealing with hundred thousand or millions records.
DB2 has feature for export data or download records directly to external storage i.e your local hard disk.
The way is to specify the data to be exported by supplying an SQL SELECT statement and then use db2 export to download directly to CSV format.
The DB2 syntaxt for this download is
db2 export to <filepath/filename> of del <SQL Select statement>.
More complete explanation please go to IBM url https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0008303.html
This blog post will explain how to use DB2 export with PHP.
The PHP page calls DB2 export which transfer records to CSV format and after file created and finish transfering then the CSV is zipped.