Launching Natural Applications

In order to launch a Natural Application (for executing, debugging or profiling), the Eclipse Launch configuration framework is used with the standard Eclipse commands Run As, Debug As and Profile As.

Within these commands NaturalONE is exposing a launch shortcut named Natural Application which maintains a configuration named Default Launch. Depending on the context where the shortcut is used, this launch will be updated accordingly.

Note:
The Default Launch configuration is created the first time the Natural Application shortcut is used.

The following picture shows the information filled into the Natural Application tab of the Default Launch configuration for launching a Natural application:

graphics/use-local-launch-default.png

When one of the following commands

  • Run As - Natural Application

  • Debug As - Natural Application

  • Profile As - Natural Application

is applied inside the Project MyFirstProject on the program HELLO.NSP in library TUTORIAL, then the Program field is populated with the corresponding path. In addition, the I/O relevant information is taken from the Natural I/O Runtime Preferences.

The following picture shows the information how the Natural Server tab of the Default Launch configuration is populated when launching a Natural application:

graphics/use-local-launch-default-server.png

The Natural Server tab is addressing the runtime environment of the application. This information is retrieved from the Natural project properties (except the Start in library field), in this example from MyFirstProject which is using the local runtime.

Note:

And please keep in mind: This Default Launch configuration is being modified whenever the Natural Application shortcut is applied on different objects, for example when an object of MySecondProject running on a Linux runtime is selected then the Default Launch is populated with the corresponding path and server information.


Defining a Different Start Library

When designing an application, the startup program is sometimes located in a steplib, and the main program which is invoked by the startup program is located in a different library. In order to run the startup program directly from the steplib, you have to define a different start library in the launch configuration of the startup program, using the option Start in library. This option corresponds to the Natural system command LOGON which is available with Natural for Mainframes, UNIX, OpenVMS and Windows.

Note:
As already mentioned above, the Start in library field is not filled automatically (similar to the other Natural server parameters), but must be added by the user when required. Therefore, a custom Natural launch should be created instead of adding this field to the Default Launch. This can be achieved by copying the Default Launch to Custom Launch using the Run Configurations dialog and then manually modifying the appropriate field(s).

Example

Suppose your application has the following structure: The project properties define the library STEP as the steplib for all libraries within your project. The library MYLIB contains the main program named MYPROG, and the library STEP contains the startup program named MENU. The program MENU calls the program MYPROG which is located in a different library.

Example

When you try to run the application by executing the program MENU, an error will occur because the program MYPROG cannot be found in the current library STEP. To avoid this error, you have to define a different start library as described below.

Note:
When working with Natural itself (for example, with Natural for Mainframes), this would not be a problem: You would define STEP as a steplib of MYLIB so that the program MENU can be found in the steplib. Then you would simply LOGON to the library MYLIB and EXECUTE the program MENU.

Specifying Application Parameters

Depending on the application to be executed or debugged, it is also possible to specify the corresponding application parameter values in the Parameter field of the Natural Application tab. The individual parameters must be separated by one or more blank characters.

Note:
As with the Start in library field, these parameters are application-specific. Therefore, a custom Natural launch should be created instead of adding the parameters to the Default Launch to avoid that selecting a different application in the workspace would then get the parameters of the previously used application.

Launching Applications Using Shortcut Keys

It is also possible to launch an application with the F11 (Debug) or CTRL+F11 (Execute) key binding. This is not specific to NaturalONE but standard Eclipse functionality. These key bindings always process the launch which was last executed.

Instead of using the Natural Application shortcut (which always uses the Default Launch), you can also create multiple launch configurations for different application launches (e.g. "Appl_UnixLaunch_with_Parameters", "Appl_WinLaunch_with_StartLibray" etc.) and execute these launches using the appropriate commands in the Eclipse Run menu.