×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
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;
On 5/14/2019 11:21 AM, Jeff Bianchi wrote:
I just finished reading this article by Joe Pluta: https://www.mcpressonline.com/programming/rpg/practical-rpg-processing-an-ifs-directory
At the bottom are two links: 1. Source code, and; 2. Prototypes and DS
Those links are broken. Does anyone have the source for these two, or a working example based on this article?
Thanks!
Jeff Bianchi
Jeff.Bianchi@xxxxxxxx<mailto:Jeff.Bianchi@xxxxxxxx>| P 253.804.1034
Oak Harbor Freight Lines, Inc.
"Bringing Peace of Mind Since 1916."
As an Amazon Associate we earn from qualifying purchases.