June 6, 2022

How MEDITECH's Operating System interprets programming functions

The Meditech MAGIC programming language (both MAGIC and C/S) includes many different functions.  Most of these functions are represented by a single letter, although there are some exceptions to that rule.  The Meditech Operating System interprets these functions by recognizing the first letter of the function, then ignoring each subsequent alphanumeric character until the open parentheses are found.  Then the number of arguments enclosed in the parentheses determines how the function will behave.

For instance, L is the Length/Locate function.  Its behavior is determined by the number of arguments provided in parentheses.  With one argument, it performs the Length function.  With two arguments, it performs the Locate function (which will return the Length of Argument A if Argument B is not located within Argument A).  You could however write your command in any number of different ways:

L("HELLO","E")  Returns 1 since Argument B, "E", is located at position 1 in Argument A, "HELLO".

L("HELLO")  Returns 5 since Argument A is 5 characters long.

LENGTH("HELLO")  Again, this returns 5 since Argument A is 5 characters long.

LOCATE("HELLO")  Again, this returns 5 since Argument A is 5 characters long.

LMNOP("HELLO")  Once again, this returns 5 since Argument A is 5 characters long.

LOOK("HELLO","E") Returns 1 since Argument B, "E", is located at position 1 in Argument A, "HELLO".

In the last four examples above, the "L" is recognized as a valid MEDITECH MAGIC programming function.  The additional alphanumeric characters are ignored.  Then the arguments within the parentheses determine how the function behaves.

Using these unnecessary characters has come in handy at times to work around the various syntax checks that Meditech's software performs.  However, their NPR Report Writer syntax-checker software is becoming more and more thorough with each new release.

For instance, KILL(/TEMP) is not acceptable in the MAGIC NPR Report Writer Macro editor.  However, it is still acceptable in their C/S NPR Report Writer (as of Ring Release 5.5). 

Great care should be taken whenever using several different MEDITECH programming functions (K, V, O, etc).

There are several functions beginning with "Z" (such as "ZR" and "ZS") that actually begin with two characters instead of the customary single character.

Topics: MEDITECH, Magic System, NPR Report, CS System

You Might Also Enjoy

@Translation.message is an NPR Programming Macro that can be used in NPR Report Writer ...

@Pgm.name is an NPR Programming Macro that can come in handy, especially when using the ...

This is a list of the keystrokes available in Meditech's NPR (MAGIC) Macro editor. Some ...

You can use the following steps to write data to your Windows clipboard from an NPR ...

Sometimes an NPR Report crashes and a screen pops up with some information about the ...