New (Dataset constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by 2 users not shown)
Line 7: Line 7:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%dataset</th>
<tr><th>%dataset</th>
<td>A variable to receive a reference to the newly created
<td>A variable to receive a reference to the newly created <var>Dataset</var> object.
<var>Dataset</var> object.
</td></tr>
</td></tr>
<tr><th><var>[%(Dataset):]</var></th>
<tr><th><var>[%(Dataset):]</var></th>
<td>The optional class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See [[#Usage notes|"Usage notes"]], below, for more information about invoking a <var>Dataset</var> <var>Constructor</var>.
<td>The optional class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See [[#Usage notes|"Usage notes"]], below, for more information about invoking a <var>Dataset</var> <var>Constructor</var>.
</td></tr>
</td></tr>
<tr><th>ddname</th>
 
<tr><th>string</th>
<td>The name of the dataset or stream to be associated with the <var>Dataset</var> object. This is a required argument.
<td>The name of the dataset or stream to be associated with the <var>Dataset</var> object. This is a required argument.
   
   
Line 20: Line 21:
==Usage notes==
==Usage notes==
<ul>
<ul>
<li>As described in [[Object variables#Using New or other Constructors|"Using New or other Constructors"]], <var>New</var> can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is <var>Null</var>:<p class="code">%dataset = new
<li>As described in [[Object variables#Using New or other Constructors|"Using New or other Constructors"]], <var>New</var> can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is <var>Null</var>:<p class="code">%dataset = new('SEQIN')


%dataset = %(Dataset):new
%dataset = %(Dataset):new('SEQIN')


%dataset = %dataset:new
%dataset = %dataset:new('SEQIN')
</p>
</p>
<li>The dataset name must be 8 characters or shorter and cannot contain
<li>The dataset name must be 8 characters or shorter and cannot contain
Line 38: Line 39:
a reliable check, so it is not done.
a reliable check, so it is not done.
</ul>
</ul>
==See also==
==See also==
{{Template:Dataset:New footer}}
{{Template:Dataset:New footer}}

Latest revision as of 20:00, 31 January 2013

Create a new dataset object (Dataset class)


This constructor creates a new instance of a Dataset object.

Syntax

%dataset = [%(Dataset):]New( string)

Syntax terms

%dataset A variable to receive a reference to the newly created Dataset object.
[%(Dataset):] The optional class name in parentheses denotes a Constructor. See "Usage notes", below, for more information about invoking a Dataset Constructor.
string The name of the dataset or stream to be associated with the Dataset object. This is a required argument.

Usage notes

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

    %dataset = new('SEQIN') %dataset = %(Dataset):new('SEQIN') %dataset = %dataset:new('SEQIN')

  • The dataset name must be 8 characters or shorter and cannot contain leading or intermediate blanks. It also cannot contain other characters not allowed in dataset or stream names. Failure to conform to these rules results in request cancellation.
  • The New constructor does not validate that the Dataset is allocated or the stream defined. This is because a dataset can be allocated or freed before it is actually opened, or a stream could be defined or deleted before it is opened. As such, checking dataset or stream existence at New time wouldn't be a reliable check, so it is not done.

See also