Open method: Tree class

Syntax

Open(SetID, UserKeyValue, TreeName, EffDt, BranchName, Update)

Description

The Open method opens the tree object specified by the parameters. The Open method can be used only with a closed tree, it cannot be used on an open tree. You cannot read or set any properties of a tree until after you open it. When you open a tree, you can specify whether you want to open it for update, or in read-only mode, with the Update parameter. If you try updating or writing to a tree opened in read-only mode, you receive an error.

Note:

Because EFFDT is a key field for a tree definition, an exact match is required to open a tree with the Open method. A less restrictive method, OpenAsOfDate, provides an alternative to Open by specifying an AsOfDate parameter instead of the EffDt parameter.

Parameters

Parameter Description

SetID

Specify the table indirection key for the tree. This parameter takes a string value. If the tree structure the tree is based on has its IndirectionMethod specified as "S", you must specify a SetID.

If the tree structure doesn’t have its IndirectionMethod specified as "S", you must enter a Null string (that is, two quotation marks with no blank space between them ("")) for this parameter.

UserKeyValue

Specify the User Key value for the tree. This parameter takes a string value. If the tree structure the tree is based on has its IndirectionMethod specified as "U" or "B", you must specify a User Key Value.

If the tree structure doesn’t have its IndirectionMethod specified as "U" or "B", you must enter a Null string (that is, two quotation marks with no blank space between them ("")) for this parameter.

TreeName

Specify the name for the tree. This parameter takes a string value.

EffDt

Specify the effective date for the tree. This parameter takes a string value. The format must be in the correct format for the database platform the code is executing on.

BranchName

This parameter is required, but it is unused in this release. You must enter a Null string (that is, two quotation marks with no blank space between them ("")) for this parameter.

Update

Specify if you want to open the tree for update or in read-only mode. This parameter takes a Boolean value. Values for Update are:

  • True: open tree structure in update mode (read/write).

  • False: open tree structure in read-only mode.

If you try updating or writing to a tree structure opened in read-only mode, you receive an error.

Returns

An integer: 0 if opened successfully.

Example

The following example opens a tree object, then tests to see if the tree was actually opened:

&RSLT = &MYTREE.Open("","","PERSONAL_DATA", "05-05-1997", "", True);

If &RSLT = 0 Then 
   /* normal processing */ 
Else 
   /* error processing tree isn't open */ 
End-if;