Dynamic Maxl scripts using environment variables


I was creating some automation scripts in Essbase and found it quite tedious to change a bunch of Maxls and bat files when I move from DEV to QA and to Prod.
I made the bat files dynamic by adding local variables

REM # ———————————————————————————————————————-
REM # — Main directories & Application definition —
REM # ———————————————————————————————————————-

SET BASE_DIR=C:Cera_Hyperion_scripts
SET OUTBOUND_SERVER=CeraOutserver
SET ESSENV=Dev

But the issue was to make Maxl scripts dynamic, after lot of googling I stumbled upon Matt Milella’s blog.
I tried the same on 11.1.2 and however I couldn’t make that one work because I was invoking Maxl using essmsh not msh. So I took the essence of what was given there and added some local variables in my Bat script as follows.

REM # ———————————————————————————————————————-
REM # — Maxl definitions —
REM # ———————————————————————————————————————-

SET essUserName=essadmin
SET essPassword=esspassword
SET essServerName=ceraessbase
SET maxlBaseDir=C:\Cera_Hyperion_scripts

I changed my Maxl scripts to use these variables 
/* login with username and password */
login $essUserName $essPassword on $essServerName;
iferror ‘Finish’;
/* Spool the results of this extract process to a log file */
spool on to $maxlBaseDir\logs\Data_Export.log; 
set timestamp on;
iferror ‘Finish’;
Yes it is $maxlBaseDir (even I was skeptic $ and that too in windows, I tired %maxlBaseDir% and that one failed)
Then I called this maxl using essmsh login.msh in the bat file and it worked fine.
This will save lot of time when you are migrating between servers.
HTH

Update on usage of (quotes and back slashes)


Something crazy (or me being crazy) I learned.

Usage of quotes, backslashes in MaxL

We all know or learned that for Windows you’ve to use \ as an escape character for folder paths.

Try it with single quote and single slash (‘,) it’ll still work.

for e.g 

spool on to ‘D:TempOutput.txt’ will work same as spool on to ‘D:\Temp\Output.txt’

However if you are someone like me who always use double quotes(“), so going by that rule on error write to “D:\Temp\Output.txt” and on error write to “D:TempOut put.txt” both works fine.

but do if you use ” with (single backslash) in an import statement it will not work!!!! (if you are using a

What I learned is if you are using ” then always use \ (on Windows)


About Celvin Kattookaran

I’m an EPM Consultant, my primary focus is on Hyperion Planning and Essbase. Some of you from Hyperion Support team might recognize me or have seen my support articles, I was with the WebAnalysis Support Team. I'm an Independent Consultant with “Intekgrate Corporation” based out of Aurora office. I’m from God’s Own Country (Kerala, India), lived in all southern states of India, Istanbul and Johannesburg (and of course United States). I’m core gamer :) and an avid reader. I was awarded Oracle ACE Director for my contributions towards EPM community.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 thoughts on “Dynamic Maxl scripts using environment variables