|
|
(Before attempting to build a Mapping which contains more than one level, see Mappings Overview for information about control breaks and the relationship between levels and report components.)
A Mapping is composed of components. Each component defines part of the processing to be performed by the Mapping. All components are optional, except that each Mapping must contain a level-type component called Main.
The levels in a Mapping contain the instructions (in the form of MDL statements) to be executed when the Mapping is submitted.
The MDL you use to write processing instructions in the levels is actually entered into blocks. These blocks correspond to control breaks; they are known as level breaks or 'break blocks.' Each level contains at least three blocks; these may contain any amount of MDL (including none, which of course means that the block is empty). The MDL in these blocks is executed at different times: when the level starts, when the level finishes, once for every instance of an entity processed and so on. They are arranged in a hierarchy which reflects the structure of the report to be produced.
In general terms, the first block (Pre-Process) is where you put the instructions which initialise workfields and set up the report title and page headers and footers; the second block (Process) is where the bulk of the processing is performed and detail lines are printed; the third block (Post-Process) is where the end of report message gets printed.
Between these pre-defined blocks you can insert other blocks based on different attributes, performing different processing according to the subtotals or control breaks required.
The final block of MDL that you can have in a level component (which is accessible from the second format of the level-editing screen Level Break - Amend MQM0) is an optional one, called Workarea, for defining workfields local to the level. Workfields defined within a level are only available for use within that level; if calculated data needs to be passed from level to level, global workfields must be defined in a workarea component. Workfields defined in one level are not available to other levels called by that level. The workarea block is normally only used when recursive levels are being defined (that is, levels which can invoke themselves).
The three pre-defined processing blocks in a level are:
(Although the level Main must exist in every Mapping, it is possible for each process block to be empty; however, such a Mapping would probably not be very useful.)
The simplest Mappings consist of a single level, Main, which selects the necessary data from an entity with a CHOOSE criterion and which prints the results using a list statement in the Process block. The other pre-defined blocks may contain instructions to print a report header and an 'end of report' message.
The structure of the level is represented by indentation of the break names and the assignment of numbers which indicate the depth of nesting. When you have defined more than one additional break in a level, you can change their positions in the processing sequence by Promoting or Demoting them to different 'depths.'
See also