Version 8.2.7
 —  Code Generation  —

Introduction

The Natural Construct component for NaturalONE provides access from Eclipse to Natural Construct on the server. This access includes the modeling functionality in the SYSCST library, as well as Eclipse wizards corresponding to a subset of the most common Natural Construct models in your server installation. The Eclipse wizards collect the model specifications and pass this information to the Natural server to generate the code, which is then returned to the local project that was selected as the target on a wizard panel.

This type of code generation is different from the local, non-server based generation implemented using Velocity templates (for example, REQUEST-DOCUMENT Client, Object Maint, Object Browse, and Object Skeleton; see Using the Code Generation Component). The Natural Construct component allows you to use Natural Construct models on the server in NaturalONE, as well as create Eclipse wizards for them (including customized ones).

Note:
To install the Natural Construct component for NaturalONE, you must select Designer > NaturalONE > Natural Construct in the installation tree for the installer.

This section covers the following topics:


Supplied Client Generation Wizards

The Natural Construct component for NaturalONE supplies client generation wizards for the following Natural Construct models on the server:

Model Generates
BROWSE Browse program that reads a file in logical order and displays record values on the screen.
BROWSE-SELECT Browse-select program that reads a file in logical order, displays record values on the screen, and allows the user to specify which set of commands are executed.
BROWSE-SELECT-HELPR Browse-select helproutine that enables the user to select a field value from a list of valid values.
BROWSE-SELECT-SUBP Browse-select subprogram that is invoked as a sub-function of another program. For example, you can use a browse-select subprogram to perform the Browse action for a maintenance program, in which case, the maintenance program invokes the subprogram without disturbing the current state of the panel.
BROWSE-SUBP Browse subprogram that is invoked as a sub-function of another program.
DRIVER Driver program that executes a helproutine or subprogram for testing purposes.
MAINT Maintenance program that maintains a file using a unique key and, optionally, a related secondary file. The Maint wizard generates the code necessary to scroll through the MU/PE fields of a primary file or the records of a secondary file.
MENU Menu program that presents users with several choices in the form of a menu. The user enters a code for one of the choices to invoke a predefined function.
OBJECT-BROWSE-DIALOG Object-browse dialog component of an object-maintenance process that works with the object-browse subprogram to provide the browse functionality for a Natural object.
OBJECT-BROWSE-SELECT-SUBP Object-browse-select subprogram and corresponding parameter data areas that provide the browse functionality for a Natural object. This model is similar to the OBJECT-BROWSE-SUBP model, except the generated object-browse-select subprogram can accommodate a client/server environment and a subprogram proxy can be used to access the generated code as a business service.
OBJECT-BROWSE-SUBP Object-browse subprogram and corresponding parameter data areas that provide the browse functionality for a Natural object.
OBJECT-MAINT-DIALOG Object-maintenance dialog component of an object-maintenance process. The dialog component (Natural program) communicates with the user and invokes methods (data actions) implemented by the object-maintenance subprogram.
OBJECT-MAINT-SUBP Object-maintenance subprogram and corresponding parameter data areas that update all entities within a Natural object.
QUIT Quit program that releases resources used by an application. It displays a confirmation window that overlays the host panel and gives users the option of quitting an application entirely or resuming where they left off.
STARTUP Startup program (often named Menu) that initializes global variables and invokes the main menu program.

Top of page

Requirements

To use the Natural Construct code generation features in NaturalONE, the following requirements must be met:

Top of page

Perform Standard Actions on Natural Construct Resources

You can use the Natural Server view to copy/paste, delete, or move Natural Construct resources on the server. The action will be performed in the mapped environment for the selected node(s).

This section covers the following topics:

Perform Actions on Code Frames

Start of instruction setTo perform actions on one or more code frames:

  1. Open the context menu for the code frame(s) in the Natural Server view.

    For example:

    graphics/code-frame-context-menu.png

  2. Select one of the actions listed.

    The available actions are:

    Action Description
    Move Removes the selected code frame(s) from the current mapped environment and adds it to a target mapped environment. For information, see Move a Code Frame.
    Copy Copies the selected code frame(s) to the clipboard in anticipation of a Paste action. For information, see Copy a Code Frame.
    Delete Removes the selected code frame(s) from the current mapped environment. For information, see Delete a Code Frame.

Move a Code Frame

This section describes how to move one or more code frame(s) from the current mapped environment to a target mapped environment.

Note:
A code frame cannot be moved within the same mapped environment.

Start of instruction setTo move one or more code frames:

  1. Open the context menu for the code frame(s) in the Natural Server view.

  2. Select Move.

    The Move Objects window is displayed. For example:

    graphics/move-objects-window-code-frame.png

    This window lists the connection nodes for the available mapped environments.

  3. Expand the connection node for the environment into which you want to move the code frame(s).

  4. Select the Construct or Code-Frames root node.

  5. Select OK.

    A progress window is displayed while the code frame(s) is removed from the current mapped environment and copied to the target mapped environment.

Copy a Code Frame

This section describes how to copy one or more code frames to the clipboard and then paste the frame(s) into a target mapped environment.

Start of instruction setTo copy one or more code frames:

  1. Open the context menu for the code frame(s) in the Natural Server view.

  2. Select Copy.

  3. Open the context menu for the Construct or Code-Frames root node into which you want to copy the code frame(s).

  4. Select Paste.

    The frame(s) is copied to the target mapped environment.

Delete a Code Frame

This section describes how to remove one or more code frames from the current mapped environment.

Start of instruction setTo delete one or more code frames:

  1. Open the context menu for the code frame(s) in the Natural Server view.

  2. Select Delete.

    A confirmation window is displayed to confirm the action.

  3. Select Yes.

    The frame(s) is removed from the current mapped environment.

Perform Actions on Models

Start of instruction setTo perform actions on one or more Natural Construct models:

  1. Open the context menu for the model(s) in the Natural Server view.

    For example:

    graphics/cst-model-context-menu.png

  2. Select one of the actions listed.

    The available actions are:

    Action Description
    Move Removes the selected Construct model from the current mapped environment and adds it to a target mapped environment. For information, see Move a Construct Model.
    Copy Copies the selected model(s) to the clipboard in anticipation of a Paste action. For information, see Copy a Construct Model.
    Delete Removes the selected model(s) from the current mapped environment. For information, see Delete a Construct Model.

Move a Construct Model

This section describes how to move one or more model(s) from the Models root node in the current mapped environment to a target mapped environment.

Note:
A Construct model cannot be moved within the same mapped environment.

Start of instruction setTo move one or more Construct models:

  1. Open the context menu for the model(s) in the Natural Server view.

  2. Select Move.

    The Move Objects window is displayed. For example:

    graphics/move-objects-window-model.png

    This window lists the connection nodes for the available mapped environments.

  3. Expand the connection node for the environment into which you want to move the model(s).

  4. Select the Construct or Models root node into which you want to move the model(s).

  5. Select OK.

    A progress window is displayed while the model(s) is removed from the current mapped environment and copied to the target mapped environment.

Copy a Construct Model

This section describes how to copy one or more models to the clipboard and then paste the model(s) into a target mapped environment.

Start of instruction setTo copy one or more Construct models:

  1. Open the context menu for the model(s) in the Natural Server view.

  2. Select Copy.

  3. Open the context menu for the Construct or Models root node into which you want to copy the model(s).

  4. Select Paste.

    The model(s) is copied to the target mapped environment.

Delete a Construct Model

This section describes how to remove one or more models from the current domain.

Start of instruction setTo delete one or more Construct models:

  1. Open the context menu for the model(s) in the Natural Server view.

  2. Select Delete.

    A confirmation window is displayed to confirm the action.

  3. Select Yes.

    The model(s) is removed from the current mapped environment.

Top of page

Use the Dependencies View

When a Construct resource (for example, a Construct model, code frame, etc.) is open in the editor, the Dependencies view displays dependencies between that resource and other Construct resources and/or Natural resources. This section describes the child nodes contributed to the view by the Construct-related resources. The following topics are covered:

Notes:

  1. Select graphics/sort-alphabetically-icon.png to sort the resources alphabetically.
  2. Select graphics/dependencies-view-export-icon.png to export a textual representation of the visible nodes in the view to a file.
  3. When a supporting resource cannot be found locally using the project steplib chain and project references, "<Unknown>" is displayed with the name of the resource (see above). If the unknown module(s) is not shipped with the Construct runtime project, either manually download it from the server or create it locally. If the module(s) is shipped with the Construct runtime project, add the project. For information, see Add the Construct Runtime Project.
  4. For more information about the Dependencies view, see the description of the source editor in Using NaturalONE.

Construct Resources

When a Construct resource is open in the editor, the root node displays the name of the resource. In caller mode (graphics/caller-mode-icon.png), child nodes are contributed to the Dependencies view for each resource that depends on that Construct resource. For example, when a code frame is open in the editor, the child nodes display any Construct models or other code frames that depend on that code frame:

graphics/dependencies-view-construct-resource-caller-mode.png

In this example, three Construct models (BROWSE-SUBP, BROWSE-HELPR, and BROWSE) depend on the CSCA8 code frame.

In callee mode (graphics/callee-mode-icon.png), Construct and Natural nodes are contributed to the view for each resource the Construct resource depends on. For example, when a Construct model is open in the editor, the child nodes will display any code frames, PDAs, subprograms and Construct models that this model depends on. For example:

graphics/dependencies-view-construct-resource-callee-mode.png

In this example, the Construct model named BROWSE depends on two code frames (CSCC9 and CSCA8), a PDA named CUSCPDA in the C53 library and many subprograms.

Related Natural Resources

When a Natural subprogram is open in the editor, the root node displays the name of the subprogram, as well as the name of the library in which it is located. In caller mode (graphics/caller-mode-icon.png), child nodes are contributed to the Dependencies view for each Construct-related resource that depends on this subprogram (such as a Construct model, code frames, etc.). For example:

graphics/dependencies-view-subprogram-caller-mode.png

In callee mode (graphics/callee-mode-icon.png), a Construct model node is contributed to the view if the subprogram was generated by a Construct model. For example:

graphics/dependencies-view-subprogram-callee-mode.png

Top of page

Construct Runtime Project

To avoid compile errors for Construct-generated modules in the server environment, Natural Construct on the server is delivered with all the required runtime/compile time modules in the SYSTEM library. Since these modules are combined with other modules and products in SYSTEM, the Natural Construct component on the client delivers the required modules in the Construct runtime project. The modules in this project will eliminate compile and parsing errors caused by missing Natural Construct resources and will provide more detailed information in the Dependencies view.

This section covers the following topics:

Add the Construct Runtime Project

When Natural code is generated by a Code Generation wizard, the wizards verify whether the required runtime/compile-time modules are available in the local environment. If they are not, a window is displayed prompting you to add the Construct runtime project to your workspace. For example:

graphics/download-cst-runtime-project.png

If you select Yes, the project is added to the workspace and referenced from the current project.

You can also add the Construct runtime project to your workspace manually.

Start of instruction setTo add the Construct runtime project manually:

  1. Open the context menu for any node in the Navigator view.

  2. Select Code Generation > Construct Runtime > Add Runtime Project.

    For example:

    graphics/context-menu-for-construct-runtime-project-add.png

    The project is added to the Navigator view. For example:

    graphics/construct-runtime-project-in-navigator-view.png

The current version of the Construct runtime project is defined in the .construct file. For example:

graphics/construct-runtime-project-in-navigator-view-construct-file.png

Note:
The information in the .construct file is used internally and should not be modified.

The local version information is compared to the version information delivered in the Construct runtime project at startup and during generation and regeneration. If the version has changed on the server, the local project will be updated.

Update the Construct Runtime Project to the Latest Version

This section describes how to update an existing Construct runtime project to the latest version of the project. Updated modules in the shipped version are copied to the workspace (and overwritten when necessary).

Warning:
Any customizations of the Construct runtime project modules will be lost unless you exclude the modules from the update processing. For information, see Exclude Modules from the Update or Replace Process.

Start of instruction setTo update the Construct runtime project to the latest version:

  1. Open the context menu for the ConstructRuntime project in the Navigator view.

  2. Select Code Generation > Construct Runtime > Update to Latest Version.

    For example:

    graphics/context-menu-for-construct-runtime-project-update.png

Replace the Construct Runtime Project with the Latest Version

This section describes how to replace an existing Construct runtime project with the latest shipped version of the project. All modules in the shipped version are copied to the workspace (and overwritten when necessary).

Warning:
Any customizations of the Construct runtime project modules will be lost unless you exclude the modules from the replace processing. For information, see Exclude Modules from the Update or Replace Process.

Start of instruction setTo replace the Construct runtime project with the latest version:

  1. Open the context menu for the ConstructRuntime project in the Navigator view.

  2. Select Code Generation > Construct Runtime > Replace with Latest Version.

Exclude Modules from the Update or Replace Process

This section describes how to exclude (and subsequently include) Construct runtime project resources from being overwritten during the update or replace process. You can use this functionality to protect changes to these modules from being overwritten during the update or replace process.

Notes:

  1. Excluding a folder automatically excludes all its child folders and files.
  2. You cannot exclude the Construct runtime project itself or the .construct file.

Start of instruction setTo exclude modules in the Construct runtime project from the update or replace processing:

  1. Open the context menu for a Construct runtime resource in the Navigator view.

  2. Select Code Generation > Construct Runtime > Exclude. For example:

    graphics/context-menu-for-construct-runtime-project-exclude.png

    The selected resource is added to the .construct-excludes file in the project. For example:

    graphics/construct-excludes-file-in-navigator-view.png

    Excluded resources will never be updated or replaced with the latest shipped version (triggered automatically at startup, generation, regeneration or by selecting the Update to Latest Version or Replace with Latest Version context menu actions).

    Note:
    You can view the .construct-excludes file to determine which resources are currently excluded, but you should never modify the file manually.

Start of instruction setTo include modules in the Construct runtime project update or replace processing:

  1. Open the context menu for the excluded Construct runtime resource in the Navigator view.

  2. Select Code Generation > Construct Runtime > Include.

    The selected resource is removed from the .construct-excludes file and will now be overwritten during an update or replace process.

Add Customized Modules to the Construct Runtime Project

If you have customized any of the required modules on the server, you must add these customizations to the local Construct runtime project. This project is imported from an archived file called ConstructRuntime.zip in the installation folder for the Natural Construct component.

Start of instruction setTo add customized modules to the Construct runtime project:

  1. Make a backup copy of the ConstructRuntime.zip file.

  2. Import the ConstructRuntime.zip file into your workspace.

  3. Open the zip file and copy the customized modules into the Construct runtime project.

  4. Export the modified Construct runtime project from your workspace to the ConstructRuntime.zip file.

    Your customizations will overwrite the supplied Construct runtime project in the Natural Construct installation folder.

The customized Construct runtime project now can be used as the basis for loading runtime projects in a customized environment.

Build the Construct Runtime Project in a non-Construct Server Environment

The Construct runtime project allows Construct-generated modules to be compiled in NaturalONE and executed in a non-Construct Natural server environment. If Natural Construct is installed on the server (including the compiled version only), a Construct-generated application can be compiled and/or executed on that server. If Natural Construct is not installed on the server (for example, in a NaturalOne local server environment), a Construct-generated application can be compiled on that server if the Construct runtime project has been installed.

The Construct runtime project is copied to the environment defined in the Properties window for the project (for example, Projectname > Properties > Natural > Runtime).

For a Construct-generated application to compile in a NaturalOne local environment:

The runtime folder does not require a Construct physical file. If Construct help is being used, the Construct physical file must be installed on the server and both the runtime and the CST-Help folders should be updated on the server.

Notes:

  1. To build the Construct runtime project, it must first be available locally. For information, see Add the Construct Runtime Project.
  2. If your non-Construct server environment is running on a mainframe, ensure that the ESIZE value is a minimum of 120 during the build.

Start of instruction setTo build the Construct runtime project in a non-Construct server environment:

  1. Open the context menu for the ConstructRuntime project in the Navigator view.

  2. Select Code Generation > Construct Runtime > Build Construct Runtime Project.

    The Define the Build Details panel is displayed. For example:

    graphics/define-build-details.png

  3. Select Finish.

    The Construct runtime project is built with all defaults.

    Or:
    Select one or more of the following options:

    Option Description
    Include GDA files Select this option to include all global data area files.

    The wizard ignores any global data areas. To include them, select Include GDA files.

    Note:
    To ensure compatibility with existing compiled files, and to avoid GDA timestamp errors, the Construct CDGDA global data area is also excluded by default. If you want this file uploaded and compiled, edit the .excludes file in the project. For more information, see the NaturalONE documentation.

    Execute CVUSRCOP after successful build Select this option to execute the CVUSRCOP utility, which copies the Natural utility routines to the SYSTEM library after the Construct runtime project has been successfully built on the server. For more information, see Natural Business Services Installation on Mainframes.
  4. Select Finish.

    The Construct runtime project is built with the selected options.

Top of page