There is aggregate functionality in the JDEBASE APIs, unfortunately it doesn't work on date types (JDEDATE) - at least not in my TR. It only works with MATH_NUMERIC data types. However, since JDEDATEs are stored in the database as numeric data types, you could create v-table/faux jde table (whatever everyone calls it... a JDE table backed by a SQL view). The SQL view can alias TRDJ as a MATH_NUMERIC data type, something like GNUM0. Then you can use JDEBASE aggregate functionality to get the max value. It will be returned as a number so you will then have to convert the MATH_NUMERIC return value to a JDEDATE but at least you can effectively do "select max(trdj) where dcto = 'XX'..." in JDE and make the DB do all the work instead of JDE iterating over a billion records or doing something like create a select statement that returns a billion records in descending order by date just so you can read the first record.
Edit 1:
Reading over this, it occurred to me that if your WHERE requirements are as simple as doc type your virtual table/v-table/faux table/sql view could be as simple as
select XXDCTO, max(XXTRDJ) as XXTRDJ
from F59xxxxx
group by XXDCTO
Then you can do simple table I/O in JDE to read the record for a given doc type.