|
Pgm has worked for many months. New files added to dir each week. Now gets thru 27,219 files in directory and then fails on next file. Message ID . . . . . . . . . : CPE3450 Message file . . . . . . . . : QCPFMSG Library . . . . . . . . . : QSYS Message . . . . : Descriptor not valid. Cause . . . . . : A file descriptor argument was out of range, referred to file that was not open, or a read or write request was made to a file that is not open for that operation. I can see this next file thru Windows Explorer, and actually open file via Adobe pdf When halts - dump option dumps the clp that called the rpg. How can I bulletproof the below code, or determine whats wrong. I copied Scott's sample code to put this together. C* Open directory C eval returnDir = opendir(%addr(FullName)) C* Terminate if error occurred when opening directory C if ReturnDir = *Null C eval *inlr = *on C return C endif C dou PtrToEntry = *null C* Read next directory entry C eval PtrToEntry = readdir(ReturnDir) C* error? C if PtrToEntry = *null c callp EscErrno(errno) c endif C* Directory entry name is in field d_name C if PtrToEntry <> *Null C eval DirEntry = RtnEntry C* Get directory entry name C eval EntryName = %str(%addr(d_name)) C* Determine object type of entry C eval EntryPath = %trim(DirName) + '/' C + %trimr(EntryName) + Null C eval ReturnInt = lstat(%addr(EntryPath) C : %addr(StatDS)) c* C if st_objtype = '*STMF' ... more code C endif C endif C enddo jim franz
As an Amazon Associate we earn from qualifying purchases.
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.