Getting Started with Natural

This document covers the following topics:


Invoking Natural's Main Menu

The way you invoke Natural and its main menu depends on how the system has been configured at your site. For most installations, you invoke Natural as described below.

Start of instruction setTo invoke Natural's main menu

  • Enter the following command at the UNIX system prompt:

    natural

    The main menu appears.

     2009-06-30                         NATURAL                 Library: SYSTEM     
     09:22:05                   V 6.3.7 Software AG 2009        Mode   : REPORT     
     User: SAG                                               Work Area : empty      
    +------------------------------------------------------------------------------+
    ¦Library          Direct           Services         OS                Fin      ¦
    +------------------------------------------------------------------------------+
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                                                                                    
     Select Library

Libraries

All Natural objects required for creating an application are stored in Natural libraries in Natural system files. There is a system file for system programs (FNAT) and a system file for user-written programs (FUSER).

Natural thus distinguishes system libraries and user libraries. The system libraries, which start with the letters "SYS", are reserved for Software AG purposes only. A user library contains all user-defined objects (for example, programs and maps) which make up an application. The name of a user library must not start with the letters "SYS".

The field Library in the top right-hand corner of the Natural main menu shows the name of the library where you are currently logged on.

Issuing Commands

In Natural, you can perform a function either by selecting it from a sequence of menus and selection windows, or by entering a Natural system command directly.

To select a menu, use the arrow keys. When the required menu is highlighted, press ENTER. It is also possible to enter the first character of a menu name; you need not press ENTER in this case.

When the resulting window contains a list of options, use the arrow keys to select the required option and press ENTER. In some windows, it is also possible to enter the first character of the function; you need not press ENTER in this case.

If you want to close a window without further action, press ESC.

The input of a Natural command is not case-sensitive. After you have entered a Natural command, you choose the ENTER key. ENTER confirms the action and executes the command or invokes an extra confirmation window where you explicitly acknowledge command execution.

Creating a User Library

You will now create a user library with the name TUTORIAL. This library is to contain all Natural objects that you will create in the course of this tutorial.

A library can be created in different ways. The following instructions illustrate how to use the Direct menu in which you enter Natural system commands, and how to use the Library menu to achieve the same result.

Start of instruction setTo create a user library using the Direct menu

  • Select the Direct menu and press ENTER. In the resulting Direct Command window enter the following and press ENTER:

    LOGON TUTORIAL

    where "TUTORIAL" is the name of the library that you create.

    LOGON is a system command which is used for two purposes:

    • to log on to an existing library, or

    • to create a new library when a library with the specified name does not exist.

Start of instruction setTo create a user library using the Library menu

  1. Select the Library menu and press ENTER.

    A window appears providing access to all existing libraries.

     2009-06-30                         NATURAL                 Library: SYSTEM     
     11:16:09                   V 6.3.7 Software AG 2009        Mode   : REPORT     
     User: SAG                                               Work Area : empty      
    +------------------------------------------------------------------------------+
    ¦Library          Direct           Services         OS                Fin      ¦
    +------------------------------------------------------------------------------+
    +----------+                                                                    
    ¦ <LOGON>  ¦                                                                    
    ¦ AA       ¦                                                                    
    ¦ ABC      ¦                                                                    
    ¦ ADR      ¦                                                                    
    ¦ BBC      ¦                                                                    
    ¦ BTX      ¦                                                                    
    ¦ BZG      ¦                                                                    
    ¦ CEC1     ¦                                                                    
    ¦ CEC2     ¦                                                                    
    ¦ CEC3     ¦                                                                    
    ¦ CMAS     ¦                                                                    
    ¦ CT       ¦                                                                    
    ¦ CUST     ¦                                                                    
    ¦ DAC      ¦                                                                    
    +----------+                                                                    
                                                                                    
     Select Library
  2. Use the arrow keys to select the first entry which is <LOGON> and press ENTER.

    The following window appears. You can either log on on to an existing library or add a new library.

     +-- New Library: --+  
     ¦                  ¦  
     +------------------+
  3. Specify the name "TUTORIAL".

    When the name of the library has eight characters, you need not press ENTER. In this case, you are automatically logged on to the library after you have entered the last character of the name.

    Since this is a new library which does not yet contain any objects, a message is shown indicating that the library is currently emtpy.

    Notes:

    1. If you want to log on to an existing library, you can also use the arrow keys to scroll through all libraries in the window. Or you can enter a character to proceed to the libraries that start with this character. Press ENTER to log on to the highlighted library.
    2. If you log on to a library which already contains objects, a list of objects in this library is shown. This list is is not shown when you log on using the Direct Command window as explained in the previous exercise.

Programming Modes

The programming mode is indicated in the Mode field at the top right-hand corner of the menu.

Natural provides two different programming modes:

  • Structured Mode
    Structured mode is intended for the implementation of complex applications with a clear and well-defined program structure. It is recommended to use structured mode exclusively.

  • Reporting Mode
    Reporting mode is only useful for the creation of adhoc reports and small programs which do not involve complex data and/or programming constructs.

Important:
This tutorial requires that structured mode is active. If you try to run your program in reporting mode, END-IF, END-READ and END-REPEAT will cause errors.

If reporting mode is currently active, proceed as described below.

Start of instruction setTo switch from reporting mode to structured mode

  • Invoke the Direct Command window (by choosing the Direct menu), enter the following system command and press ENTER:

    GLOBALS SM=ON

You can now proceed with your first program: Hello World!