New (Record constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 26: Line 26:
<td>The value of a Lockstrength 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 value of a Lockstrength 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></tr>
</td></tr>
<tr><th><b>LoopLockStrength=</b>lockstrength</th>
<tr><th>LoopLockStrength=lockstrength</th>
<td>The lock strength to be used for <var>For Record</var> loops on the <var>Record</var> object. This is an optional, name required, parameter, and it defaults to <var>None</var>. See [[Record class#LoopLockStrength for Records|"LoopLockStrength for Records"]]. This parameter is available under <var class="product">Sirius Mods</var> 7.0 and later.
<td>The lock strength to be used for <var>For Record</var> loops on the <var>Record</var> object. This is an optional, name required, parameter, and it defaults to <var>None</var>. See [[Record class#LoopLockStrength for Records|"LoopLockStrength for Records"]]. This parameter is available under <var class="product">Sirius Mods</var> 7.0 and later.



Revision as of 21:52, 20 April 2011

Create a new Record object (Record class)


This shared function instantiates a Record object. It has one required parameter if in file context, two required parameters if in group context, and one optional parameter in either context.

The parameters are applied by the New constructor to the newly instantiated object.

Syntax

%groupRecord = %(Record):New( number, string, [lockStrength], - [LoopLockStrength= lockStrength])

Syntax terms

%filerec A declared Record object variable in file context.
%grouprec A declared Record object variable in group context.
recnum The number of the record to which the instantiated Record object will refer.
filename For group context, the name of the file that contains the record that the instantiated Record object will reference.
lockstr The value of a Lockstrength enumeration: None, Share, or Exclusive. These correspond to standard Model 204 record-locking levels, as described below. The default lock strength of the new record object is Share, matching the locking behavior of a User Language For Record Number statement.
None
Record is not locked.
No locks are held on the object, so there is no conflict with others holding Share or Exclusive locks (readers and updaters may proceed).
Share
Record is share locked.
This level allows other users to hold a Share lock, but not an Exclusive lock (allows readers but not updaters to proceed).
Exclusive
Record is exclusively locked.
This level prohibits others from holding either an Exclusive lock or a Share lock. It is generally used for update.
LoopLockStrength=lockstrength 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

  • New is a constructor and as such can be called with no object, with an explicit class name, or with an object variable, even if that object is null:

    %rec = new(share) %rec = %(Record):new(exclusive) %rec = %rec:new(none)

  • The LockStrength returns the locking level of a Record object.
  • For more information about constructors, see "Creating object instances"
  • For more information about using New, see "Using New to instantiate a Record object".

See also