Inserting code with micropatterns and snippets

You can insert code in the COBOL code of generated instances by inserting micropatterns or snippets.

There are two types of micropatterns:
  • Some micropatterns are operators with a strong added value. They fetch information from the design or from the use context. You insert them in Macros or in the COBOL code of a Program, Screen, or Server. When the instance is generated again, they automatically produce the corresponding code lines. Each micropattern declaration is kept in the code as it was entered. You can then modify this declaration later and generate the instance again to take the modification into account.
  • Other micropatterns are used to retrieve the Pacbase data. They are recognized upon generation to produce a code identical to the Pacbase code. You must not enter them in the code because they have a low added value. It is advised to enter the corresponding code lines instead.
Note: You can also create your own micropatterns by using the Rational® Programming Patterns Application Programming Interface. For explanations, see User micropatterns.
Snippets offer a guided input to insert code. There are two types of snippets:
  • Snippets that correspond to micropatterns with a strong added value. You use them to insert the code that corresponds to the declaration of the micropattern.
  • Other snippets. You use them to insert processing loops or indices, for example.
You insert snippets with the help of an insertion wizard that prompts you to assign values to the variables. Explanations are available on these variables. If you want to modify the code lines that are inserted by snippets, you must do so manually in the PDP COBOL editor or in the Macro editor.

Feedback