project BLF > class BBaseDaemon > method Calculate

Description

Add code here to initialize the calculated fields of the class temp-tables after loading existing records from the application database.


Parameters


oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bbasedaemon.p)

<ANCESTOR-CODE>

for each tfcDaemon where
         tfcDaemon.tc_Status <> 'D':U on error undo, throw:
         
    if vlDataLoadKeepPrevious and can-find (tAlreadyCalculatedRecords where
             tAlreadyCalculatedRecords.tcTableName = "fcDaemon" and
             tAlreadyCalculatedRecords.tc_Rowid = tfcDaemon .tc_Rowid)
    then next.
             
    /* Convert Time Fields to format 99:99:99 */
    assign tfcDaemon.tcDaemonLastStartTimeConv =
                string(trunc(tfcDaemon.DaemonLastStartTime / 3600, 0), "99":U)             + ":":U + /* Hours */
                string(trunc((tfcDaemon.DaemonLastStartTime modulo 3600) / 60, 0), "99":U) + ":":U + /* Minutes */
                string((tfcDaemon.DaemonLastStartTime modulo 3600) modulo 60, "99":U)                /* Seconds */
           tfcDaemon.tcDaemonLastEndTimeConv   =
                string(trunc(tfcDaemon.DaemonLastEndTime / 3600, 0), "99":U)               + ":":U + /* Hours */
                string(trunc((tfcDaemon.DaemonLastEndTime modulo 3600) / 60, 0), "99":U)   + ":":U + /* Minutes */
                string((tfcDaemon.DaemonLastEndTime modulo 3600) modulo 60, "99":U).                 /* Seconds */

    <M-3 run GetEnvVars
       (output tfcDaemon.tcEnvRoot (ocEnvRoot), 
        output tfcDaemon.tcEnvAppServerURL (ocEnvAppServerURL), 
        output viFcReturnSuper (oiReturnStatus)) in BBaseDaemon>
end.

assign vhFcComponent = ?.
<M-2 run MainBlock  () in TCrypt>
assign vhCrypthandle = vhFcComponent.

for each tfcDaemon on error undo, throw:

    if vlDataLoadKeepPrevious and can-find (tAlreadyCalculatedRecords where
             tAlreadyCalculatedRecords.tcTableName = "fcDaemon" and
             tAlreadyCalculatedRecords.tc_Rowid = tfcDaemon .tc_Rowid)
    then next.

    <M-5 run DecryptString
       (input  tfcDaemon.DaemonPassword (icInputString), 
        output tfcDaemon.DaemonPassword (ocOutputString), 
        output viFcReturnSuper (oiReturnStatus)) in TCrypt>
end.

finally:
    if vhCrypthandle <> ?
    then do:
        run gipr_DeleteProcedure in vhCrypthandle.
        delete procedure vhCrypthandle.
    end.
end finally.