This is how I'd do it within DB2 SQL, I believe the RRN (relative record number) is stored within the table by the O/S;
SELECT * FROM ( SELECT RRN(FOO) AS RRN, FOO.* FROM FOO ORDER BY RRN(FOO)) BAR WHERE BAR.RRN = recordnumber