Adding Macro calls

When you call a Macro, its lines are inserted in a batch, online, or client/server program. You can then use standard sequences of specific code several times in the same program or in different programs. To call a Macro, you must select it in the -CP Lines tab. If it is parameterized, you must assign values to its parameters.

Procedure

  1. Open the -CP Lines tab of a Program, Screen, Server, Folder, or Communication Monitor (or associated Dialog).
  2. Click Add Macro or select this action in the contextual menu. A selection wizard opens with the list of the available Macros.
    • You can select a Macro in the list click OK.

      You can select contiguous instances in the selection wizard. To select noncontiguous instances, select Multi-selection. Select each instance, with the help of the filtering pattern if necessary. Then, click Add to selection list. You can also double-click each instance to add it to the list. To remove an instance from the selection list, select the instance in the selection list and click Remove from selection list before you close the selection wizard.

    • You can create a Macro by clicking New Macro. In the creation wizard that opens, enter the name and label of a new Macro and click OK. The new Macro is then displayed in the selection wizard. If you select it and click OK, it is called in the -CP Lines tab.

    The Macro is then inserted into the table according to the alphabetical order. If a Macro is called more than once, its various calls are sorted according to the line numbers.

  3. If the Macro contains parameters, you must assign values to its parameters. To assign a value, proceed as follows:
    1. Select a Macro call in the table.
    2. Enter the line number of the Macro call in the Line number column of the table or in the Line number field of the Macro call section.

      The line number is constituted of two numeric characters. When a Macro is parameterized, the line number is used to call the Macro more than once into the same calling instance.

    3. In the Macro call section, you can enter a comment on the Macro call, if necessary.
    4. In the Parameters table of the Macro call section, enter the values of the parameters if necessary. There are two types of value:
      • A simple character string. Enter the value in the Value column. The number of characters that is used for each parameter value must correspond to the appropriate field length for the parameterized element. For example, if $1 is used as a function code, the value must be 2 characters long.
      • A Data Element, a Data Structure, or a Segment. Proceed according to one of the following methods:
        • Click the Linked entity column and click the selection button that is displayed then. Select the instance in the selection wizard.
        • Enter the instance name directly in the Linked entity column. To make the input easier, you can open a content assist wizard by clicking Ctrl and the space bar simultaneously. If you enter the beginning of a name before you open the wizard, the instances that start with this input are proposed by the content assist. It displays, in the order, the Data Structures, Data Elements, and Segments. If you enter 4 characters that correspond both to a Data Element and a Segment and if you validate, the Data Element is displayed in the column. If you enter 2 characters that correspond both to a Data Element and a Data Structure, the Data Element is displayed in the column. If you enter the name of an instance that does not exist and if you validate, the modification is not effective.

        The instance name is also automatically displayed in the Value column. It is preceded by E= (for a Data Element), D= (for a Data Structure), or S= (for a Segment). When the calling instance is generated, the parameter is replaced by the instance name and references are automatically created.

    5. Only the first 10 parameters are displayed by default. To add 10 more parameters, click Add.

Feedback