Principle and use of micropatterns

Micropatterns are used to manage complex operators in the specific code. Their generation depends on the context. They act as microgenerators. You enter them in the COBOL code of an instance with the PDP COBOL editor, or in the code of a Macro with the Macro editor. When the instance is generated again, they are recognized and are expanded with information fetched from the instance design or from the use context.

These micropatterns can also be inserted through snippets. Snippets display a wizard to specify the declaration lines of the corresponding micropatterns. They are available from the Snippets view, in the RPP snippets or RPP Macro snippets category. In the List of micropatterns and snippets, they can be spotted because they have a "Y" in the columns "Micropatterns" and "Micropattern calling snippets" of the tables.
Note: Other micropatterns are recognized in Rational Programming Patterns only to produce a code identical to the Pacbase code. In the List of micropatterns and snippets, they have a "data retrieval" indication.

To be recognized, a micropattern must be entered as a comment with a special format. It must include a start tag, an identifier, and the content lines themselves. The identifier and the content lines are specific to each micropattern.

Micropatterns are divided into two types:
  • Local micropatterns, which are expanded where they were inserted (micropatterns for internal resource calls for example).
  • Global micropatterns, which are expanded in several places of the code, not necessarily where they were inserted (date formatting micropattern for example).
The code generated from the micropattern is automatically updated upon each generation if the following conditions are met:
  • The formatted comment lines that constitute the micropattern have been updated.
  • The design element of the instance that is called in the micropattern has been modified (for example: if the internal format of a called Data Element has been changed).
You can specify micropatterns in the following generated COBOL files:
  • The .cbl file of a Program, Screen, or Server. When the instance is generated again, the micropatterns are kept in the COBOL code as they were entered, with the start tag. The micropattern lines are expanded at the end of the reconciliation.
    Note: The reconciliation is the process which, after a generation, keeps the specific code while it recognizes all the design modifications.
  • The design file of a Macro. When a Program, Screen, or Server is generated, its Macros must be generated first. They are then merged with the generation result of the calling Program, Screen, or Server. So when Macros are resolved, the characters that designate the micropatterns start tags are removed from the COBOL code. Only the generated expanded lines are kept. The micropattern lines are expanded just after the generation (and after the merge) and just before the reconciliation.

Feedback