Since 7.3 TR7 and 7.4 TR1 is it now possible to get info of files in the IFS using SQL. This with the new IBM i Service IFS_OBJECT_STATISTICS table function.
With this is it possible from and RPG program using embedded SQL to get info of files in IFS based on needed selection criterias and apply logic to deal with them.
SQL Example
1 2 3 4 |
SELECT PATH_NAME,OBJECT_TYPE,CREATE_TIMESTAMP,LAST_USED_TIMESTAMP, DATA_CHANGE_TIMESTAMP, DATA_SIZE FROM TABLE(QSYS2.IFS_OBJECT_STATISTICS('/home/stud12','NO')) WHERE OBJECT_TYPE = '*STMF' AND PATH_NAME LIKE '/home/stud12/EDI%' AND PATH_NAME LIKE '%.txt' AND DATE(DATA_CHANGE_TIMESTAMP) < CURRENT_DATE - 12 MONTH; |
Detailed information of this IBM i Service can be found on IBMs site here