When you call a Macro, its lines are inserted in a batch
or online 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
- Open the-CP Lines tab of a Program,
Screen, Dialog, Server, or Server Dialog.
- Click Add Macro or select this action
in the contextual menu. A selection wizard opens with the list of
the available Macros.
- If the Macro you want to call is displayed in this selection
wizard, select it and click OK.
- If you want to create a Macro, click 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.
- If the Macro is parameterized, you must assign values to
its parameters. To assign a value, do the following actions:
- Select a Macro call in the table. The Macro
call section opens.
- Enter the line number of the Macro call.
It is constituted of two numeric
characters. When a Macro is parameterized, it is used to call it more
than once into the same program.
- 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. In this case, enter the value in the Value column.
The number of characters that is used for each parameter value corresponds
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. In this case,
click the Linked entity column and click the
selection button that is displayed then. Select the instance in the
selection wizard. The instance name is automatically displayed in
the Value column, preceded by E= (for
a Data Element), D= (for a Data Structure),
or S= (for a Segment). When the program is
generated, the parameter is replaced by the instance name and references
are automatically created.
- Only the first 10 parameters are displayed by default.
To add 10 more parameters, click Add.