project BLF > class TDaemonUtility > method GetDaemonLogFileInternal


Parameters


icDaemonNameinputcharacter
ocFileNameoutputcharacter
omFileContentoutputmemptr
ocErrorMessageoutputcharacter
oiReturnStatusoutputinteger


Internal usage


BLF
method TDaemonUtility.GetDaemonLogFile


program code (program1/tdaemonutility.p)

<Q-57 run DaemonInfo (all) (Read) (NoCache)
   (input 0, (DaemonId)
    input icDaemonName, (DaemonName)
    input '', (DaemonStatus)
    input '', (DaemonStatusDiffersFrom)
    output dataset tqDaemonInfo) in BBaseDaemon>

find first tqDaemonInfo where tqDaemonInfo.tcDaemonName = icDaemonName no-error.
if available tqDaemonInfo
then do:
    /* the query itself replaces $ENVROOT */
    file-info:file-name = tqDaemonInfo.tcDaemonLogFile.
    if file-info:file-type = ?
    or file-info:file-type begins "D"
    then do:
        ocErrorMessage = replace (#T-26'File not found: $1.':100(17)T-26#, "$1", tqDaemonInfo.tcDaemonLogFile).
        oiReturnStatus = -3.
        return.
    end.
    
    ocFileName = file-info:full-pathname.
    copy-lob from file file-info:full-pathname to omFileContent no-error.
    if error-status:error
    then do:
        oiReturnStatus = -3.
        do viA = 1 to error-status:num-messages:
            ocErrorMessage = ocErrorMessage + error-status:get-message(viA) + chr(10).
        end.
    end.
end.
else assign oiReturnStatus = -3
            ocErrorMessage = substitute (#T-92'Unable to find the daemon based on its name (&1).':255(33)T-92#,icDaemonName).