Code:
Field Pos Pos Len/Dec/Typ Text IFSDELR 55 Item Nu IPATH 1 50 50 A IDAYS 51 55 5 A
Code:
fIFSDELPF if e k disk d PurgeDirectory pr extpgm( 'IFSDIRDEL' ) d dir 50a const d numberDays 5a const /free setll *start IFSDELPF; read IFSDELPF; dow not %eof( IFSDELPF ); PurgeDirectory( ipath : idays ); read IFSDELPF; enddo; *inlr = *on; /end-free
Code:
h bnddir( 'CGIDEV2' ) h dftactgrp( *no ) /copy cgidev2/qrpglesrc,hspecs /copy cgidev2/qrpglesrc,hspecsbnd /copy cgidev2/qrpglesrc,prototypeb /copy cgidev2/qrpglesrc,usec *this is the *entry plist ............................................ d IFSDIRDEL pr extpgm( 'IFSDIRDEL' ) d dir 50a const d numberDays 5a const d IFSDIRDEL pi d dir 50a const d numberDays 5a const *................................................. .................... d*doc s 500a varying d fileName s 150a d n s 5i 0 d path s 50a varying d*type s 10a /free path = %trim( dir ); n = %int( numberDays ); exec sql set option naming = *SYS ; exec sql declare c1 cursor for select filename from table( qgpl/ifsdir( :path ) ) as t where ( type = '*STMF' ) and ( modify_time < current timestamp - :n days ) order by modify_time ; exec sql open c1; exec sql fetch c1 into :filename ; dow sqlcod = 0; unlink( %trim( path ) + '/' + %trimr( filename ) ); exec sql fetch next from c1 into :filename ; enddo; exec sql close c1; *inlr = *on; /end-free
Leave a comment: