Einfacher ist folgendes:

D opendir PR * EXTPROC('opendir')
D dirname 512 CONST options(*string)

eval dir = opendir(pathtolist+%trim(P_PFADNAME))