The Cameroon Airlines Corporation, trading as Camair-Co, is an airline from Cameroon, serving as flag carrier of the country, a role which was previously filled ...
Wednesday, June 29, 2011
The Secret M8 Papers
Monday, June 13, 2011
Travel Rage
Saturday, June 11, 2011
Dauphine stage 6
Of course the crash caused some chaos is the bunch and inevitable split so although i was back in a group of sorts i was now faced with a frantic chase to get back to the front group with only a few km's to the final climb. This was particularly importand as i had in my possesion the all important final water bottle for ivan to keep him suatained on the final climb. So a few crazy corners and some super high rpm revving and i made it to the front about 500m before the climb started, delived the bottle into the climb we went, i put up my parachut and went backwards at a rate of knotts and just to add insult into some very tired legs i flatted again just as the first set of cars had roled on past me to follow the lead group. So was not ment for me today, i put the call out for the second car to bring me a wheel but it was a fair ways back down the mountain so i just trudged up the first 5km of the climb on the dud wheel until paolo arrived with a replacement. Anyways all in all was another good hit out of a day and some days the luck just does not smile on you, hopefully tomorrow will be a little kinder.
The facts and figures for the stage from my srm are as follows
Distance 192km
Time 5hrs 20min
Speed av 36kmph
Elevation gain 4000m
Watt average 275
Heart rate average 145.5
Energy exp 5300kcal
So basically it was another jolly solid day which is good because thats what i am here for, give the body a bit of a wake up call
Time for a good sleep
Cjw
Sent from my BlackBerry® wireless device
Dauphine stage 5 srm data
Time 5hrs 6min
Distance 211km
Speed av 42kmph
Elevation gain 3000m
Watts 289av
Heart rate 152av
Energy exp 5200kcal
Greeeaaaatttt training
All aboard the pain train for another day in the alps!!!
Cjw
Sent from my BlackBerry® wireless device
Friday, June 10, 2011
Dauphine stage 5
So to the race, i just assumed my usual role and stayed close to ivan at the front of the group to help him if required and when the hitters lit up the gas with a couple of km to go i realised unfortunately that the fatique from early in the stage had not completely left my aching pins and with ivan safely in the front i sat up to save some bullets for tomorrows very very very difficult mountain stage. I hope a day that should not have the same crazyness of today on my part and a day where i can contribute alot more to the team. It certainly is a relief to have solved this allergy issue that is for sure.
I think the most exciting developement of the day was the clearly evident return of condition for our tour de france captain ivan baSso. He had no trouble staying with the big favourites and rest assured he is going to keep getting alot stronger in the coming days and weeks in training and show why he is such a great cyclist.
So pretty excitning day on all fronts as it certainly finished alot better than it started i am looking forward to getting stuclk into it tomorrow.
Cjw
Sent from my BlackBerry® wireless device
Thursday, June 9, 2011
No Exit (but not in MaxL)
Introduction
In “No Exit”, that French existentialist philosopher had it wrong, or he would have had he confined his thoughts to the awesomeness that is Essbase’s MaxL. Or, to paraphrase that other French philosopher, had he cultivated a MaxL garden, life might not have seemed so bleak.Surely when Sartre wrote “Hell is other people” he was just frustrated with the way MaxL (we know that all philosophers are at heart Essbase hackers, and all Essbase hackers are at heart philosophers – I’m not reaching too much, am I?) handles exiting out of a script, especially when there is an error.
Error handling in MaxL pre 11.1.2
The iferror and define label keywords have been in MaxL since almost the very beginning (I think they came in in Essbase 7, although MaxL got its first start in Essbase 6.5 – anyone who knows differently please write in care of this address).iferror
To quote My Very Favorite Bit of Essbase Documentation (MVFBED) aka the Tech Ref, iferror can trap:- Errors in MaxL statement execution
- Errors in MaxL Shell command execution, including:
- Errors in spool on/off, such as permission errors
- Errors in set column_width, such as invalid widths
- Errors in script nesting, such as permission errors or nonexistent include files
Note that MaxL is not going to trap data or dimension load errors. ‘Twould be nice if it could, but it doesn’t. So it goes.
define label
iferror branches to a label as defined, logically enough, by the define label keywords.Two great tastes that taste great together
Use iferror to branch to a label and then immediately quit the script; those labels are created with define label. Simple, right?A practical example
When I write MaxL code, I want the script to stop if it hits some kind of monumental error as continuing a process that has badly failed will likely only make things worse.The iferror statement only tests the precedent statement for error, so unlike more sophisticated languages MaxL can’t just declare error handling on and a single place to catch the errors. Remember, an statement that results in error followed by a successfully executed statement clears the error state.
What I end up doing is literally sticking an iferror after every statement. Yes, every statement. It looks ugly but it works (sort of the story of my coding life). Here’s an example:
/*
Purpose: Run calcs
Written by: Cameron Lackpour
Modified: A long time ago
Notes:
*/
/* Log in to Essbase */
login admin password on localhost ;
iferror "ErrorHandler" ;
/* Define STDOUT and STDERR outputs */
spool stdout on to "c:\\Automation\\Sample\\MaxLLog\\mshSample.log" ;
iferror “ErrorHandler” ;
spool stderr on to "c:\\Automation\\Sample\\MaxLError\\mshSample.err" ;
iferror "ErrorHandler" ;
/* only supervisors and developers may connect */
alter application Sample disable connects ;
iferror "ErrorHandler" ;
/* Run calculations */
execute calculation Sample.Basic.AdminAgg ;
iferror "ErrorHandler" ;
execute calculation Sample.Basic.OrgAgg ;
iferror "ErrorHandler" ;
/* Allow all users to connect */
alter application Sample enable connects ;
iferror "ErrorHandler" ;
/* Error handler label */
define label "ErrorHandler" ;
/* Leave the MaxL shell */
logout ;
exit ;
A better way in 11.1.2.x
There’s nothing new with iferror and define label as they work the same way as before.However, the exit statement now has a new piece of functionality that it didn’t have before 11.1.2 – the ability to pass a condition code on exit.
exit
Per MVFBED, “You can optionally set the exit status variable to a non zero argument to return an exit status to the parent shell.”The impact
What does that mean? Your calling script language is (hopefully) more sophisticated than MaxL in its error handling and branching (I’m looking at you VBScript, PowerShell, and Perl) and can react to the error code(s) you define. Wouldn’t it be nice if your calling code tried to fix things, or at least told you where (and maybe why) everything went pear-shaped instead of just saying, “It don’t work”?Some easy examples first
iferror and define label but no defined exit code
Here’s an example that tries to connect with a bad password (an extra s in the word “password”):/* MaxL with non-specific error codes */
/* Login with bad password */
login admin passsword on localhost ;
iferror 'ErrorHandler' ;
/* Create label */
define label 'ErrorHandler'
/* Quit MaxL */
exit ;
Run and response:
Essbase MaxL Shell 64-bit - Release 11.1.2 (ESB11.1.2.0.0B444)
Copyright (c) 2000, 2009, Oracle and/or its affiliates.
All rights reserved.
MAXL> login admin password on localhost ;
ERROR - 103 - Unexpected Essbase error 1051293.
ERROR - 1051293 - Login fails due to invalid login credentials.
MaxL Shell completed with error
When I interactively test the Windows OS errorlevel variable, I get a value of 2.
E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\bin>echo %erro
rlevel%
2
Successful MaxL executions result in 0 errorlevels, failures a 2. So yes, I know something went bad, but I have no idea what that is just based on the error code.
iferror and define label with a defined exit code
Failure example
Two new things are in this code:- There are two error handlers – one for bad logins, one for everything else.
- The error handler that ties to a bad login gets an error code of 10.
Note that if there is no error of any kind, the code will exit with no defined error code.
/* MaxL with specific error codes */
/* Login with bad password */
login admin passsword on localhost ;
iferror 'BadLogin' ;
/* Create label for generic error handler */
define label 'GenericErrorHandler';
/* Quit MaxL */
exit ;
/* Create label just for login errors */
define label 'BadLogin' ;
/* Quit MaxL with a 10 error code */
exit 10 ;
Run and response:
E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\bin>essmsh e:\
tempdir\errortest.msh
Essbase MaxL Shell 64-bit - Release 11.1.2 (ESB11.1.2.0.0B444)
Copyright (c) 2000, 2009, Oracle and/or its affiliates.
All rights reserved.
MAXL> login admin passsword on localhost ;
ERROR - 103 - Unexpected Essbase error 1051293.
ERROR - 1051293 - Login fails due to invalid login credentials.
MaxL Shell completed with error
When I interactively test the Windows OS errorlevel variable, I get a value of 10.
E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\bin>echo %erro
rlevel%
10
Success example
/* MaxL with specific error codes *//* Login with bad password */
login admin password on localhost ;
iferror 'BadLogin' ;
/* Create label for generic error handler */
define label 'GenericErrorHandler';
/* Quit MaxL without a predefined error code */
exit ;
/* Create label just for login errors */
define label 'BadLogin' ;
/* Quit MaxL with a 10 error code */
exit 10 ;
Run and response:
E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\bin>essmsh e:\
tempdir\errortest.msh
Essbase MaxL Shell 64-bit - Release 11.1.2 (ESB11.1.2.0.0B444)
Copyright (c) 2000, 2009, Oracle and/or its affiliates.
All rights reserved.
MAXL> login admin kscope2011 on localhost ;
OK/INFO - 1051034 - Logging in user [admin@Native Directory].
OK/INFO - 1241001 - Logged in to Essbase.
MaxL Shell completed
When I interactively test the Windows OS errorlevel variable, I get a value of 0.
E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\bin>echo %erro
rlevel%
0
Putting it all together
I will concede in advance that perhaps the below level of error trapping and surfacing of where the error occurred is a bit over the top, but regardless, it certainly traps everything. Yes, this might be a good time to invest effort in MaxL + Perl as an alternate way to do error trapping. However, this is a MaxL post, not a MaxL Perl module post, so onwards, ever onwards./*
Purpose: Connect, kick non-admins out, and surface errors based
on action.
Written by: Cameron Lackpour
Modified: Right now
Notes: * Illustrate use of exit
*/
/* Log in to Essbase */
login admin password on localhost ;
iferror "BadLogin" ;
/* Define STDOUT and STDERR outputs */
spool stdout on to "c:\\Automation\\Sample\\MaxLLog\\mshSample.log" ;
iferror "BadLogFile" ;
spool stderr on to "c:\\Automation\\Sample\\MaxLError\\mshSample.err" ;
iferror "BadErrorFile" ;
/* only supervisors and developers may connect */
alter application Sample disable connects ;
iferror "CouldNotDisable" ;
/* Run calculations */
execute calculation Sample.Basic.AdminAgg ;
iferror "AdminAggError" ;
execute calculation Sample.Basic.OrgAgg ;
iferror "OrgAggError" ;
/* Allow all users to connect */
alter application Sample enable connects ;
iferror "CouldNotEnable" ;
/* Leave the MaxL shell */
/* This is where the script exits if there is no error. */
logout ;
exit 0 ;
/* Create label for login errors */
define label "BadLogin" ;
/* Quit MaxL with a 10 error code */
exit 10 ;
/* Create label for log file errors */
define label "BadLogFile" ;
/* Quit MaxL with a 20 error code */
exit 20 ;
/* Create label for error file errors */
define label "BadErrorFile" ;
/* Quit MaxL with a 30 error code */
exit 30 ;
/* Create label for disable connects errors */
define label "CouldNotDisable" ;
/* Quit MaxL with a 40 error code */
exit 40 ;
/* Create label for AdminAgg calc script errors */
define label "AdminAggError" ;
/* Make sure that connections are enabled */
alter application Sample enable connects ;
/* Quit MaxL with a 50 error code */
exit 50 ;
/* Create label for OrgAgg calc script errors */
define label "AdminAggError" ;
/* Make sure that connections are enabled */
alter application Sample enable connects ;
/* Quit MaxL with a 60 error code */
exit 60 ;
/* Create label for enable connects errors */
define label "CouldNotEnable" ;
/* Quit MaxL with a 70 error code */
exit 70 ;
Example of a bad directory
Run and response:E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\bin>essmsh e:\tempdir\maxlwithexit.msh
Essbase MaxL Shell 64-bit - Release 11.1.2 (ESB11.1.2.0.0B444)
Copyright (c) 2000, 2009, Oracle and/or its affiliates.
All rights reserved.
MAXL> login admin password on localhost ;
OK/INFO - 1051034 - Logging in user [admin@Native Directory].
OK/INFO - 1241001 - Logged in to Essbase.
essmsh error: Unable to open log file c:\\Automation\\Sample\\MaxLLog\\ms
Sample.log
MaxL Shell completed with error
When I interactively test the Windows OS errorlevel variable, the OS returns 20.
E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\bin>echo %
rrorlevel%
20
Fix the directory
I changed the directories that didn’t exist to ones that did. So this:spool stdout on to "c:\\Automation\\Sample\\MaxLLog\\mshSample.log" ;
iferror "BadLogFile" ;
spool stderr on to "c:\\Automation\\Sample\\MaxLError\\mshSample.err" ;
iferror "BadErrorFile" ;
became this:
spool stdout on to "e:\\TempDir\\mshSample.log" ;
iferror "BadLogFile" ;
spool stderr on to "e:\\TempDir\\mshSample.err" ;
iferror "BadErrorFile" ;
Good directory, bad calc script, actually managed to turn connections back on
I’m not going to give every example of what might happen, but this time the code has managed to log in, create log files for STDOUT and STDERR, and disable connections.However, when it came to run the calc AdminAgg, the script failed because the calc script doesn’t exist.
NB – Based on the error branch, the code can do specific things on error. In the code, I make sure that errors in running calcs always re-enable connections to the Sample application. Without these specific error codes, it would be impossible to know that connections need to be enabled.
Run and response:
E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\bin>essmsh e:\tempdir\maxlwithexit.msh
Essbase MaxL Shell 64-bit - Release 11.1.2 (ESB11.1.2.0.0B444)
Copyright (c) 2000, 2009, Oracle and/or its affiliates.
All rights reserved.
MAXL> login admin kscope2011 on localhost ;
OK/INFO - 1051034 - Logging in user [admin@Native Directory].
OK/INFO - 1241001 - Logged in to Essbase.
MAXL> alter application Sample disable connects ;
OK/INFO - 1054014 - Database Basic loaded.
OK/INFO - 1054014 - Database Xchgrate loaded.
OK/INFO - 1054014 - Database Interntl loaded.
OK/INFO - 1054014 - Database Sparse loaded.
OK/INFO - 1051061 - Application Sample loaded - connection established.
OK/INFO - 1054027 - Application [Sample] started with process id [7796].
OK/INFO - 1056013 - Application Sample altered.
MAXL> execute calculation Sample.Basic.AdminAgg ;
ERROR - 1012500 - The requested calc script [AdminAgg] not found.
MAXL> alter application Sample enable connects ;
OK/INFO - 1056013 - Application Sample altered.
MaxL Shell completed with error
When I interactively test the Windows OS errorlevel variable, the OS returns 50.
E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient-32\bin>echo %e
rrorlevel%
50
Were I automating this code for real I would use the calling code to query %errorlevel% and then send specific emails based on the error code. In this case, I could quickly be informed that there was something wrong with the calc script AdminAgg instead of having to wade through tedious log files trying to figure out what went wrong.
Conclusion
Adding the ability to pass on an error code to the exit keyword seems trivial, but it can provide a lot of information to automation code and make debugging production issues that much easier. Why aren’t you using it?Popular Posts
-
EPM in Massachusetts Another EPM meetup, another success. Monotonous, isn’t it? Here’s Mark Rinaldi and Norman Williams kicking off th...
-
What happens when a good idea goes bad? Consider Metro-North’s “Quiet Car” initiative. Sixteen years ago a group of regular commuters on Am...
-
With the arrival of winter, now is the time to be sure you’re ready to stay mobile, whatever Mother Nature may throw at us. Here are a few ...
-
I am an installation drama queen Corvus brachyrhynchos is a delicious meal, especially when garnished with a rosemary sprig. Why would I...
-
Introduction Writing this blog post was an absolute stinker. It really is a pity (at least from my bank account’s perspective) that I don’t...
-
If you’re not here, you don’t know what you’re missing Sunday at ODTUG Kscope14 is where Oracle let down their collective hair and tell us, ...
-
Quiet day here in burgos today. It was one of those days where the 175km seemed to pass in the blink of an eye. Infact it was not until we c...
-
Riders on Metro-North just got an early holiday gift from the railroad and CDOT: a bright, shiny new train set… not toy, but real! We’ve...
-
Tired of paying $4+ a gallon for gasoline? Well, your pain has just begun. For decades we’ve lived (and driven) in denial, somehow assum...
-
A triumph, a warning, and a lament Yes, it’s another one of my “All of Gaul is divided into three parts” posts. Or maybe it’s my Descartesi...