EPMA Batch Script Utility Error Handing

I have a somewhat complicated process that I automated to make my life easier for those late nights of work.  I am notorious for missing fairly simple things at any time after 7PM.  I decided (in the AM) that I would remedy the solution.

A script I was running last night was dying and I didn’t know where.  It validated fine, but would cancel and the logs told me nothing.  It would just…die.

To get around this, I added some error handling to the script.  For whatever error returns, a popup message will show regarding what the error exactly was.

Background notes on this code:
1.  Located on the Essbase server, but the Batch Script Utility is additionally installed on this server to be able to run EPMA and MaxL scripts together (a later blogpost).
2.  Although not needed to run the script via a batch file normally, I have inserted a “CALL” in front of the normal script needed to run a text file in the utility.  It is needed to get the message box to show with the error.
3.  I am using the person logged into the server’s username to send a message to via a server variable that should already be established on that machine (in other words, it should work as is on your server without any changes needed).

Batch script code:
CALL epma-batch-client.bat -C”D:\EssbaseScripts\EPMAScripts\EPMA_EntyAcct.epma” -R”D:\EssbaseScripts\Logs\EPMA_EntyAcct.log” -LOn
IF ERRORLEVEL 0 msg %username% “Script ran successfully.”
IF ERRORLEVEL -1 msg %username% “A general error occurred.”
IF ERRORLEVEL 1 msg %username% “A validation error occurred.”
IF ERRORLEVEL 100 msg %username% “A parse error occurred.”
IF ERRORLEVEL 4 msg %username% “Command line error.”
IF ERRORLEVEL 1501 msg %username% “An application copy error occurred.”
IF ERRORLEVEL 1502 msg %username% “A dimension copy error occurred.”
IF ERRORLEVEL 101 msg %username% “Create application failed.”
IF ERRORLEVEL 102 msg %username% “Create dimension failed.”
IF ERRORLEVEL 103 msg %username% “Create member failed.”
IF ERRORLEVEL 110 msg %username% “Create association failed.”
IF ERRORLEVEL 2100 msg %username% “Unknown error occurred.”
IF ERRORLEVEL 201 msg %username% “Delete application failed.”
IF ERRORLEVEL 202 msg %username% “Delete dimension failed.”
IF ERRORLEVEL 203 msg %username% “Delete member failed.”
IF ERRORLEVEL 210 msg %username% “Delete association failed.”
IF ERRORLEVEL 1602 msg %username% “Detach dimension failed.”
IF ERRORLEVEL 303 msg %username% “Exclude member failed.”
IF ERRORLEVEL 404 msg %username% “Execute data sync failed.”
IF ERRORLEVEL 405 msg %username% “Execute deploy failed.”
IF ERRORLEVEL 406 msg %username% “Execute dimension sync failed.”
IF ERRORLEVEL 407 msg %username% “Execute import failed.”
IF ERRORLEVEL 409 msg %username% “Execute redeploy failed.”
IF ERRORLEVEL 412 msg %username% “Execute validation failed.”
IF ERRORLEVEL 500 msg %username% “Exit failed.”
IF ERRORLEVEL 602 msg %username% “Include dimension failed.”
IF ERRORLEVEL 603 msg %username% “Include member failed.”
IF ERRORLEVEL 703 msg %username% “Insert member failed.”
IF ERRORLEVEL 800 msg %username% “Login failed.”
IF ERRORLEVEL 900 msg %username% “Logout failed.”
IF ERRORLEVEL 1903 msg %username% “Move member failed.”
IF ERRORLEVEL 2000 msg %username% “Option set failed.”
IF ERRORLEVEL 1000 msg %username% “Quit failed.”
IF ERRORLEVEL 1102 msg %username% “Remove dimension failed.”
IF ERRORLEVEL 1103 msg %username% “Remove member failed.”
IF ERRORLEVEL 1803 msg %username% “Rename member failed.”
IF ERRORLEVEL 1200 msg %username% “Set failed.”
IF ERRORLEVEL 1702 msg %username% “Share dimension failed.”
IF ERRORLEVEL 1301 msg %username% “Update application failed.”
IF ERRORLEVEL 1308 msg %username% “Update dimension association failed.”
IF ERRORLEVEL 1302 msg %username% “Update dimension failed.”
IF ERRORLEVEL 1303 msg %username% “Update member failed.”
IF ERRORLEVEL 1400 msg %username% “Variable failed.”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s