project BLF > class Shutdown > method MainBlock

Description

MainBlock


Internal usage


unused


program code (program1/shutdown.p)

assign vhFcComponent = session:first-procedure
       vlFcOk        = yes.

do while valid-handle(vhFcComponent) :
    if vhFcComponent:file-name begins "ins/":U
    then do:
        message "ERROR : instance procedure still running (":U
                vhFcComponent:file-name ")":U.
        vlFcOk = no.
    end.
    assign vhFcComponent = vhFcComponent:next-sibling.
end.

if not vlFcOk
then return.

/* Remove all business components from memory. */
run RemoveAllComponentsInPool.

/* What is left over are technical components. */
vhFcComponent = session:first-procedure.
viFcCount3 = 0.
do while valid-handle(vhFcComponent) :
    if vhFcComponent:file-name begins "program/":U
    and vhFcComponent:file-name <> "program/componentpool.p"
    then do:
        viFcCount3 = viFcCount3 + 1.
        create tDeleteProcedure.
        assign tDeleteProcedure.thFcComponent = vhFcComponent
               tDeleteProcedure.tiSeq         = (if vhFcComponent:file-name = "program/progress.p"
                                                 then 999
                                                 else viFcCount3).
    end.
    assign vhFcComponent = vhFcComponent:next-sibling.
end.

for each tDeleteProcedure by tDeleteProcedure.tiSeq:
    if valid-handle (tDeleteProcedure.thFcComponent)
    then do:
        run gipr_DeleteProcedure in tDeleteProcedure.thFcComponent.
        delete procedure tDeleteProcedure.thFcComponent.
    end.
    delete tDeleteProcedure.
end.