With the SQL OLAP RANK and DENSE_RANK functions being around for a while in SQL programming, it is quite easy to query for the TOP XX from data.
DB2 includes support for On-Line Analytical Processing (OLAP) built-in functions. The first three functions introduced may be used to rank and number rows in a result table. This article will explore these three functions which are available on both DB2 for z/OS and DB2 for LUW.
Here are some links from IDUG's big data primer article for quick reference