Object Locking

In a SPoD environment, Natural Studio provides a locking mechanism that prevents concurrent updating of Natural objects. These can be local Natural objects or objects accessed on a remote development server.

This document covers the following topics:


Object Locking Concept

When being edited in one of Natural Studio's editors or tools, the following Natural objects are locked:

Program
Subprogram
Subroutine
Copycode
Helproutine
Text
Dialog
Map
Class
Local data area
Global data area
Parameter data area
DDM
Application (only remote)

The locks are set exclusively by the editors or tools. If the objects are locked by an editor, the locked objects are unlocked as soon as you close the editor. If the objects are locked by a tool (for example, when local classes are changed using the Class Builder), the locked objects are unlocked when all internal links to the object are released. When you terminate your Natural session, all existing locks of that session are released.

Within your Natural session, you can edit different sources from different libraries in parallel in multiple editor sessions. In this case, a lock exists for all sources involved. You cannot edit the same source in different editor sessions, neither when you are in a single Natural session nor when you are in multiple Natural sessions. If you are using tools like the Class Builder, the object can be changed from all views; all views show the current state of the object.

Moving, Deleting and Renaming Objects

When you move, delete or rename a Natural source object, the locking state of the object concerned is checked:

  • When the source object is locked, command execution is rejected.

  • When the source object is not locked, the command is executed.

Saving and Stowing Objects

You can only save or stow a source object when you have opened it in an editor and have thus locked it.

Locking and Unlocking of Local and Remote Objects

Local Objects

Locking of sources in the local environment does not require the existence of a SPoD environment. It is accomplished by Windows operating system functions.

Remote Objects

Remote objects are locked only if they are edited using one of Natural Studio's local editors. The locks are managed by the development server and are stored as user-specific data in the Natural Development Server file.

Unlocking Objects

Natural Studio releases the lock held on an object as soon as the editor is closed. In the local environment, the operating system manages the release of the lock. In the remote environment, this is done by the Natural Development Server.

Unlocking Remote Objects in the Case of an Error

When Natural Studio looses the connection to the server (normally due to a hardware error) and is therefore unable to send an unlock request to the server, objects remain locked on the server even though the editor sessions are closed. The objects remain locked until they are manually unlocked (see below).

Unlocking Objects Manually

You can view Natural objects or documentation objects that are locked. If required, you can unlock them.

Note:
The Unlock Objects command removes only the lock entry from the Natural Development Server file. In case of a Windows development server, the lock in the operating system remains until the corresponding editor window is closed.

Start of instruction setTo unlock a locked object

  1. In the library workspace, select a remote environment.

    Note:
    In the local environment, unlocking of documentation objects is also possible, provided that Predict Version 4.4 or above is installed on Windows.

  2. Optional. Select the library containing the locked object.

    The library name will then be provided in the dialog box which is used for unlocking.

  3. From the Tools menu, choose Development Tools > Unlock Objects.

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

    Unlock objects

    A dialog box appears. The name of the library that is currently selected in library workspace is automatically provided.

    Unlock objects

    Note:
    Depending on the settings in the remote environment, additional options may be shown in the dialog box. See also Locking of Source Objects in the Editors documentation of Natural for Mainframes.

    See the description of the system command UNLOCK for detailed information on the options in this dialog box.

  4. It is possible to choose the OK button without entering any information in this dialog box.

    When locked objects exist, they are shown on the Unlock Objects tab of the results window. See also Results Windows in the documentation Using Natural Studio.

    Results window

  5. On the Unlock Objects tab, select the object that you want to unlock.

  6. Invoke the context menu and choose Unlock Objects.

    The object is still shown on the Unlock Objects tab. The Message column, however, indicates that the object has been unlocked.

    Note:
    If you want to remove the Unlock Objects tab from the results window, select any object on this tab, invoke the context menu and choose Delete Tab.

Natural Development Server Restrictions

The locking of source objects on a development server is supported only in a SPoD environment. The source objects are locked only when they are edited in Natural Studio.

To ensure correct object locking, you are strongly recommended to make changes on the same FUSER system file in a SPoD environment only. Avoid the use of the system command READ in a SPoD environment; it does not lock the object. Using the FUSER system file concurrently by another stand-alone, Natural session may lead to inconsistencies.

When working with Natural Studio, care must be taken to start all commands or utilities from within Natural Studio. It is not admissible to issue system commands in the terminal emulation window, for example at a MORE prompt or in a command line. In such a case, object locking will not be supported. Particularly, editing of source objects directly with the server's editors can provoke inconsistencies.

On the development server, certain prerequisites apply for the locking of source objects. For detailed information on these prerequisites, see the Natural Development Server documentation.