Creating dynamic templates from copybook templates

Instead of building field definitions manually, you can create a new dynamic template using the definitions in a copybook template. Once created, you can edit all aspects of the new dynamic template, including the field definitions.

  1. Specify your copybook template on the relevant Entry panel and select the Edit Template option.
  2. On the Field Selection/Edit panel, enter 2 to display the Specify Record Selection by field panel.
  3. Type MD on the Command line and press Enter.

    The Dynamic Template panel is displayed, containing the list of field definitions generated from your copybook template. You can modify any of these values.

    Note: As all field definitions on a dynamic template are treated as Level 2 elementary items, you may need to delete any previous group level fields.
  4. Choose one of the following actions:
    • Enter the SAVE command and then exit or cancel from the panel.

      If you save the dynamic template, you are prompted for a data set and a member name in which to store the new dynamic template.

    • Press the Cancel function key (F12) to return to using your copybook template, without saving the dynamic template.
    • Press the RunTemp function key (F6) to display your data with the temporary dynamic template (only valid if you have an active editor session).
      Tip: The RunTemp function key (F6) should not be used with the Template Workbench nor any function which has selected batch execution. Currently, this is not enforced and can lead to unpredictable results.
    • Exit from the panel and, when prompted by the Template Save panel, choose to save the template, run with a temporary template or cancel your changes.

You can also create a dynamic template from a copybook template while in an editor session. To do this:

  1. Enter CEDIT on the Command line of the View or Edit panel. The Record Selection Criteria panel is displayed.
  2. Type MD on the Command line and press Enter.

    The Dynamic Template panel is displayed, containing the list of field definitions generated from your copybook template. You can modify any of these values.

  3. Exit from the panel (press F3) and, when prompted by the Template Save panel, choose to save the template, run with a temporary template or cancel your changes.

When working from an active editor session, the following applies:

  • When you return to the editor panel, the active copybook template is replaced with the temporary or saved dynamic template.
  • If you return to the editor panel using a temporary dynamic template and then exit from the panel, you are not prompted to save the template and it is discarded.
  • You can re-edit the dynamic template by entering the DEDIT command. This would give you an opportunity to save a temporary template.

Related topics