Essmsh/OdiOSCommand/Echo Trick


Hi all, today’s post is a very simple but useful trick using ODI and Essmsh command. As you know, the MaxL Shell (essmsh) is a pre-parser mechanism for entering MaxL statements. In order to use it, first you need to log into a server:

1_essmsh

After you login, you may start issuing MaxL commands against that specific host. But this is an interactive login, where you need to manually specify the user/password/host. Fortunately essmsh contains some options that allow us to pass the login (-l) and the server (-s) as parameters. It looks like this:

essmsh -l ServiceUser password -s ANY.SERVER.COM

This is great, but imagine that you want to login and execute some essmsh commands to automate a specific process. Imagine that after the login you want to run the following commands:

  • set message level error;
  • display partition on database CONWF_M.WrkForce advanced;

Here is where the “echo” trick comes in. essmsh have another option (-i) that starts a MaxL session which reads from <STDIN>, piped in from another program. So basically you can do the following:

echo set message level error; display partition on database CONWF_M.WrkForce advanced;| essmsh -l ServiceUser password -s ANY.SERVER.COM -i

Now this single OS command will connect to a server, login and execute the set message and display commands. Very simple, but very powerful!

It gets even better if you add ODI to the game. ODI is extremely flexible to develop this kind of automation processes. Here is what it would look like. Create an ODI procedure and go to “Command on Source” Tab. Select the “Schema” where you want to execute your essmsh commands:

2_essmsh

No code is needed here, since we will just use it to retrieve the Essbase connection information, like user/pass/server/app/database. On the “Command on Target” tab, you may add something like this:

3_essmsh

Here we are calling a login on essmsh and we are “echoing” some MaxL commands against an Essbase application/database using the –i parameter. The output of this command will be redirected to the -OUT_FILE where you may check it or use it in another process. Very handy and easy for a lot of Essbase automation with ODI.

Hope you liked this quick tip! See ya!

7 Responses to “Essmsh/OdiOSCommand/Echo Trick”

  1. Hi Rodrigo,

    There’s also a version of the login command that you can specify the username/password/server with, if it helps. For example, instead of just “login;” you could do login USERNAME on SERVER identified by PASSWORD;” — would that help simplify things in this example?

  2. Jason W. Jones Says:

    Not sure if my earlier comment went through, but I just wanted to point out that you can use a full login command to be able to specify the username/password/server all in one go, without worrying about the interactive aspect of things…

    • Jason W. Jones Says:

      Ah, it worked finally! As an example of my earlier comment, you could do “login USERNAME on SERVERNAME identified by PASSWORD” (you might have to double check this syntax for me) but you’d be able to specify the values without worrying about piping input in. Not sure if this helps or not but it might…

      • Hi Jason! Thanks for the comments! Yes, we could use “login ServiceUser password on ANY.SERVER.COM;” but then it would necessarally require to “pipe” it to essmsh. In your example it would be something like this I guess:

        echo login ServiceUser password on ANY.SERVER.COM; |essmsh -i

        In my example, the connection is done without any “piping”, only using:

        essmsh -l ServiceUser password -s ANY.SERVER.COM

        Its only one command to login to the server. Than I “pipe” all the other commands that I want to execute in that session over it.

        But both ways will work. The trick here is to know that you can pipe multiple commands in one single OS command and automate a lot of Essbase stuff only using ODI and this technique 🙂

  3. Hi My Friend,

    How are you ?

    follows tip script logon in essbase and scrip sql for drop application teste for the product , case is important for this post.

    $ESSBASEPATH/bin/essmsh .mxl
    After > > > login $ESS_USERID $ESS_PASSWORD on $ESS_SERVER:10023;

    Erase application default this product :

    select app_id from hspsys_application where name = ‘PLANTEST’;
    * select * from hspsys_app_cluster_dtl where app_id = 1;
    (the app_id returned from the above query, eg. app_id = 1)
    * delete from hspsys_app_cluster_dtl where app_id = 1;
    * delete from hspsys_datasource where app_id = 1;
    (This will delete the datasource used by the specific application)
    * delete from hspsys_properties where app_id = 1;
    * delete from hspsys_application where app_id = 1;

    {}s.

  4. Chris Rothermel Says:

    I like the source/target tip and I’ve found it very handy.

    That pipe trick is very cool. I used to dynamically create the MaxL code within an ODI procedure (odi create file) and then have a separate ODI step to call the file and trap the results with -ODI_OUT. Your solution is better because it brings in all of the steps into a procedure which makes less clutter in a package.

    The new tip for me is the use of the “echo” -i. So now I need to remember the syntax and put the commands, then the | (pipe symbol) and then the -i.

    Nice combo of tricks. Thank you!

  5. […] more elaborate, but for the sake of this example, it will work. Basically, I’m using the echo trick to call two command lines at once. The first one I run “cloud_env.bat”, which will set my cloud […]

Leave a comment