Search code examples
ibm-doors

Is there a DXL API to get the reference count of opened modules?


The "Manage Open Modules" dialog of DOORS 8.3 lists all open modules, their mode, if visible, etc. and the number of references. I want to use that reference count to decide if my script can securely close the module and to avoid closing if it is currently in use. I'm not sure what the "References" column displays exactly. I didn't find a description of it in the help or corresponding informations on the internet. Does anybody know if there is some undocumented DXL API which gives me access to that information?

Edit: I found the function refcount_ which returns an integer. But I have no idea what the return value means.


Solution

  • I assume your script is opening the modules, so all you need to do is check if it is already open first.

    string sModuleFullName = "/Some/Module/Path"
    Module oModule = module(sModuleFullName)
    bool bClose = null(oModule)
    if(null(oModule)) {
    oModule = read(sModuleFullName, true,true)
    }
    
    // do stuff
    
    if(bClose) {
    close(oModule)
    }
    

    Edit: Alternative method for closing modules opened by triggers, attribute or layout dxl

    // Save currently open Modules to a Skip
    Skip oOpenModulesSkip = createString()
    Module oModule
    for oModule in database do {
        put(oOpenModulesSkip, fullName(oModule), fullName(oModule))
    }
    
    // do stuff
    
    // Close Modules not in the Skip
    for oModule in database do {
        if(!find(oOpenModulesSkip, fullName(oModule))) {
            close(oModule, false)
        }
    }
    delete(oOpenModulesSkip)