|
Buck,
I have done this and it works very well. Here is a snipet of the code.
*Data structure that needs to go along with Read Directory operation
D DirEnt DS BASED(Entry)
D D_Reserved 16A
D D_fileeno 10U 0
D D_fileno 10U 0
D D_reclen 10U 0
D D_res2 10I 0
D D_res3 6A
D D_res4 2A
D ccsid 10I 0
D country_id 2A
D language_ID 3A
D nls_res5 3A
D D_namelen 10U 0
D D_name 640A
D DirNamZ S 50A INZ(' ' )
D DirNamP S * INZ(%ADDR(DirNamz))
C EVAL DirNamz = %TRIM(DirNam) + ZeroBin
C Eval Dir = opendir(DirNamp)
C IF Dir = NUL
C EVAL RC = perror(Dir)
C Eval errmsg = 'Error in opening Dir+
C ectory'
C Eval errorpage = errpag(errmsg)
C Eval errdly = 1
C Return
C EndIf
C Eval Entry = readdir(Dir)
Once you know the file name you canuse Unlink to delete it
C Eval RL = unlink(FileNamP)
My Header file looks like this:
* Open Directory Operation
* value returned = file descriptor 0 (OK), -1 (Error)
Dopendir PR * EXTPROC('opendir')
D * VALUE
* Read Directory Operation
*
Dreaddir PR * EXTPROC('readdir')
D * VALUE
* Open Directory Operation
* value returned = 0 (OK) or , -1 (Error)
Dclosedir PR 10I 0 EXTPROC('closedir')
D * VALUE
* Unlink a File from system... Delete File
* value returned = 0 (OK) or , -1 (Error)
Dunlink PR 10I 0 EXTPROC('unlink')
D * VALUE
Wayne
System Administrator
Groendyke Transport
> -----Original Message-----
> From: Buck Calabro/commsoft [SMTP:mcalabro@commsoft.net]
> Sent: Tuesday, March 16, 1999 10:09 AM
> To: midrange-l@midrange.com
> Subject: opendir() in RPG IV
>
> Anybody get opendir() to work in RPG IV, or should I use the
> Qp0lProcessSubtree API? It works great in C, but I get errno = 3025 (not
> found) when I try it in RPG IV. I think it may be a bad mapping for the
> DIR struct. I am hampered in using C because of shop standards.
>
> My goal is to be able to read all the file names from an IFS directory,
> pass them one at a time to another RPG program, then delete them so they
> don't get re-processed.
>
> Thanks!
>
> Buck Calabro
> Billing Concepts (formerly CommSoft) Albany, NY
> mailto:mcalabro@commsoft.net
> +---
> | This is the Midrange System Mailing List!
> | To submit a new message, send your mail to MIDRANGE-L@midrange.com.
> | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
> | To unsubscribe from this list send email to
> MIDRANGE-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator:
> david@midrange.com
> +---
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.