Search code examples
modulenullibm-doors

Why is a DOORS Module sometimes null when trying to edit the Module via DXL?


I'm new to DXL programming language in IBM DOORS. However, I think I have managed to do many interesting things: create Modules, create Objects, create Links, delete Objects etc.

However, I have a very specific problem regarding "null" Modules. I've just written null between "" because the modules exist and they are referenced with a correct name.

When doing this:

 Module m1 = edit("1. MY_MODULE", false)
 save(m1)
 close(m1)

An error like this appears: enter image description here

You could not understand what does that mean as it is spanish. Basically states this: "Module null parameter in the first position of the argument." That means that the "m1" is null, as the parameter for save() method is null.

The point is that it is an error which appears only sometimes. It seems that the Module is null as it has been previously opened and DOORS does not close properly.

Is there any way, any method...whatever to avoid this error?


Solution

  • There might be many reasons that the module can't be opened in edit mode. For example: User do not have write access OR Module is being used by other user, etc.
    However, you can get around the error with the below code snippet:

    Module m = edit('My_module', false)
    if(!null m) {
        //execute program
        ...
    }
    else {
        //do something
    }
    

    I hope this helps.