Managing Natural Objects

This document covers the following topics:


General Information on Copying and Moving Objects

This general information applies to the commands Cut, Copy and Paste and to drag-and-drop. Detailed information on how to copy and move objects is provided later in this section.

Note:
The Edit menu which contains the above commands is only shown when an editor window is currently active in the workspace. However, these commands can always be chosen (with the restrictions described below) from the context menu, from the toolbar or using a shortcut key.

You can copy and move nodes from the local environment to the remote environment, and vice versa.

You can copy and move nearly all of the nodes in the library workspace and in the various list views. This can be either a group node or a node for a single object. For example, you can copy all programs of a library by copying the Programs node which is available in the logical view of the library workspace. Or you can move all generated programs of a library by moving the Gp node which is available in the file view of the library workspace.

The following restrictions apply:

  • It is not possible to copy or move an object as long as the editor for this object is open.

  • It is not possible to copy or move a system file node.

  • The target node of a copy or move operation will only accept the objects of the selected source node when all objects can be copied or moved to the target node.

    Example: a list view window has been opened for a library in the flat view and you copy some of the objects. When you have also copied a Natural generated program, it is not possible to paste the objects on a Src node in the file view since the target node only accepts Natural source files. The Paste command is dimmed in this case.

  • A group node cannot be copied into another group node. It can only be copied to a library node.

    For example, it is not possible to copy the Programs node of a library into the Programs node of another library. However, it is possible to copy the Programs node onto another Programs node or onto the library node itself.

When you copy, for a example, a program, it is not possible to paste it in the same library. If you want to create a copy, you have to save the object with a new name (see Saving an Object with a New Name). However, it is possible to copy the contents of an entire library to the same system file. In this case, a dialog box appears prompting you to enter a new name for the library (see also Copying and Moving Libraries).

When you copy or move an object to another library in which an object of the type and with the same name exists already, and when you have activated the corresponding workspace option, a dialog box appears asking whether you really want to replace the existing object.

Since cut and copied data is stored on the Windows clipboard, you can also copy or move nodes to the Windows environment (export). Or you can copy or move, for example, an image from the Windows environment to a Natural library node; the image will then be available in a corresponding resource node (import).

Caution:
It is recommended that you copy and move objects only from within Natural Studio. When you copy and move Natural files in the file system (for example, when using the Windows Explorer to move a file from one directory into another directory), the library information in the file FILEDIR.SAG is not updated and the files are therefore not shown in Natural Studio. To update FILEDIR.SAG in such a case, you have to use the FTOUCH utility.

Copying Objects

You can copy the selected nodes by using the commands Copy and Paste or by using drag-and-drop.

When you are dragging nodes, the mouse pointer always indicates whether the copied objects can be dropped or not.

Tip:
In a list view window, it is possible to select more than one node.

Start of instruction setTo copy objects using menu commands

  1. Select one or more nodes.

  2. Invoke the context menu and choose Copy.

    Or:
    When the Edit toolbar is shown, choose the following toolbar button.

    Toolbar button

    Or:
    Press CTRL+C.

  3. Select the target node.

  4. Invoke the context menu and choose Paste.

    Or:
    When the Edit toolbar is shown, choose the following toolbar button.

    Toolbar button

    Or:
    Press CTRL+V.

Start of instruction setTo copy objects using drag-and-drop - left mouse button

  1. Select one or more nodes.

  2. Click and hold down the left mouse button.

  3. Drag the mouse to the node to which you want to copy the objects.

  4. Hold down CTRL.

  5. Release the mouse button and then CTRL.

    Caution:
    If you do not hold down CTRL before releasing the mouse button, the objects are moved.

    Note:
    The above description applies when the workspace option Context menu for drag-and-drop with left mouse button is not enabled (default). However, when you enable this option, you need not press CTRL. A context menu will then appear from which you can choose whether to copy or move the objects.

Start of instruction setTo copy objects using drag-and-drop - right mouse button

  1. Select one or more nodes.

  2. Click and hold down the right mouse button.

  3. Drag the mouse to the node to which you want to copy the objects.

  4. Release the mouse button.

  5. From the resulting context menu, choose Copy Here.

Moving Objects

You can move the selected nodes by using the commands Cut and Paste or by using drag-and-drop.

When you are dragging nodes, the mouse pointer always indicates whether the cut objects can be dropped or not.

The selected nodes are deleted at their original position and copied to the new position.

Tip:
In a list view window, it is possible to select more than one node.

Start of instruction setTo move objects using menu commands

  1. Select one or more nodes.

  2. Invoke the context menu and choose Cut.

    Or:
    When the Edit toolbar is shown, choose the following toolbar button.

    Toolbar button

    Or:
    Press CTRL+X.

  3. Select the target node.

  4. Invoke the context menu and choose Paste.

    Or:
    When the Edit toolbar is shown, choose the following toolbar button.

    Toolbar button

    Or:
    Press CTRL+V.

Start of instruction setTo move objects using drag-and-drop - left mouse button

  1. Select one or more nodes.

  2. Click and hold down the left mouse button.

  3. Drag the mouse to the node to which you want to move the objects.

  4. Release the mouse button.

    Notes:

    1. When the workspace option Context menu for drag-and-drop with left mouse button is enabled, a context menu will appear from which you can choose whether to copy or move the objects.
    2. When you are working with SPoD and drag an object to a different environment using the left mouse button (for example, from the local environment to a remote UNIX environment, or from a remote UNIX environment to a remote mainframe environment), the object is copied and not moved. The object is not deleted at its original position.

Start of instruction setTo move objects using drag-and-drop - right mouse button

  1. Select one or more nodes.

  2. Click and hold down the right mouse button.

  3. Drag the mouse to the node to which you want to move the objects.

  4. Release the mouse button.

  5. From the resulting context menu, choose Move Here.

Exporting Objects

You can export a node from the Natural environment to the Windows Explorer. This is helpful, for example, when you want to send one of your Natural source objects to an other user via e-mail.

To export a node, you use the Copy or Cut command of Natural Studio as described above and the Paste command of the Windows Explorer. You can also use drag-and-drop.

When you drag a node to the Windows environment using the left mouse button, it is always copied (it is not necessary to press CTRL in this case). When you use the right mouse button for drag-and-drop, you can select the appropriate command for copying or moving from a context menu.

When you export a group node (for example the Programs node which is available in the logical view), all sources and generated programs are copied or moved. When both source and generated program are available for an object, two files will then be available in the Windows environment. The extension indicates the type of file. Example: "NSP" stands for Natural source program and "NGP" stands for Natural generated program.

Importing Objects

You can import files from the Windows Explorer to the Natural environment. This is helpful, for example, when you have received a Natural source object via e-mail.

To import files, you use the Copy or Cut command of the Windows Explorer and the Paste command of Natural Studio as described above. You can also use drag-and-drop.

When you drag a file to the Natural environment using the left mouse button, the file is always copied (it is not necessary to press CTRL in this case).

When you select a folder name in the Windows Explorer and then import this folder, only the content of the folder is imported. Subfolders are not imported. To import the content of a subfolder, either select the subfolder name or display its contents and select the required objects. When an object is imported which has a file extension unknown to Natural, it is stored as a resource.

Important:
Before the import is started, it is important to set the proper programming mode (structured mode or reporting mode) in which the Natural objects to be imported were developed, otherwise some of them might not be compiled. To set the programming mode, you can either set the compiler option SM as described in Using Session Parameters, or you can enter the system command GLOBALS with the following values in the command line: GLOBALS SM=ON (structured mode) or GLOBALS SM=OFF (reporting mode). See also Natural Programming Modes in the Programming Guide.

Renaming Objects

A subroutine cannot be renamed in the logical view. This is because the logical view always shows the subroutine name that has been defined in the program (which may exceed 8 characters). The flat view and file view show the name that has been defined when saving the subroutine; this can be renamed.

Tip:
It is recommended that you rename objects in the logical view. When you rename, for example, a source in the file view for which a generated object exists, only the source is renamed; a new generated program with the new name is not created. The existing generated program is not renamed.

Note:
You can also rename an object by entering the system command RENAME in the command line. In this case, a dialog box appears in which it is also possible to change the type.

See also Renaming Libraries.

Start of instruction setTo rename an object

  1. Select the node that is to be renamed.

    Note:
    Only one object can be renamed at a time. If several objects are selected in a list view window, the Rename command is only applied to the object which has the focus.

  2. From the Object menu, choose Rename.

    Or:
    Invoke the context menu and choose Rename.

    Or:
    Press F2.

    The name is selected so that you can immediately enter a new name. Any text you enter automatically deletes the selection.

    Note:
    If you want to cancel your modifications, press ESC.

  3. Enter a new name for the object.

    See also Object Naming Conventions.

    Note:
    When the name is in edit mode, you can invoke a context menu. In addition to the standard Windows editing commands such as Cut and Paste, the context menu may also contain Windows commands for Unicode. See your Windows documentation for further information.

  4. Press ENTER.

    Or:
    Click any other position in the library workspace or list view window.

    When a filter is currently active, it may happen that the renamed object is not shown since its name now starts with different characters. See Filtering Libraries and Objects for further information.

Changing the Type of a Natural Object

You can change the type of any object except a DDM, map, or dialog. For the remaining objects, the following restrictions apply:

  • A data area can be converted only to another type of data area: local, global or parameter.

  • A programming object can be converted only to another type of programming object: program, subprogram, subroutine, helproutine, function, copycode or text.

Note:
You can also change the object type by entering the system command RENAME in the command line. In this case, a dialog box appears in which it is also possible to rename the object.

Start of instruction setTo change the object type

  1. Open the object so that it is shown in an editor window. See Opening an Existing Natural Object.

  2. Make sure that the editor window is the active window.

  3. From the Object menu, choose Object Type > object-type.

    Only the allowed object types are available from the menu.

    The new type is indicated in the title bar of the editor window.

  4. Save the object to make the conversion complete.

Changing the Code Page of a Natural Object

The code page is defined in the properties of an object. If available for the selected object type, you can invoke an Encoding dialog box from the Properties dialog box. See Properties for the Nodes for further information.

Changing the code page of an object means that the encoding information which is stored in the file FILEDIR.SAG is changed; it does not mean that the contents of the object is converted in any way. If you want to convert an object to a different code page, you have to open the object and save it with the Save As command; you can then select the desired encoding in the Save As dialog box (see Saving an Object with a New Name).

For further information on code pages, see the Unicode and Code Page Support documentation.

Deleting Objects

When you delete an object in the logical view or flat view, both source and generated program are deleted.

You can delete, for example, all programs in a library by deleting the Programs node in the logical view. Or you can delete only the generated programs in a library by deleting the Gp node in the file view.

It is not possible to delete an object when the editor window for this object is currently open.

See also Deleting Libraries.

Note:
You can also delete objects by entering the system command SCRATCH, PURGE or UNCATALOG in the command line. A dialog box appears for each of these system commands and you can select the objects to be deleted.

Start of instruction setTo delete objects

  1. Select one or more nodes.

    Tip:
    In a list view window, it is possible to select more than one node.

  2. From the Object menu, choose Delete.

    Or:
    Invoke the context menu and choose Delete.

    Or:
    Press DEL.

    When the corresponding workspace option has been set, you are prompted to confirm the deletion.

Printing Objects and Views

There are two different types of print command. You can either print an object or the content of a view. The object or view is printed on a printer that is defined in Windows.

The layout of the printed page is defined in the Options dialog box. See Printing Options for further information.

The following topics are covered below:

Printing Objects

When you print an object, its source code is printed. In the case of an object which has a graphical representation (such as a dialog or map), the source code as generated by Natural is printed.

If the source is partially collapsed in the program editor (see Showing and Hiding Source Code in the Program Editor section of the Editors documentation), the hidden lines are not printed.

Note:
The description below does not apply to resources. See Managing Resources.

Start of instruction setTo print objects

  1. Activate the editor containing the object that you want to print.

    Or:
    Select the object in the library workspace or application workspace.

    Or:
    Select one or more objects in a list view window.

  2. From the Object menu, choose Print.

    Or:
    Invoke the context menu and choose Print (not possible in the editor window).

    Or:
    When the Object toolbar is shown, choose the following toolbar button.

    Toolbar button

    Or:
    Press CTRL+P.

    The Print dialog box appears.

  3. Specify all required information (for example, a different printer or text orientation) and choose the Print button.

Printing Views

You can print the contents of tree view windows and list view windows.

  • Tree Views
    A tree view is printed graphically. The printout is a copy of the tree view. The font will appear as on the screen; it cannot be changed.

    You can print, for example, the current layout of the library workspace. When a node is expanded in the tree view, it is also expanded on the printout; when a node is not expanded in the tree view, it is not expanded in the printout.

    When a node is currently selected in the tree view, this node is taken as the starting point for the printout; the nodes above are not contained in the printout.

  • List Views
    A list view is printed as normal text in column format. Therefore, a different font can be defined in the printing options.

    When one or more group nodes are selected in the list view window, the list views for these nodes are printed (that is, the list views that are normally displayed when you open such a node). A separate printout is then available for each selected group node. When a node is not selected, the current list view is printed.

    You can suppress printing of specific columns in the current list view. To do so, resize the column in the list view window so that it is no longer visible. See also List View Windows.

    The current width of a column is not considered. The printout always contains the entire text in a column.

Start of instruction setTo print a tree view or list view

  1. Activate the window for which you want to print a view (either a tree view window or a list view window).

  2. Optional. Select a node if the printout is to contain the output described above.

  3. From the View menu, choose Print View.

    In a tree view window, it is also possible to choose command from the context menu, but only when a node is not selected.

    The Print dialog box appears.

  4. Specify all required information (for example, a different printer or text orientation) and choose the Print button.

Refreshing the Display

Usually when something changes in Natural Studio, the display is automatically refreshed. This happens, for example, when objects are created, renamed or deleted. This automatic refresh requires that the corresponding option has been set in the workspace options.

There are, however, situations where an automatic refresh does not take place, since Natural is not aware of a modification. For example, two Natural processes are currently active and both are working on the same system file. When one Natural is applying a change to the system file (such as creating a new object), the second Natural is not aware of this modification. In this case, you have to refresh the display manually.

A manual refresh can only be performed on a selected system file node or library node (in the library workspace, application workspace or in a list view window). It can be performed in both the local and remote environment.

Start of instruction setTo refresh the display manually

  1. Select the system file node or library node to be refreshed.

  2. From the View menu, choose Refresh.

    Or:
    From the context menu, choose Refresh.

    Or:
    Press F5.