Difference between revisions of "Hello world and hello Texas from Database"

From VistApedia
Jump to: navigation, search
Line 5: Line 5:
 
MUMPS>write "hello " write $P(^DIC(5,48,0),"^",1)
 
MUMPS>write "hello " write $P(^DIC(5,48,0),"^",1)
 
  hello TEXAS
 
  hello TEXAS
 +
 +
What the above hello TEXAS line does:
 +
 +
* Invoke the $piece command which is similar too but not exactly like the substring command in many other languages.
 +
* The ^ indicates that this is not a local variable, that it is looking for data on disk that others can see.
 +
* DIC indicates look in the data dictionary in file 5, field 48, item 0 with the ^ in this case being a delimiter and return only 1 token.

Revision as of 15:57, 9 February 2010

Install with something like Astronaut. Get to a GT.M prompt. 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:

  • Invoke the $piece command which is similar too but not exactly like the substring command in many other languages.
  • The ^ indicates that this is not a local variable, that it is looking for data on disk that others can see.
  • DIC indicates look in the data dictionary in file 5, field 48, item 0 with the ^ in this case being a delimiter and return only 1 token.