In DB2, after fetching rows from a table by using cursor, in result table you cannot see row numbers. If there is a requirement in your project you need to see row numbers in the result, then, the below Query is highly useful.
You can get row number by using below SQL query.
In Declare cursor, in SELECT statement give SQL query as follows:
Select row_number over(group by col_1, col_2, col_3)
from table SAMPLE;
In the result table row numbers appears.
In COBOL,DB2 program you cannot see row numbers. This is possible, if you give a query in SPUFI, and you will get row numbers for each row.