Sorry, dass ich spät zur Party angekommen.
Leider sind die Article (INN Newsletter & Systemi Magazine) Links nicht mehr verfügbar. Ist aber hier zu lesen: http://www.support.ecofitonline.com/...-Tree-Contents
CLLE pgm:
Code:
/********************************************************************/
/* SYSTEM - Systems */
/* AUTHOR - Deon A von Blerk (EcofIT Ltd) */
/* DATE - 25/01/09 */
/* Description - List the IFS files for a directory tree */
/* */
/* MODIFICATION HISTORY */
/* ==================== */
/* Date Nr By/Reason */
/* ---- --- --------- */
/********************************************************************/
PGM PARM(&AttchPath &DocName &PgmError)
DCL VAR(&AttchPath) TYPE(*CHAR) LEN(64)
DCL VAR(&DocName) TYPE(*CHAR) LEN(32)
DCL VAR(&QSHSTMT) TYPE(*CHAR) LEN(200)
DCL VAR(&Exists) TYPE(*CHAR) LEN(2)
DCL VAR(&PgmError) TYPE(*CHAR) LEN(2)
MONMSG MSGID(CPF0000 QSH0000) EXEC(GOTO CMDLBL(FAIL))
/********************************************************************/
/* Create the workfiles */
/********************************************************************/
DLTF FILE(QTEMP/QSHLIST)
MONMSG MSGID(CPF0000)
CRTPF FILE(QTEMP/QSHLIST) RCDLEN(200)
DLTF FILE(QTEMP/QSHFIND)
MONMSG MSGID(CPF0000)
CRTPF FILE(QTEMP/QSHFIND) RCDLEN(200)
/********************************************************************/
/* Fill the data */
/********************************************************************/
OVRDBF FILE(STDOUT) TOFILE(QTEMP/QSHLIST) OVRSCOPE(*JOB)
CHGVAR VAR(&QSHSTMT) VALUE('ls -lRT' *BCAT &AttchPath)
QSH CMD(&QSHSTMT)
DLTOVR FILE(STDOUT) LVL(*JOB)
OVRDBF FILE(STDOUT) TOFILE(QTEMP/QSHFIND) OVRSCOPE(*JOB)
CHGVAR VAR(&QSHSTMT) VALUE('find' *BCAT &AttchPath *TCAT '*')
QSH CMD(&QSHSTMT)
DLTOVR FILE(STDOUT) LVL(*JOB)
/********************************************************************/
/* Now check if the document exists */
/********************************************************************/
CALLPRC PRC(IFS50R) PARM(&DocName) RTNVAL(&PgmError)
GOTO CMDLBL(PERFECT)
/********************************************************************/
/* Fail */
/********************************************************************/
FAIL:
DLTF FILE(QTEMP/QSHLIST)
MONMSG MSGID(CPF0000)
DLTF FILE(QTEMP/QSHFIND)
MONMSG MSGID(CPF0000)
CHGVAR VAR(&PgmError) VALUE('01')
/********************************************************************/
/* EOJ */
/********************************************************************/
PERFECT:
ENDPGM
SQLRPGLE pgm:
Code:
Declare QSHDocs_csr cursor for
with ListOut as
(select
locate(':', QSHList, 51) -1 as Offset,
QSHList
from QSHList
where substr(QSHList, 13, 1) = '1'
)
select distinct QSHFind,
substr(QSHList, 47+Offset-5, 12) as DateTime,
substr(QSHList, 55+Offset) as Document,
substr(QSHList, 15, Offset+1) as Owner
from QSHFind, ListOut
where QSHFind like '%' concat trim(:DocName) concat '%'
and substr(QSHList, 55+Offset)
like '%' concat trim(:DocName) concat '%';
Bookmarks