I would like to write a utility which housekeeps stream files in the ifs based upon how many days ago the file was CREATED. Does any body know an API for this (an API which is easy enough to work with 'RPG' and/or 'CL' and NOT 'C') The DSPLNK CL command doesn't provide the creation date it would appear and the closest API I can find is QHFOPNDIR, which I have been told is for QDLS and not IFS?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Ron Turull did such a utility a while ago and the source can be found at

All the best


Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • MilesButler
    Use the UNIX shell within CLP to analise the IFS directory Command STRQSH This will allow you to use UNIX type commands "LS" list, "RM" remove etc (almost like "DOS" but annoyingly different). You can redirect the output from the "unix" commands back to a physical file within your CLP. Example: /* Redirect output from STRQSH session to IFS file */ ADDENVVAR ENVVAR(QIBM_QSH_CMD_OUTPUT) + VALUE('FILE=/IFSDirectory/LISTFILE.TXT') + REPLACE(*YES) MONMSG MSGID(CPFA980) /* Creates a Directory listing in LISTFILE.TXT in IFSDirectory */ CHGVAR VAR(&CMD) VALUE('LS /IFSDirectory/(files to list)) STRQSH CMD(&CMD) MONMSG MSGID(QSH0002) /* Copy Directory Listing from the previous step to iSeries PF QTEMP/CSPLSOUT CPYFRMSTMF FROMSTMF('/IFSDirectory/LISTFILE.TXT') + TOMBR('/QSYS.LIB/QTEMP.LIB/iSeriesFile.FILE/ iSeriesFile + .MBR') MBROPT(*REPLACE) MONMSG MSGID(CPFA0A9 CPFA095) Analise the data on the iSeries and then use the RM remove unix command. Other Unix commands may be mor apropriate. Miles
    0 pointsBadges:
  • MTharp
    You could also use C procedure Qp01GetAttr(). The return data structure includes a 10 digit integer variable listing the number of seconds from epoch (01/01/1970 00hh 00mm 00ss) allowing you to calculate the date/time the object was created. The procedure can be prototyped and invoked within an RPG program. Reference material on iSeries UNIX type IFS APIs can be found on the IBM InfoCenter Website.
    0 pointsBadges:
  • JPLamontre
    look at this RPG tool : it walks IFS, can show data inside file. In the code, there is 3 calls to the 'stat' api : rc = stat (pathdirs: myStat ); rc = stat64 (pathdirs: myStat64 ); rc = statvfs(pathdirs: myStatVFS ); here is one solution to your question.
    0 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: