IBM Support

Count the number of incoming links to a Rational DOORS module

Question & Answer


Question

How do I count the number of links, both incoming and outgoing for one of my requirements module in Rational DOORS.

Answer

To count the number of links, both incoming and outgoing links for a requirements module in Rational DOORS, you can run the script below that would automate the task. Please follow the steps below:

1. Login to DOORS.

2. Open the concerned DOORS module, click on Tools -> Edit DXL.

3. Paste the script in the editor window:



    //DXL code:

    // Count links

    /*

    This script checks every module in the current folder for outgoing/incoming links and sends it to tab-delimited text file. If you run the DXL from the DXL editor within the module, it will print the number of out links and in links for the module to a file local to your hard drive called linkCounts.xls under C:\temp.

    */

    pragma runLim, 0

    Stream output

    Module startMod = current

    void getData(Item itm) {

        Module thisMod = read(fullName(itm), false)

        Object anObj

        Skip modSkip = createString

        Module oMod

        int outCount = 0

        int inCount = 0

        for anObj in entire thisMod do {

            Link aLink

            for aLink in anObj -> "*" do {

                outCount++

            }

            LinkRef lRef

            for lRef in anObj <- "*" do {

                string smn = fullName(source(lRef))

                if (! open(module(smn))) {

                    oMod = read(smn, false)

                }

            }

            for aLink in anObj <- "*" do {

                inCount++

            }

        }

        for oMod in modSkip do {

            if (oMod != startMod) {

                close(oMod)

            }

        }

        if (thisMod != startMod) {

            close(thisMod)

        }

        output << path(itm)

        output << "\t"

        output << name(itm)

        output << "\t"

        output << outCount "\t"

        output << inCount "\n"

    } // getData

    void digDown(Folder thisFold) {

        Item itm

        for itm in thisFold do {

            if (type(itm) == "Folder" or type(itm) == "Project") {

                digDown(folder(itm))

            }

            else if (type(itm) == "Formal") {

                getData(itm)

            }

        }

    } // digDown

    output = write("c:/temp/linkCounts.xls")

    output << "Path\tName\tOut\tIn\n"

    digDown(current Folder)

    close(output)


4. Click on Run. An hour-glass would be displayed until the script finishes execution.

Disclaimer

All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

[{"Product":{"code":"SSKR2T","label":"IBM Engineering Requirements Management DOORS"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF033","label":"Windows"}],"Version":"9.2","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Document Information

Modified date:
01 May 2020

UID

swg21399196