I finally got around to trying this again and I could not get the ERRORLEVEL method to work. Here's what I have.
First, I created a simple TI process to create a dimension with 3 elements in it. In the the script line to add the 3rd element, I added an obvious error by supplying it the wrong element type.
Code: Select all
MyDimension = 'Test Error Handling';
DIMENSIONDESTROY(MyDimension);
DIMENSIONCREATE(MyDimension);
DIMENSIONSORTORDER(MyDimension,'','','BYHIERARCHY','ASCENDING');
DIMENSIONELEMENTINSERT(MyDimension, '', 'Item 1', 'n');
DIMENSIONELEMENTINSERT(MyDimension, '', 'Item 2', 'n');
[b]DIMENSIONELEMENTINSERT(MyDimension, '', 'Item 3',[i] 'x'[/i]);[/b]
The TM1RunTI configuration file I created has the following:
Code: Select all
[TM1RunTI]
process = Test Error Handling
connect = Main
[Process - Test Error Handling]
[Connect - Main]
adminhost = myserver.mydomain.com
Server = MyTM1Server
user = admin
pwd = apple
The batch file has the following: (I blew it out to see if I was missing something)
Code: Select all
echo off
echo You are about to run the Test Error Handling process. Are you sure you want to continue?
pause
START C:\ibm\cognos\tm1_64\bin64\tm1runti.exe -i "C:\TM1\MyTM1Server\Test\RunTM1Process.ini" -process "Test Error Handling"
IF ERRORLEVEL 0 GOTO ERR00
IF ERRORLEVEL 1 GOTO ERR01
IF ERRORLEVEL 2 GOTO ERR02
IF ERRORLEVEL 3 GOTO ERR03
IF ERRORLEVEL 4 GOTO ERR04
IF ERRORLEVEL 5 GOTO ERR05
IF ERRORLEVEL 6 GOTO ERR06
IF ERRORLEVEL 7 GOTO ERR07
IF ERRORLEVEL 8 GOTO ERR08
IF ERRORLEVEL 9 GOTO ERR09
IF ERRORLEVEL 10 GOTO ERR10
IF ERRORLEVEL 11 GOTO ERR11
IF ERRORLEVEL 99 GOTO ERR99
pause
echo Um.. What happened?! You shouldn't be getting this message. You should have been taken to an error/message line below.
exit
:ERR00
echo no error
pause
exit
:ERR01
echo error 1
pause
exit
:ERR02
echo error 2
pause
exit
:ERR03
echo error 3
pause
exit
:ERR04
echo error 4
pause
exit
:ERR05
echo error 5
pause
exit
:ERR06
echo error 6
pause
exit
:ERR07
echo error 7
pause
exit
:ERR08
echo error 8
pause
exit
:ERR09
echo error 9
pause
exit
:ERR10
echo error 10
pause
exit
:ERR11
echo error 11
pause
exit
:ERR99
echo error 99
pause
exit
Given the above, I was expecting the command prompt to return an error code of above 0 or most likely error code "99" (which according to the TM1RunTI utility documentation is an unspecified error) to indicate the error in the "Test Error Handling".
Instead, it kept returning there was "no error" meaning that, if you look at my batch file script, the ERRORLEVEL is returning "0 "and then going to my line defined as ":ERR00" and returning (echoing) my "no error" message to the command prompt application.
I tried to provide it a non-existent process which I expected would return error code "6" according to the documentation, but it's still returning error code "0":
Code: Select all
START C:\ibm\cognos\tm1_64\bin64\tm1runti.exe -i "C:\TM1\MyTM1Server\Test\RunTM1Process.ini" -process "x_Test Error Handling"
I even tried to provide reverse the order of the error check (because I read that ERRORLEVEL returns errors 1 and above, so maybe it would return 0 and above? don't know) and that still returned error code "0":
Code: Select all
IF ERRORLEVEL 99 GOTO ERR99
IF ERRORLEVEL 10 GOTO ERR10
IF ERRORLEVEL 9 GOTO ERR09
etc...