Top
NetCOBOL V11.0 NetCOBOL Studio User's Guide
FUJITSU Software

3.9.1 The role of Templates View

In the "Templates" view, the following functions can be used.

*1: Also can call Model code which is inserted with using template "template pattern".


"Templates" view is useful for when inserting the syntax of the COBOL language into the source file, it.

3.9.1.1 Insert template patterns into source file

The example below illustrates insetting a PERFORM statement from a template into the procedure division of a COBOL source file.

           PERFORM WITH TEST BEFORE
                    VARYING repeat count FROM 1 BY 1
                    UNTIL repeat count > 26
  1. Opens the edited COBOL source file in the COBOL editor.

  2. PERFORM statement is inserted into position at which the cursor is positioned.

  3. Displays the inserted template pattern in the "Templates" view.

    Point

    The content of displayed template in "Templates" view is different according to the extension of opening file in active editor.

    Displays the root category used for COBOL when opening COBOL source file (the file whose extension is .cob, .cobol or .cbl).

  4. Selects the inserted template pattern, and then select "Insert with Parameter Value..." or "Insert with Multiple Parameter Values..." from context menu, "Input Assistance" dialog box displays.

  5. Input identifier, initial values, incremental value of PERFORM statement and then click "OK" button.

    Table 3.1 Input Assistance dialog box

    Item

    Description

    Pattern preview

    Displays the pattern of template.

    Description

    Displays the descriptions of template.

    Enter parameter value

    In condition that pattern of template includes argument, inputs value to "Value" field.

    This graph cannot be displayed when the pattern of template without input argument.

    PERFORM statement is inserted into COBOL source file.

The condition that template pattern without arguments.

In the condition that template pattern without arguments, inserts as the following procedures.

  1. Displays the "Templates" view.

  2. Opens the source file in COBOL editor.

    The content of displayed template in "Templates" view is different according to the extension of opening file in active editor.

    Displays the root category used for COBOL when opening the COBOL source file (the file whose extension is .cob, .cobol or .cbl).

  3. In COBOL editor, puts the cursor into the position at which template pattern intends to insert.

  4. From "Templates" view, selects used template and then selects [insert] from context menu. Template pattern is inserted in COBOL editor.

3.9.1.2 Adding, editing, and deleting a template

The following can be executed.

Create root category

Use the following procedures to create a root category.

  1. Select "templates.xml" in the "Templates" view, and then select "Add" > "Root Category..." from the context menu. Or, select "templates.xml" from "Categorization of the template" in the "Templates" page, and then click the "New..." button.
    The "Add Root Category" dialog box appears.

    Table 3.2 Add Root Category dialog box

    Item

    Description

    Name

    Root category name

    Descriptions

    Description of the root category.

    File extensions

    The summary of the file extent associated with the root category is displayed.

    Add...

    Click the "Add..." button to add the file extent into the "File extensions". The "Select File Extensions" dialog box will display and then you can select an extent to add.

    Remove

    Click the "Remove" button to remove the file extent from the "File extensions".

  2. Input the above items and then click the "OK" button.

Create category

Use the following procedures to create a category.

  1. Select the parental category or root category from the "Templates" view and then select "Add" > "Category" from the context menu. Or, select the parental category or root category from "Categorization of template" in the "Templates" page and then click the "New..." button.

    The "Add Category" dialog box appears ("Add Category/Template" dialog box appears when creating from "Templates" page.)

    Table 3.3 Add Category dialog box (Add Category/Template dialog box when creating from "Templates" page.)

    Item

    Description

    Parent Name

    Displays the selected category or root category as parent.

    Category

    Check the "Category".

    Note:

    When "Add" > "Category" is selected from the "Templates" view, the "Templates" is unavailable.

    Template

    Name

    Category name.

    Category name must specify the identified name in parent category.

    Keyword

    Category cannot be inputted when it is checked.

    Descriptions

    Category description.

    Pattern

    Category cannot be inputted when it is checked.

  2. Input the above items, and then click the "OK" button.

Create template

Use the following procedures to create a template.

  1. Select the parental category or root category from the "Templates" view and then select "Add" > "Category" from the context menu. Or, select the parental category or root category from "Categorization of template" in the "Templates" page and then click the "New..." button.

    "Add template" dialog box appears ("Add Category/Template" dialog box appears when creating from "Templates" page.)

    Table 3.4 Add template dialog box (Add Category/Template dialog box when creating from template page.)

    Item

    Description

    Parent name

    Displays the selected category or root category as parent.

    Category

    Check the "Category".

    Note:

    When "Add" > "Templates" is selected from the "Templates" view, the "Category" is unavailable.

    Template

    Name

    Template name.

    Keyword

    Template key word.

    Descriptions

    Template description.

    Pattern

    Template pattern.

  2. Input the above items, and then click the "OK" button.

Note

  • The Template cannot be displayed in the Content Assist list without inputting the "Keyword".

  • It is necessary to encompass the variable names with "${"and"}" when the variable will be used in "Pattern".

    For example:
    COPY$[text-name]
  • Variable names that can be used in "Pattern" apply the rule of user-defined words used in COBOL. For user-defined words used in COBOL, refer to "COBOL Language Reference".

Edit root category

Use the following procedures to edit the name of the root category, descriptions and associated file extent. A system-defined Root category can be edited in the same way as a user-defined root category. However, a predefined root category name cannot be edited.

  1. From the "Templates" view, select the root category to be edited, and then select "Edit..." from the context menu. Or, select the root category to be edited from "Categorization of template" in "Templates" page and then click the "Edit..." button.

    The "Edit Root Category" dialog box appears.

    Table 3.5 Edit Root Category dialog box

    Item

    Descriptions

    Name

    Root category name.

    Description

    Descriptions of root category.

    File extensions

    Displays the file extent associated with the root category.

    Add...

    Click the "Add..." button to add a file extent into the "File extensions". The "Select File Extensions" dialog box will display, and then you can select extent to be added.

    Remove

    Click the "Remove" button to remove the file extent from the "File extensions".

  2. Make any desired changes and then click the OK button.

Edit category

Use the following procedures to edit the category.

  1. From the "Templates" view, select the category to be edited and then select "Edit..." from the context menu. Or, select the edited category from the "Categorization of the template" in "Templates" page, and then click the "Edit..." button.

    The "Edit Category" dialog box is displayed.

    Table 3.6 Edit Category dialog box

    Item

    Description

    Parent name

    Displays the selected category or root category as parent.

    Category

    "Category" is checked.

    Template

    Name

    Category name.

    Category name must specify the identified name in parent category.

    Keyword

    Cannot be inputted when the "Category" is checked.

    Description

    Category descriptions.

    Pattern

    Cannot be inputted when the "Category" is checked.

  2. Make any desired changes, and then click the "OK" button.

Edit template

Use the following procedures to edit the existing system-defined template and user-defined template.

  1. From the "Templates" view, select the template to be edited and then select "Edit..." from the context menu. Or, selects the category to be edited from the "Categorization of the template" in "Templates" page, and then click the "Edit..." button.

    The "Edit Template" dialog box is displayed.

    Table 3.7 Edit Template dialog box

    Item

    Description

    Parent name

    Displays the selected category or root category as parent.

    Category

    "Templates" is checked.

    Template

    Name

    Template name.

    Keyword

    Template keyword.

    Description

    Template description.

    Pattern

    Template pattern.

  2. Make any desired changes, and then click the "OK" button.

Delete root category or category

Use the following procedures to delete a category or root category (except the predefined category). Both user-defined categories and system-defined categories can be deleted.

  1. Select the category or root category that you want to delete from the "Templates" view and then select "Delete" from the context menu. Alternatively, select the category or root category that you want to delete from the "Categorization of the template" in "Templates" page, and then click the "Delete" button.

    The "Delete" dialog box is displayed.

  2. Click the "Yes" button.

Delete template

Use the following procedures to delete a template. Both user-defined templates and system-defined templates can be deleted.

  1. Select the template that you want to remove from the "Templates" view, and then select "Delete" from the context menu. Alternatively, select the template you want to delete from the "Categorization of the template" in "Templates" page, and then click the "Delete" button.
    The "Delete" dialog box is displayed.

  2. Click the "Yes" button.

3.9.1.3 Import and export template

Import Template

It is possible to import a template or category into a category or root category. When importing the file that has a category or root category with the same name as the selected category or root category, the contents of category and root category will be merged.

When importing a root category and merging it into an existing root category, the file extent relationship of the existing root category will remain and not be changed.

Use the following procedures to import.

  1. Display the "Templates" page.

  2. Select the template or category that you want to import from the "Categorization of the template", and then click the "Import..." button.
    The "Importing Template" dialog box is displayed.

  3. Select the path that is the import source of the template or category, and the file (XML file in valid form), and then click the "Open" button.
    The template or category is imported. An error message is displayed when an invalid XML file is selected.

When importing a template, the name of template can be used repeatedly.

Note

An XML file that only has a template or category (which does not have a route category) cannot be imported into the main root ("templates.xml").

Export template / category

Use the following steps to export the category or template.

  1. Display the "Templates" page.

  2. Select the template or category that you want to export from the "Categorization of the template", and then click the "Export..." button.
    The "Exporting Templates" dialog box is displayed.

  3. Input the name of the XML file after selecting the path that is the export destination of the template or category, and then click the save button.
    The template or category is exported.

Export all

Use the following steps to export all templates, categories and root categories.

  1. Display the "Templates" page.

  2. Clicks the "Export All" button.

    The "Exporting Templates" dialog box is displayed.

  3. Input the name of the XML file after selecting the path that is the export destination of the template or category, and then click the save button.

    The template or category is all exported.

3.9.1.4 Validation/Invalidation of template

Use the context menu for the "Templates" view to enable or disable the template.

Select the template from the "Templates" view, and then select "Enable" or "Disable" from the context menu.