TI process hangs on

Post Reply
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

TI process hangs on

Post by BariAbdul »

I am trying to find the subsetcount with below process,it saves fine but just hangs on,infact the server has to be restarted:

Code: Select all

#****Begin: Generated Statements***
#****End: Generated Statements****


# If the Allsubsets dimension exits then we delete it and again create it.#
IF(DimensionExists('AllSubsets')=1);
    DimensionDestroy('AllSubsets');
ENDIF;

DimensionCreate('AllSubsets');
IF(DimensionExists('Dimension_names')=1);
    DimensionDestroy('Dimension_names');
endif;

no_dimensions = DIMSIZ('}Dimensions');

DimensionCreate('Dimension_names');
DimensionElementDelete('}Dimensions','Dimension_names');
dim_counter = 1;

WHILE(dim_counter <= no_dimensions);

    dim_name=DIMNM('}Dimensions',dim_counter);
    # Skip the control dimensions
    var1=scan('}',dim_name);

    if(var1<>1);
        DimensionElementInsert('Dimension_names','',dim_name,'N');
        i=0;vFilenew='';
        compare='a';
        # Search for corresponding folder and .sub file for a dimension
        while(compare@<>'');
            vFile = WildCardFileSearch( vDataDirectory|'\'| dim_name | '}subs\'| '*.sub',vFilenew) ;
            result=fileExists( vDataDirectory | '\'| dim_name | '}subs\'| vFile);
            if(vFile@<>'');
                if(vFIle@<>'Default.sub');
                    strlength=LONG(vFile);
                    vSubsetfinal=DELET(vFile,strlength-3,4);
                    DimensionElementInsert('AllSubsets','',vSubsetfinal,'N');
                endif;
                vFilenew=vFile;
            endif;
            if(vFile@='');compare='';
            endif;
        END;
    endif;

    dim_counter = dim_counter +1;
END;

dim_counter=1;
subset_counter=1;
no_dim = DIMSIZ('Dimension_names');
no_subsets = DIMSIZ('AllSubsets');ASCIIOutput(vOutputFile |'\'| 'SubsetCount.csv','Dimension_names','Subset_names');
WHILE(subset_counter<=no_subsets);
    subset_name=DIMNM('AllSubsets',subset_counter);
    dim_counter_new=1;
    WHILE(dim_counter_new<=no_dim);
        dim_name1=DIMNM('Dimension_names',dim_counter_new);
        var_dim_name = scan('}',dim_name1);
        if(var_dim_name<>1);
            if(dim_name1@<>'AllSubsets');
                #If the subset exists for the dimension then write its name# in front of the dimension name in csv file
                if(SubsetExists(dim_name1,subset_name)=1);
                    ASCIIOutput(vOutputFile |'\'| 'SubsetCount.csv',dim_name1,subset_name);
                endif;
            endif;
        endif;
        dim_counter_new=dim_counter_new+1;
    END;
subset_counter=subset_counter+1;
END;
Could anybody help me on this one ,Please.
"You Never Fail Until You Stop Trying......"
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

Re: TI process hangs on

Post by BariAbdul »

Sorry I forgot to mention most important bit,this particular model consists lots(about 70,000)subsets,could that be the reason?Thanks
"You Never Fail Until You Stop Trying......"
Wim Gielis
MVP
Posts: 3241
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: TI process hangs on

Post by Wim Gielis »

Hello

This is a big number of subsets...

Does it work on a much smaller number of subsets?
Do you have all of your loops and counters correct? (it's not easy to tell immediately if you do not indent your code and you do not use the code tags correctly).

What is this line for?

Code: Select all

DimensionElementDelete('}Dimensions','Dimension_names');
and you set a counter BEFORE that line? Did you use AsciiOutput to follow what is going on in the loops?
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Alan Kirk
Site Admin
Posts: 6667
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: TI process hangs on

Post by Alan Kirk »

Wim Gielis wrote: This is a big number of subsets...

Does it work on a much smaller number of subsets?
Do you have all of your loops and counters correct? (it's not easy to tell immediately if you do not indent your code and you do not use the code tags correctly).
It's indented and tagged properly now. Not sure how, maybe a guardian demon did it. :twisted:

There was also (originally) an If() test right at the end of another line after a semi-colon. While it's syntactically permissible, it does make it a bear to try to match the If/EndIf statements.
Wim Gielis wrote:What is this line for?

Code: Select all

DimensionElementDelete('}Dimensions','Dimension_names');
and you set a counter BEFORE that line?
I get what he's doing there; he creates the dimension 'Dimension_Names' but doesn't want to iterate that dimension in his loop since it's not a "real" dimension. Nonetheless I'd regard that as being bad juju. I absolutely would NOT monkey with the contents of any of the system dimensions. It would be far safer to just include a test in the loop setting the value of var1 to 1 if the dimension in question is named 'Dimension_Names' and thus skipping it in the same way as the system dimensions are.

I'm not saying that that's the cause of the problem (I don't have time right now to analyse the whole thing; I skimmed it but nothing stands out), but I definitely wouldn't do it.
Wim Gielis wrote:Did you use AsciiOutput to follow what is going on in the loops?
Seconded; that's essential. The AsciiOutput should be written with a timestamp, a code line, and the value of all variables up to that point. It won't be possible to read it while the process is still running but if the thing really is hanging then it'll at least show where it's hanging which will in turn reveal why.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
Duncan P
MVP
Posts: 600
Joined: Wed Aug 17, 2011 1:19 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2
Excel Version: 2003 2007
Location: York, UK

Re: TI process hangs on

Post by Duncan P »

Easier than putting in loads of AsciiOutput statements, but quite a lot more verbose, is setting DEBUG logging for process functions.

I described how to do it here.

[Edit] and you can read the log while the process is running.
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

Re: TI process hangs on

Post by BariAbdul »

Wim Gielis wrote:Hello

This is a big number of subsets...

Does it work on a much smaller number of subsets?
Yes,Indeed it is a big number,When I tried on smaller set of subsets it seems to work.
It's indented and tagged properly now. Not sure how, maybe a guardian demon did it. :twisted:
Surprising I did posted it by using 'Code' which somehow worked later on! ;)

Thank you gurus for your help.You all been really kind.
"You Never Fail Until You Stop Trying......"
Wim Gielis
MVP
Posts: 3241
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: TI process hangs on

Post by Wim Gielis »

Duncan P wrote:Easier than putting in loads of AsciiOutput statements, but quite a lot more verbose, is setting DEBUG logging for process functions.

I described how to do it here.
Hello Duncan,

That is interesting, I never used that debugging function on TI commands. Thanks.

I did a small test with this TI process code:

Code: Select all

i = 1;

WHILE( i <= 2 );

     AsciiOutput( 'test.txt', NumberToString( i ) );

      i = i + 1;

END;
The output in the text file is (as it should be):

"1"
"2"


However, the output in the TM1 Message Log is as follows:

12560 [2] INFO 2014-09-03 07:29:30.783 TM1.Process Process "test" executed by user "Wim"
12560 [2] DEBUG 2014-09-03 07:29:30.783 TM1.Process.Functions Process = test, Function = numbertostring
12560 [2] DEBUG 2014-09-03 07:29:30.783 TM1.Process.Functions.Parameters Process = test, Function = numbertostring, Parameter 1 =
12560 [2] DEBUG 2014-09-03 07:29:30.783 TM1.Process.Functions Process = test, Function = AsciiOutput
12560 [2] DEBUG 2014-09-03 07:29:30.783 TM1.Process.Functions.Parameters Process = test, Function = AsciiOutput, Parameter 1 = test.txt
12560 [2] DEBUG 2014-09-03 07:29:30.783 TM1.Process.Functions.Parameters Process = test, Function = AsciiOutput, Parameter 2 = 1
12560 [2] DEBUG 2014-09-03 07:29:30.783 TM1.Process.Functions Process = test, Function = numbertostring
12560 [2] DEBUG 2014-09-03 07:29:30.783 TM1.Process.Functions.Parameters Process = test, Function = numbertostring, Parameter 1 =
12560 [2] DEBUG 2014-09-03 07:29:30.783 TM1.Process.Functions Process = test, Function = AsciiOutput
12560 [2] DEBUG 2014-09-03 07:29:30.783 TM1.Process.Functions.Parameters Process = test, Function = AsciiOutput, Parameter 1 = test.txt
12560 [2] DEBUG 2014-09-03 07:29:30.783 TM1.Process.Functions.Parameters Process = test, Function = AsciiOutput, Parameter 2 = 2
12560 [2] INFO 2014-09-03 07:29:30.783 TM1.Process Process "test": finished executing normally, elapsed time 0.00 seconds


Why does the variable i is not filled in ? For example, the numbertostring does not have a parameter value for i, but AsciiOutput has the value for i ... ?
That's typically the kind of information one needs... when looping, we need to debug the loop and check the value of i.

Why is numbertostring all lower case, and AsciiOutput is mixed case? Strange :-) I typed both in mixed case in the TI code, so there should be some kind of modification by TM1.

Thanks,

Wim
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
dr.nybble
MVP
Posts: 160
Joined: Wed Aug 17, 2011 3:51 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: Excel 2007

Re: TI process hangs on

Post by dr.nybble »

Hi Wim, the function names you see are how the developer typed it into the TM1 source code.

Over the years they have accrued but there is no consistency in the case.

As for the debugging, it is a bug -- I just checked. I'll let the developer responsible for that area know.
Wim Gielis
MVP
Posts: 3241
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: TI process hangs on

Post by Wim Gielis »

Hi,

Great, thanks!

I would love to have the value of i, if it's a bug then I am sure it can be corrected :-)
The lowercase is not critical. Consistency would be good but the other problem is far more important.

Thanks.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Post Reply