Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 02-07-2005, 02:19 AM   #1 (permalink)
Hi.Im.New's Avatar
 
True Techie

Join Date: Dec 2004

Posts: 113

Hi.Im.New is on a distinguished road

Default Mumps Prog

In M programming the follow lines:

SET who=""
x FOR Set who=$ORDER(^STAFF(who)) QUIT:who="" DO
. IF who="" QUIT
. FOR L=1:1:end DO
. . SET temp=^STAFF(who,L)
. . Write !,who,?25, $P(temp,"|",1),?45,$P(temp,"|",2)
. . Write ?60,$P(temp,"|",3)
QUIT


goes
^STAFF
| | |
Smith Rodey Peters


and lets say in the global STAFF you have 3 subscripts
(Smith,John) (Rodey,Jim) and finally (Peters,James)
now since order function returns the next avaliable subscript at the level specified and since it first finds the next avaliable subscript at the level specified ... itd first find Peters cause thats the next avaliable name cause P is lower than S in the ansii table right but when its done i dont understand how it gets to Rodey next or how who on the line where the x is increments to the next one... i know it doesnt stop but when its done with the first name how does it know to increment?
Hi.Im.New is offline  
Old 12-13-2005, 03:39 PM   #2 (permalink)
 
Newb Techie

Join Date: Dec 2005

Posts: 6

shervieux

Default

I am not sure I understand your question, but I will try to answer on how I am reading it. I have been a Mumps programmer for well over 10 years.

I am going to analyze your code. Maybe this will help you understand. PLease note I had to break apart your lines to put in my comments....


In M programming the follow lines:

SET who="" < - Intializes the variable who to null
x FOR Set who=$ORDER(^STAFF(who)) < - FOR means you are going to do a loop. Set who=$ORDER(^STAFF(who)) . on each cycle of the for loop, the $ORDER will change the value of who to the next subscript. Note, since subscripts are separated by commas, then you are only looping on last names.


QUIT:who="" DO < - Here, you will QUIT the FOR loop when you run out of last names. When where are no more last names, who becomes null. Otherwise if who contains a last name, the argumentless DO will tell the routine to drop to the dot structure code. The dot structure code only gets excuted aslong as who is not null

. IF who="" QUIT < - This appears to be redundant code and not needed

. FOR L=1:1:end DO
. . SET temp=^STAFF(who,L) < - These 2 lines are not correct... Note, since you mentioned your global is set up as ^STAFF(last,first) - then you should have done
. set FIRST=""
. FOR SET FIRST=$ORDER(^STAFF(who,FIRST)) Q:FIRST="" D
.. SET temp=^STAFF(who,FIRST)



. . Write !,who,?25, $P(temp,"|",1),?45,$P(temp,"|",2)
. . Write ?60,$P(temp,"|",3)
QUIT

Now, if your global looks like:
^STAFF(JONES,JIM)=123 WEST STREET|CITY|STATE

Your output would be:

JONES 123 WEST STREET CITY STATE



Since you are new to MUMPS, I suggest going to Amazon.COM and getting your self:

The Complete MUMPS : An Introduction and Reference Manual for the MUMPS Programming Language [FACSIMILE] (Paperback)
by John Lewkowicz

(4 customer reviews)
--------------------------------------------------------------------------------

This is an awesome book for newbies and a good reference for the well experienced programmer. Note, you can find some good information on Intersystems Cache if you are working in a Cache environment. Cache is nothing more than MUMPS on steriods. While the older versions of MUMPS only allowed MUMPS code, cache allows calls and integration with other programming languages, has a nice visual front end, you can do web programming with it. All the behind the scenes code is in MUMPS.

MUMPS is an ever shrinking community, so you probably will not get much replies. It is really not used outside of the banking and healthcare industry. Cache is bringing mumps back to life, with all its nice features and faster processing. Plus, unlike MUMPS, you can download a fully operational free version from intersystems, and it will run on Linux, Unix, windows, Mac OSX, Open VMS. Mumps only ran on Open VMS and Unix - unless another company ported it over to another Operating System. Since Intersystems owns all the rights to MUMPS and the original founders are no longer in business, most open source projects have been abandoned. Intersystems has done a good job with ownership, patches, updates, and ensuring cross platform support.

Hope this helps....
shervieux is offline  
Old 12-13-2005, 05:01 PM   #3 (permalink)
 
Newb Techie

Join Date: Dec 2005

Posts: 6

shervieux

Default

Flow Chart Generators....

Hello,

I have been googling and found a bunch of flow chart generators that will take programming code and produce a flowchart from the code. Now, while there are some good ones out there, none of the ones I found support MUMPS. Most do your popular languages, such as Visual anything, Java, Perl, PHP, etc.

I have been a mumps programmer for years, but I have to train a new programmer (she never programmed in any language). This new programmer thinks visually in terms of flow charts. Does anyone know of a flow chart program that will interpret mumps and create a flow chart. Would be helpful to me as well, since I must now support a rather poorly designed system where the variables are generic like (x,n) rather than meaningful like (lname); and the entire system is spaghetti code and also dumps variables to the operating system then brings them back up - so most variables are %something (like %x, %xx, %n).

I would like to teach whoever wrote the system proper coding techniques. I don't know how they supported it, never mind someone who has to pick up after them....
shervieux is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On