Housekeeping Stream Files

520 pts.
IBM iSeries
I am working on a utility program to housekeep stream files based upon how many days ago the file was created. I checked the DSPLNK command, but, this command does not provide the creation date. Does anyone happen to know if there is such a command that would provide this information, and furthermore, if there is an example of a CLLE program that already does this? Please advise -Nick

Answer Wiki

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

The Get Attributes API Qp0lGetAttr provides the creation information (along with a whole lot more) of an Integrated File System file. And as you are writing a utility program, you may also be interested in the Read Directory Entry API readdir which allows you to sequentially read the files found in a directory and/or the Process a Path Name API Qp0lProcessSubtree which allows an exit program of yours to be called when certain file types are found in a directory.

At my web site, you can find the first two of four articles related to processing stream files from an ILE CL program. The other two articles however will not be available at my web site until they are published by System i News. The articles can be found under the heading ‘Industry Standard API Basics for the CL Programmer’.

One item to watch out for — the IFS APIs return creation date in what is known as the C epoch. This basically means what you get back is an integer value representing the number of seconds since Jan 1 1970 that equate to when the file was created. In the C/C++ Run-Time Library Functions Manual you will find many APIs that work with time values based on the C epoch. This epoch consideration is one that is covered in the third article of my series — though in the article I simply show how to convert the epoch to a meaningful character string, not how to use it as an aging argument.

For your utility program you will NOT want to use commands such as DSPLNK as DSPLNK only provides output to either display or print. While a program can process printed output, this is NOT considered a formal programming interface. Not being a formal programming interface means IBM does not worry about compatibility issues such as changing the report layout. Also report layouts can change significantly when i5/OS is installed with various languages — English, German, Russian, Arabic, Chinese, etc. Processing a report as input to a utility program can mean a different version of the program per National Language Version. Using APIs, such as those referenced above, provides your utility program a level of stability that DSP command interfaces (in general) do not.

Probably more information than you really wanted…

Bruce Vining

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.
  • Zenmaster2
    I did not get your answer. Just a blank text editor box. Could you resubmit it to me Thank you Nick
    35 pointsBadges:
  • Zenmaster2
    Hi Bruce Finally getting back to this problem. I could not find the C/L program that you were referring to that would give me an idea as to how I want to go about saving off the spool files to database files, and then saving to tape. Once saved, I need to load tape into a new AS400, restore the database files, and then recreate the spool files. Do you have any C/L programs that I could review. My email is Thanks for your assistance Nick
    35 pointsBadges:
  • bvining
    I'm a bit confused. Your first question was related to stream files, but your append is asking about spool files and saving them off while refering to an earlier discussion that I don't recall off hand. Is this really a new question? Note that I'm off to Nashville and COMMON starting today. So while I will be checking here periodically, it certainly won't be on a regular basis.
    7,070 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: