Controls of the Macro source code syntax

The Macro source code is controlled to detect any errors in the code writing and to ensure that the Macros will be correctly merged upon generation. If a Macro contains an error, the Programs, Screens, or Servers that call it cannot be generated.

The errors that are detected by the controls are displayed in the Macro source code and in the Problems view.

Reminder: Macros are constituted of the following line types:
  • The identifiers (F01$1 in the following example). These identifiers can have the following formats:
    • Fffss (where ff is the function code and ss is the subfunction code) for an insertion in the PROCEDURE DIVISION,
    • Wnn (where nn is the position of the description in the WORKING-STORAGE SECTION.
    • Other formats that correspond to special usages (for example: IXXNN for the declaration of an identifier to generate indexes).
  • The attributes (*LV=10 in the following example) for an insertion in the PROCEDURE DIVISION. The attributes are automatically added as comments when you insert a function or subfunction with the function or subfunction creation wizard.
  • The code lines (lines 100, 120, and 140 in the following example).
Figure 1. The line types in Macros
This screen capture shows a Macro in its source code editor. The contents are described in the explanations that precede.

Controls on the line numbers

The line numbers must conform to the following rules:
  • Line numbers are alphanumeric in the WORKING-STORAGE SECTION and numeric in the PROCEDURE DIVISION. You can parameterize them with $.
  • A line number is required on the first line that follows an identifier or an attribute line. However, the line number is not required on the first line of a function or subfunction condition.
  • The line number must be unique for an identifier.
  • If the previous identifier is FXXYY, the line number must have the following lengths:
    • 3 or 6 characters if it does not contain any $. It is advised to use line numbers on 3 characters for the Macros that are created in Rational® Programming Patterns. For the line numbers of the Macros that are migrated from Pacbase, see Source code of the migrated Macros.
    • 2, 3, 5, or 6 characters if it contains a $.
  • If the previous identifier is not FXXYY, the line number must always be 3 characters long.
  • If the line number contains a $, the following controls apply:
    • The $ must not be in position 3 or 6.
    • The value that follows the $ must be 0 - 9 or A-J.
  • A line that contains a micropattern (*! from column 7) must have its own line number.

Controls on the identifiers

The identifiers must conform to the following rules:
  • A code line must be preceded by an identifier.
  • An identifier must be unique.
  • If the identifier contains a $, its position must be correct and the value of the $n parameter must be 0 - 9 or A - J.
  • The identifier length must correspond to the authorized length of the line type (5 characters for a type B, F, I, or J, and 3 characters for a type W).
Note: All the identifiers are explained in Code syntax in the Macro COBOL editor.

Controls on the attributes

The attributes must conform to the following rules:
  • All the attributes must have a known type (for example: LV for the level or ACTION for the control on a Data Element).
  • The level (LV) must be on two numeric characters. It can also contain a parameter ($x, where x is a character from 0 to 9).
  • The level must be 05 for functions and strictly greater than 05 for subfunctions.
  • Some attributes are used for specific functions only (F20 or F25 for example).
  • The position of the attribute is controlled. The condition type (IT or DW for example) must be in the first position and must be followed by the level (LV=10 for example).
  • An identifier can have one attribute line only.

Syntactic controls of the ACTION and REF attributes according to the function

The ACTION and REF attributes indicate the insertion of specific code in the automatic functions and subfunctions of a Screen. They are automatically integrated into the code if you enter values in some fields of the subfunction creation wizard (Standard or client Dialog model).

The ACTION attribute specifies the position of the specific code insertion relatively to the Screen automatic subfunctions (F20, F25, F30, F35, F60, and F65). It is automatically integrated if you select a value in the Insertion type field of the subfunction creation wizard. It can take the following values:
  • ACTION=*A for an insertion before the subfunction,
  • ACTION=*P for an insertion after the subfunction,
  • ACTION=*R for the replacement of the subfunction.
The REF attribute specifies the insertion of specific code to control the Data Elements or Segments of a Screen:
  • For Data Elements, it corresponds to an insertion in function F20 (Data Element validation). It is inserted as REF=xxxxxx, where xxxxxx is a Data Element. You can also parameterize the Data Element with $x. The REF attribute is automatically inserted when you specify a Data Element in the Data Element code field of the subfunction creation wizard.
  • For Segments, it corresponds to an insertion in the following functions:
    • F25 (Segments accessed in reception), F35 (Segment update), and F60 (Segments accessed for display). It can then take the following values:
      • REF=xxxx, where xxxx is a Segment,
      • REF=xxxx y, where y is a category: A (header), R (repetitive), or Z (screen bottom),
      • REF=$x y, where $x is the parametrized value of a Segment,
      • REF=$x.
    • F30 (transfer of Data Elements from the Screen to the Segments) and F65 (transfer of Data Elements from the Segments to the Screen). It can then take the following values:
      • REF=y, where y is a category: A (header), R (repetitive), or Z (screen bottom),
      • REF=$x, where $x is the parametrized value of a category.
    • F80 (physical accesses). It can then take the following values:
      • REF=xxxx yy, where xxxx is a Segment and yy an access type (CL, D, EB, OP, RN, RU, RW, P, UN, or W),
      • REF=$x, où $x is the parametrized value of a Segment,
      • REF=$x yy,
      • REF=$x $n,
      • REF=xxxx $n.

Consistency checks

The following consistency checks are performed:
  • A condition line must be present in the functions and subfunctions where it is required (IT and DW for example).
  • The attribute line is not authorized for identifiers W (position in the WORKING-STORAGE SECTION), I (generation of indexes), and J (management of DO loops).
  • The level must be present if the ACTION attribute is specified.

Feedback