New (Record constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
Line 22: Line 22:
</td></tr>
</td></tr>
<tr><th>lockstrength</th>
<tr><th>lockstrength</th>
<td>The value of a <var>Lockstrength</var> enumeration: <var>None</var>, <var>Share</var>, or <var>Exclusive</var>. These correspond to standard <var class="product">Model 204</var> record-locking levels, as described below. The default lock strength of the new record object is <var>Share</var>, matching the locking behavior of a <var class="product">User Language</var> <var>For Record Number</var> statement. <dl> <dt>None <dd>Record is not locked. <br> No locks are held on the object, so there is no conflict with others holding <var>Share</var> or <var>Exclusive</var> locks (readers and updaters may proceed). <dt>Share <dd>Record is share locked. <br> This level allows other users to hold a <var>Share</var> lock, but not an <var>Exclusive</var> lock (allows readers but not updaters to proceed). <dt>Exclusive <dd>Record is exclusively locked. <br> This level prohibits others from holding either an <var>Exclusive</var> lock or a <var>Share</var> lock. It is generally used for update. </dl>
<td>The strength of the lock to be used for the record referenced by the object. This value is a [[LockStrength_enumeration|LockStrength enumeration]] value: <var>None</var>, <var>Share</var>, or <var>Exclusive</var>.
</td></tr>
</td></tr>
<tr><th><var>LoopLockStrength</var></th>
<tr><th><var>LoopLockStrength</var></th>

Revision as of 13:03, 30 August 2012

Create a new Record object (Record class)

This shared function has one required parameter if in file context, two required parameters if in group context, and two optional parameters in either context. The parameters are applied by the New constructor to the newly instantiated object.

Syntax

%fileRecord = [%(Record In filOrGrp name):]New( number, [lockStrength], - [LoopLockStrength= lockStrength]) Throws RecordLockingConflict

%groupRecord = [%(Record In filOrGrp name):]New( number, string, - [lockStrength], - [LoopLockStrength= lockStrength]) Throws RecordLockingConflict

Syntax terms

%fileRecord A declared Record object variable in file context.
%groupRecord A declared Record object variable in group context.
[%(Record In filOrGrp name)] The optional class name in parentheses denotes a Constructor. See "Usage notes", below, for more information about invoking a Record Constructor.
number The number of the record to which the instantiated Record object will refer.
string For group context, the name of the file that contains the record that the instantiated Record object will reference.
lockstrength The strength of the lock to be used for the record referenced by the object. This value is a LockStrength enumeration value: None, Share, or Exclusive.
LoopLockStrength The lock strength to be used for For Record loops on the Record object. This is an optional, name required, parameter, and it defaults to None. See "LoopLockStrength for Records". This parameter is available under Sirius Mods 7.0 and later.

Usage notes

  • As described in "Using New or other Constructors", New can be invoked with no object, with an explicit class specification, or with an object variable in the class, even if that object is Null:

    %rec = new(share) %rec = %(Record in file sirLocal):new(exclusive) %rec = %rec:new(none)

    Note: As shown above, when explicitly indicating the class, both the class name and the file or group context must be specified just as they are on the Record variable's declaration.

  • The LockStrength returns the locking level of a Record object.
  • New is not the only way to instantiate a Record object. See "Instantiating Record objects".

See also