Show TOC

Procedure documentationCreating Objects Locate this document in the navigation structure

 

To create an object in an area instance version of the shared memory, you use the

... AREA HANDLE handle

addition of the statements

CREATE OBJECT oref

CREATE DATA dref (from Release 7.0)

handle must be an object reference variable that points to an area handle that is connected by a change lock to a building area instance version. The created object is stored in this area instance version and oref or dref refer to the object. When the instance of a class is created, it has to be shared memory-enabled.

Before the area instance version is built with the DETACH_COMMIT method, the SET_ROOT method of the area handle has to be used to define the root object. Once the area instance version is built with the DETACH_COMMIT method, no references from the area instance version may refer externally.

The following treatable exceptions may occur when objects are created:

  • CX_SHM_WRONG_HANDLE

    The area handle does not hold any change locks.

  • CX_SHM_ALREADY_DETACHED

    The area handle is not bound to an area instance version.

  • CX_SHM_OUT_OF_MEMORY

    Not enough memory is available (this exception can also occur when shared objects are used).

  • CX_SHM_OBJECT_NOT_SERIALIZABLE

    An attempt was made to create an object that cannot be serialized in an area instance that can be displaced with backup and recovery.

The creation of anonymous objects can lead to exception CX_SHM_EXTERNAL_TYPE if a dynamically created data type was used.