Introduction MTB Statements File System Compiler Applications Reference Guide Index

Language Structure Data Division I/O Format Division Procedure Division Mnemonics

Line Numbers vs. Labels

Editor line numbers are not statement labels.

The Comet Editor utility program (CED) employs line numbers to maintain the sequence of lines in a source program. Line numbers range from 1 to 9999999. Line numbers are not part of the MTB source statement itself and are not referenced from within the program.

However, some MTB statements employ statement labels that are a part of the MTB source statement.

Format statement labels are required for every FORMAT statement, while statement labels in the Procedure Division are used only for statements that are logical branch points in the program (e.g., subroutines, exception routines, branch-to routines).

The MTB compiler views format labels and statement labels in two distinct groups. Therefore, it is possible to use the same label in both the I/O Format Division and the Procedure Division.

Labels may be numeric or alphanumeric.

Numeric labels

Numeric labels may contain up to four digits (e.g., 1, 10, 100, 1000). The MTB compiler treats numeric labels as a string of characters, rather than as a numeric value. This means that labels such as 1, 01, 001, and 0001 are all different from each other.
Alphanumeric labels

Alphanumeric labels must begin with a letter and end with a colon (:) when being defined (other references do not include the colon). Characters following the first one may be alphabetic or numeric. No special symbols or blanks are allowed in statement labels.

Prior to Comet version 504
Alphanumeric labels may be any length, but the first 8 characters must be unique within a single source program.

For Comet version 504 and later
Alphanumeric labels may be any length, but the first 32 characters must be unique within a single source program.

Example 1:

   Editor
   line
   number   Label       Statement
   =================================================================
   100      SCREEN:     FORMAT "THIS IS AN I/O FORMAT STATEMENT."
   200      .
   300      .
   400      .
   500      START:      PRINT (0,SCREEN)
   600      .
   700      .
   800      .
   900                  GOTO START
In this example, the Comet editor line numbers start at 100 and end at 900. Line 100 has a label of SCREEN. Since this statement is an I/O Format statement, the label is a format label. Line 500 is an executable statement, labelled START, which is a statement label. Note that it refers to the format label used earlier in the program. The last statement shown is also an executable statement; it refers to the statement label used in the second statement shown.

Example 2:

   Editor
   line
   number   Label       Statement
   =================================================================
   100      TOP:        PRINT (0) (EN);(CS)
   200      .
   300      .
   400      LOOP:
   500                  READ (1,CUSTFILE) EXCP=8000
   600                  PRINT (2,PRINTER) EXCP=9000
   700      .
   800      .
   900                  GOTO LOOP
This example demonstrates two approaches to using statement labels. On Comet editor line number 100, the label TOP: appears on the same line as an MTB statement. However, on editor line number 400, the label LOOP: appears by itself (without an MTB statement on the same line). Both methods are valid.


Language Structure