×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Thanks Joe!

In your article one of the nuances you mention is dealing with a file that is not yet compete. Do you have an opinion of how to recognize a file in such a condition? I'm guessing that if one can identify a file as 'in-process' (as opposed to 'complete') then one would simply bypass it so that it gets processed the next time the monitor program interrogates the directory.

Thanks again, Joe.



Jeff

message: 1
date: Tue, 14 May 2019 11:41:56 -0500
from: Joe Pluta <joepluta@xxxxxxxxxxxxxxxxx>
subject: Re: Joe Pluta Source code

Here is the source code.? Prototypes to follow!

???????? ctl-opt dftactgrp(*no) actgrp(*new);

???????? dcl-s wImportDir varchar(64) inz('/import/inbound/'); ???????? dcl-s wReceivedDir varchar(64) inz('/import/received/'); ???????? dcl-s wErrorDir varchar(64) inz('/import/error/'); ???????? dcl-s wFileName varchar(128);

???????? dcl-s hDir pointer;
???????? dcl-ds dsDirEnt likeds(IFS_DirEnt) based(pDirEnt); ???????? dcl-ds dsStat likeds(IFS_Status);

???????? // Open directory, exit on error ???????? hDir = IFS_opendir(wImportDir); ???????? if hDir = *null; ?????????? log( 'opendir': errno); ?????????? return; ???????? endif;

???????? // Spin through folder
???????? dou (pDirEnt = *null);

?????????? // Get next directory entry, exit on null ?????????? pDirEnt = IFS_readdir(hDir); ?????????? if pDirEnt = *null; ???????????? leave; ?????????? endif;

?????????? // Skip subdirectories
?????????? wFileName = %trim(%str(%addr(dsDirEnt.name)));
?????????? IFS_stat(wImportDir + wFileName: %addr(dsStat)); ?????????? if %bitand( dsStat.mode: C_MODE_DIRMASK) = C_MODE_DIRVAL; ???????????? iter; ?????????? endif;

?????????? // Route the file to the appropriate application ?????????? Route( wErrCd: wImportDir: wFileName); ?????????? if wErrCd = *blanks; ???????????? MoveIFS( wImportDir: wFileName: wReceivedDir); ?????????? else; ???????????? MoveIFS( wImportDir: wFileName: wErrorDir); ?????????? endif;

???????? enddo;

???????? IFS_closedir(hDir);

???????? *inlr = *on;
???????? return;

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-2026 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.