Difference between revisions of "Hello world and hello Texas from Database"
From VistApedia
(editing for clarity) |
|||
Line 1: | Line 1: | ||
− | Install with something like Astronaut. Get to a | + | Install VistA with something like Astronaut. Get to a Mumps prompt: choose item 3 if you are using VistA Commander. |
MUMPS>write "hello world" | MUMPS>write "hello world" | ||
Line 8: | Line 8: | ||
What the above hello TEXAS line does: | What the above hello TEXAS line does: | ||
− | * | + | * Invokes the $P[iece] command, which is similar to but not exactly like the substring command in many other languages. |
− | * The ^ indicates that this is not a local variable | + | * The ^ indicates that this is not a local variable; MUMPS will look for a [[Global~|global]] stored on disk and visible to other users. |
− | * DIC | + | * DIC's subscripts say to look in the data DICtionary in file 5, field 48, item 0, using the ^ in this case as a delimiter, and return the first piece. |
+ | * Since ^DIC(5,48,0)="TEXAS^TX^48^^1^1", MUMPS writes "TEXAS". |
Revision as of 18:25, 9 February 2010
Install VistA with something like Astronaut. Get to a Mumps prompt: choose item 3 if you are using VistA Commander.
MUMPS>write "hello world"
hello world
MUMPS>write "hello " write $P(^DIC(5,48,0),"^",1)
hello TEXAS
What the above hello TEXAS line does:
- Invokes the $P[iece] command, which is similar to but not exactly like the substring command in many other languages.
- The ^ indicates that this is not a local variable; MUMPS will look for a global stored on disk and visible to other users.
- DIC's subscripts say to look in the data DICtionary in file 5, field 48, item 0, using the ^ in this case as a delimiter, and return the first piece.
- Since ^DIC(5,48,0)="TEXAS^TX^48^^1^1", MUMPS writes "TEXAS".