|
Now realizing it appears failing after last file in directory.Name Size Owner Changed Used CCSID or Symbolic Link pdfs 277,238K JIMF 07/17/06 10:08 07/17/06 14:36 SUBDIRECTORIES = 0, FILES = 27217
jim----- Original Message ----- From: "Bryan Dietz" <BDietz@xxxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx> Sent: Monday, July 17, 2006 2:37 PM Subject: Re: halt with readdir
this will not fix the error, bit what happens if you use edtf and option 6 to count the number of files in that directory. for example if the files are in /home/pdf use edtf '/home' and put a 6 in front of the pdf directory. if you are using 27x132 display you should see more info. I guess I am just wondering if that is the right count for the number of files... _____________________________ Bryan Dietz Aktion Associates i want an i rpg400-l-bounces@xxxxxxxxxxxx wrote on 07/17/2006 02:30:24 PM: -> 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-> -- -> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailinglist -> 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 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.
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.