Impact analysis

This report collects all models that will need to be re-created when an include document is changed. It must be placed in the Include Documents Reports folder inside the Document Report folder.

#
BEGIN

ARRAY TEXT docs [100]
NUMBER ndocs := 0

PROC add (CONST TEXT doc)
DO
    ASSIGN ndocs := ndocs + 1
    ASSIGN docs[ndocs] := doc
OD

PROC cond_add (CONST TEXT doc)
DO
    NUMBER find
    BOOL found := FALSE
    FOR find FROM 1 UPTO ndocs
    DO

        IF docs[find] = doc
        THEN ASSIGN found := TRUE
        FI
    OD
    IF NOT found
    THEN APROC add (doc)
    FI
OD


PROC expand (CONST TEXT doc)
DO
    NUMBER current := 0
    APROC add (doc)

    WHILE current < ndocs
    DO
        ASSIGN current := current + 1

        WITH Doc PATH REP.Document
        WHERE PAR(1) = docs[current]
        DO
            FORALL Rev IN Doc.IncludedBy
            DO
                IF Rev.IsCurrent = 1
                THEN APROC cond_add (Rev.DocumentRef)
                FI
            OD
        OD
    OD
OD


WITH Doc IN REP.Document DO
    APROC expand (Doc.Self)

#