Solved

Automate MUMPS Console commands

Posted on 2007-03-17
4
904 Views
Last Modified: 2013-11-15
I am looking for a way to process multiple MUMPS commands within MSM.EXE to perform a task. I have currently had to repeatedly type the same commands into the MSM.EXE console over and over, and would like to automate this process. It would also be useful if I could pass in custom variables into the console, such as paths, which may occasionally change when the solution is used on different host environments. I appreaciate this may not be possible but it would be a nice to have.

I am a complete novice to MUMPS and am sure there is probably an easy solution to what I ask?

Thanks in advance,

Ben
0
Comment
Question by:Benjamin297
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
clockwatcher earned 500 total points
ID: 18784234
What exactly do you mean when you say you have to type multiple commands into the console?  What commands are you typing in?  Why not put them in a routine and execute the routine?

I don't have an old copy of MSM around but I believe you should be able to create a routine with:

>ZREMOVE
>MYROUT     ; enter the commands you use below
>     D ^something
>     D ^anotherthing
>     W "I'm done",!
>ZSAVE MYROUT
>

Replace the five spaces above with a TAB.   If you can't create a routine directly from the console, then I think

>X ^%

or

>X ^%G

should get you an editor that you can use to create the routine.  If I had an old copy around, I could be of more help.  I haven't been on a dos-based MSM system in about 7 years and the only thing I can find now is MSM workstation which is different.

Once you've got your routine saved.   Execute it with

>D ^MYROUT

As for different host environments and variables, you'd probably want to set your variables in globals and then reference them in your code.

>SET ^PATH="c:\somewhere\on\this\machine.txt"
>DO ^MYROUT

where MYROUT looks like:

MYROUT  ;
     WRITE ^PATH
     D SOMETHING^WITH(^PATH)
     Q
0
 
LVL 1

Expert Comment

by:LarryAndro
ID: 18857707
You should check out AutoHotKey, a macro program that is very powerful!  It might better be called a programming languange.  www.autohotkey.com.
0
 
LVL 1

Expert Comment

by:LarryAndro
ID: 19124751
One additional suggestion as to editing M routines: do it in an ASCII text editor like UltraEdit.  I think Notepad will work also.  MS Word would work, but it inserts too many auto-corrections that trip you up, unless you've turned off the offending auto-corrections.  Any text editor that stores ASCII text, and leaves a tab stored as a tab, should work.  

Using a text editor is much better than X ^%, etc, as they are full-screen editors you already know how to use, offer much better ability to copy/cut/move, etc that the bare-bones editors in MSM!

But, creating the code is one thing.  How to move it into M?  Here are the steps...

* Copy the M code in the text editor to clipboard.
* Enter 'ZR<return>' at the programmer's prompt in MSM.
* Paste clipboard.
* Enter 'ZS routineName<return>'

The first few times you do the above, I recommend saving the code in a scratch routine name.  Almost always the pasted text technique works quite well, not dropping characters no matter how long the routine is.  But, on an occasional system, this technique doesn't work.

To carry this technique further, you can always calculate rudimentary checksums to verify the process works OK.  If interested, let me know, and I will paste in here a line or two of M code that will calculate checksums for M routines.

Hope this makes sense.
0
 

Expert Comment

by:xavis67
ID: 21254847
in background use:

JOB ^MYROUTINE
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question