Kernel & Toolkit APIs Banner [skip navigation]
Office of Information and Technology (OIT) Banner

XINDEX: Fatal M Errors (Hard MUMPS Errors)

These are unrecoverable errors that cause a program to fail if the commands are executed. It is possible, however, that these types of errors might exist in routines that run correctly. The error occurs (or may occur, depending on the underlying implementation) only when the errant commands are executed.

F—Bad Number

XINDEX can only check static numbers in code. It does not check the boundaries of the number, only that it is a legitimate number and not a string.

 


F—Bad WRITE syntax

This error is usually a WRITE argument misuse. The most common occurrence is due to a missing comma after the argument.

 


F—Block structure mismatch

These are potentially one of the most serious types of errors, and may lead to fatal runtime exceptions. However, examination of a number of routines indicates that a significant number of these errors are empty DO blocks. These are still potential logic errors, but do not cause runtime exceptions under Caché. The DO command, Section 8.2.3 of the standard, does not seem to have a provision for empty blocks, so this is an error.

Example

The following code extract from ENGET^DGRUGMFU is an example of this type of error:

ENGET() ;DETERMINE DIVISION TO GET SUBSCRIBERS
 ;
N I,J,X
       F I=1:1 X HLNEXT Q:HLQUIT'>0  D
       .S X(I)=HLNODE,J=0
       ..F  S J=$O(HLNODE(J)) Q:'J  S X(I,J)=HLNODE(J)

Because there is no DO command before the double dot syntax, that line is never executed.

 


F—Call to missing label 'label' in this routine

In this case, reference is made to a label inside a routine that is not (or no longer) present. There could be many reasons for this. The most likely candidate being removal of code that is no longer used.

 


F—Call to this label/routine (MISSING LABEL)

This is the complementary situation in which code calls a label/routine that is no longer present on the system. Again, there are a number of reasons why this might occur, including typographical errors and removal of code that is no longer used.

 


F—Command missing an argument

This is another syntax type error. Most M command arguments are optional. This error is usually associated with the WRITE argument tab character, which is the question mark (?). It must be followed by an integer or variable.

 


F—Error in pattern code

XINDEX checks that only the seven pattern codes (i.e., ACELNPU) are used. They also can be lower case (i.e., acelnpu). The seven pattern codes are defined as:

 


F—FOR Command followed by only one space

This error is only for the argumentless FOR command. It must be followed by two spaces.

 


F–FOR Command did not contain '='

XINDEX checks that if the FOR command has an argument, it must set a variable.

 


F—General Syntax Error

This error indicates a construct that is not valid M syntax and is otherwise unrecognized. Almost any malformed code is possible here.

 


F—GO or DO mismatch from block structure (M45)

This is another error that has to with the dot syntax used to create anonymous blocks in standard M. Typically, a GOTO that jumps from one stack level to another would generate this type of error.

Example
TEST        ;test routine
            F I=1:1 D
            . S X=1,Y=Z
            .I Y>0 G QUIT^TESTA
            .S Z=0

In this example, the code is trying to GO out of the DO block to another routine.

 


F—Invalid or wrong number of arguments to a function

This error involves calling functions with the wrong number of arguments, or with invalid argument syntax.

 


F—Label is not valid

M allows the arguments to commands (e.g., DO) to be specified indirectly (i.e., via the @ syntax). What is not standard, however, is to use indirection just to specify the label in a label^routine combination.

Example

The following code extract from EN+6^MXMLPRSE is invalid:

F  Q:EOD  D READ,EPOS,@ST^MXMLPRS0:'EOD

 


F–Missing argument to a command post-conditional

Most M commands allow a post condition, which is designated by a colon and followed by the argument. This error occurs if the argument is missing.

 


F—Non-standard (Undefined) 'Z' command

XINDEX flags all uses of Z commands. Vendor-specific commands use the Z prefix. The SAC restricts the use of such commands to Kernel. You may occasionally see other packages make use of these commands, but in these cases, an exemption is required.

 


F–Quoted string not followed by a separator

XINDEX checks that anywhere a quoted string is used, it must stand alone or have a separator after it.

 


F—Reference to routine '^routine name'. That isn't in this UCI

These errors flag references to routines that are not present on the system.

 


F—UNDEFINED COMMAND (rest of line not checked)

This is a syntax error. It requires a manual check of the line/routine.

 


F—Undefined Function

Checks that a function is part of the M standard.

 


F—Undefined Special Variable

This is essentially the same as the "F—Undefined Function" error. The only difference is that in M special variables are built-in functions that take no arguments.

 


F—Unmatched Parenthesis

This is a syntax error. XINDEX checks that the static code has matching parenthesis. It does have problems when indirection is used, which are evaluated during execution.

 


F–Unmatched Quotation Marks

This is a syntax error. XINDEX checks that the static code has matching quotation marks. It does have problems when indirection is used, which are evaluated during execution.

 


F—Unrecognized argument in SET command

XINDEX checks the syntax of the SET statement. It does have problems when indirection is used, which are evaluated during execution.