× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thank you....  I'll go with change time....

Tim

> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx [SMTP:rpg400-l-bounces@xxxxxxxxxxxx]
> On Behalf Of Scott Klement
> Sent: Wednesday, January 12, 2005 11:55 AM
> To:   RPG programming on the AS400 / iSeries
> Subject:      Re: readdir ifs command
> 
> > However, I now need to process each file in its arrival sequence, 
> > I was wondering, if anybody knows the precedence in which the readdir 
> > command process each file...
> 
> I don't think there is any guaranteed order. It's whatever order the 
> directory entries happen to be in the directory object... I'm not sure 
> that the order is completely predictable.
> 
> > If not, I will need to read the directory once, to grab the filenames, 
> > and the timestamp... and then re-read the files using that order...
> 
> I'd load the filenames & timestamps into an array, sort by the timestamp, 
> then use that array to determine which filenames you process. That seems 
> like it would be pretty safe.
> 
> 
> > But then the question comes, what variable holds the best timestamp 
> > value...for a stream file...
> 
> Depends on your requirements.  Personally, I'd go with the "change time" 
> (the date/time the file was last changed) as my indication of whether the 
> file needs to be processed.  But, I don't know if that fits in with your 
> requirements or not.  You can get the "change time" field using the stat()
> 
> API.
> 
> If you really want to go in the order in which they're created, the 
> Qp0lGetAttr() API can be used to retrieve the create date/time.  This API 
> is much more difficult to use than stat(), so I'd avoid it unless there's 
> a really good reason to use the create date instead of the "change date".
> 
> For the projects that I've done, the "change date" made more sense, 
> anyway.
> 
> Another tip:  You can unlink() a file while you've got it open (with the 
> open() API).  If you do that, you can still use the file, even though it's
> 
> gone from the directory.  The actual data portion of the file will remain 
> usable until you close the file, at which point it'll be deleted.
> 
> This is useful when you want to process one file and make it completely 
> unavailable to other processes on the system, so that they won't also try 
> to process it.
> 
> Good luck
> 
> -- 
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
> 
This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential or privileged
information.  Any unauthorized review, use, disclosure or distribution is
prohibited.  If you are not the intended recipient, please contact the
sender by reply e-mail and destroy the message.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.