空参数传递给跳过列表

时间:2019-01-08 21:07:53

标签: ibm-doors

我在第50行和第89行遇到“空跳过参数已传递到参数位置1”错误,我想将目标/源模块名称放入跳过列表。我知道循环仅在分别有out / in链接时才执行,那么它怎么有null参数呢?我还检查模块名称是否为空,但是该检查不会使错误框弹出。两个循环都针对一定数量的对象执行,然后在到达不喜欢的特定点时停止。任何提示将不胜感激。

  /*
Counts the number of non-obsolete requirements in a module and generates a count of number of objects with in/out links, organized by module name. Output is to a CSV file.

*/

pragma runLim, 0        //turn off timeout dialog
filtering off
Module m = current

/***********************
    populateBuffer
************************/
void populateBuffer(Buffer &b)
{
    Object o = null
    Link l
    LinkRef lr
    ModName_ srcMod
    ModName_ tarMod
    string targetMod
    string sourcMod
    int count = 0
    int outTotal = 0
    int inTotal = 0 
    int i = 0
    int n = 0

Skip OinLinks = createString
Skip OoutLinks = createString
Skip MinLinks = createString
Skip MoutLinks = createString
Skip OutOrphans = create        //list of object abs nos which do not have any out links
Skip InOrphans = create     //list of object abs nos which do not have any in links

string s = ""

for o in m do   
{
    if ((o."URB Object Type" "" == "Requirement") && (o."TIS Status" "" != "Obsolete")) //always cast an attribute value as a string with empty quotes
    {
        for l in o->"*" do //for out links
        {
            tarMod = target(l)
            targetMod = name(tarMod)  //puts the target module of the current link into a string
            if (null targetMod) {errorBox "FAILURE FINDING TARGET MODULE!"; halt}
            print targetMod "\n"
            put(OoutLinks, targetMod, count + 1)        //puts all of the targetMods into the OoutLinks skip list
            n++ 
        }
            if (n > 0) //check if this object has outlinks
            {
                for count in OoutLinks do//for each unique outlink target module of the current object
                {
                    if (find(MoutLinks, targetMod, i)) //if there is already a matching entry
                    {
                        delete(MoutLinks, targetMod) //remove the entry for that particular module name
                        put(MoutLinks, targetMod, i+1) //and re-enter it with count+1 in module level skip list
                    }
                    else {put(MoutLinks, targetMod, 1)} //if it is a new entry, add it with count 1
                }
            }
            else //if there are no outlinks,
            {
                int absno = o."Absolute Number"
                put(OutOrphans, absno, 1)       //This adds the absno of the current object to 
                                                //our orphan list
            }
            n = 0

        for lr in o <-"*" do //for in links
        {
            sourcMod = name(source lr)  //puts the source module of the current link into a string
            if (null sourcMod) {errorBox "FAILURE FINDING SOURCE MODULE!"; halt}
            print sourcMod "\n"
            print "Source Modules \n"
            put(OinLinks, sourcMod, count + 1)      //puts all of the sourcMods into the OinLinks skip list
            n++ 
        }
            if (n > 0) //check if this object has inlinks
            {
                for count in OinLinks do//for each unique inlink target module of the current object
                {
                    if (find(MinLinks, sourcMod, i)) //if there is already a matching entry
                    {
                        delete(MinLinks, sourcMod) //remove the entry for that particular module name
                        put(MinLinks, sourcMod, i+1) //and re-enter it with count+1 in module level skip list
                    }
                    else {put(MinLinks, sourcMod, 1)} //if it is a new entry, add it with count 1
                }
            }
            else //if there are no inlinks,
            {
                int absno = o."Absolute Number"
                put(InOrphans, absno, 1)        //This adds the absno of the current object to 
                                                //our orphan list
            }           


        delete(OinLinks)        //reset the OinLinks list so we can start fresh for the next object     
        delete(OoutLinks)       //reset the OoutLinks list so we can start fresh for the next object        

        n = 0
    }

    else continue
}
} /************************************ MAIN *************************************/
string fName = "C:/Temp/LinkedObjectsInventory_Jan8.csv"
Stream outfile = write(fName)
Buffer b = create
populateBuffer(b)
outfile << b
close(outfile)
delete(b)
// notify the user that the script is complete
ack "Inventory Complete."

1 个答案:

答案 0 :(得分:0)

这是一个非常简单的问题-

我要进行的更改-替换为:

delete(OinLinks)        //reset the OinLinks list so we can start fresh for the next object     
delete(OoutLinks)       //reset the OoutLinks list so we can start fresh for the next object     

与此:

    for count in OinLinks do //reset the OinLinks list so we can start fresh for the next object     
    {
        delete ( OinLinks , ( string key OinLinks ) )
    }

    for count in OoutLinks do //reset the OoutLinks list so we can start fresh for the next object
    {
        delete ( OoutLinks , ( string key OoutLinks ) )
    }

作为每个对象循环的一部分,您正在删除整个跳过列表,而不是清空列表。这意味着在随后的循环中,程序无法找到“跳过”列表并抛出错误。最好重用跳过而不是每次都重新分配它们,但是您必须清空内容,而不是在跳过句柄上调用delete。

祝你好运,如果还有其他问题,请告诉我!