Dataset class: Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The <var>Dataset</var> class provides an object-oriented interface to sequential datasets.
The <var>Dataset</var> class provides an object-oriented interface to sequential datasets.
This interface is more flexible than the traditional image-oriented
This interface is more flexible than the [[Images|traditional image-oriented interface]] used in <var class="product">SOUL</var>.
interface used in <var class="product">User Language</var>.
In addition, the class provides <var class="product">SOUL</var> access to <var class="product">Model&nbsp;204</var> streams &mdash;
In addition, the class provides <var class="product">User Language</var> access to <var class="product">Model 204</var> streams &mdash;
datastreams composed of one or more sequential data sets via the <var class="product">Model 204</var>
datastreams composed of one or more sequential datasets via the <var class="product">Model 204</var>
<var>[[DEFINE_STREAM_command|DEFINE STREAM]]</var> command.
<var>[[DEFINE_STREAM_command|DEFINE STREAM]]</var> command (see the <var class="product">[http://www.cca-int.com/custsupp/documentation/catalog.html Model 204 Command Reference Manual]</var>).
   
   
The <var>Dataset</var> class is available in <var class="product">Sirius Mods</var> 7.2 and later.
The <var>Dataset</var> class is available in <var class="product">Sirius Mods</var> 7.2 and later.
Beginning with Model 204 version 7.9, the <var>Dataset</var> class now supports read only access to VSAM datasets.
   
   
The <var>Dataset</var> class operates on datasets or streams defined by any of the
The <var>Dataset</var> class operates on data sets or streams defined by any of the following:
following:
<ul>
<ul>
<li>An MVS DD card.
<li>An MVS DD card.
<li>A VSE DLBL card.
<li>A VSE DLBL card.
<li>A CMS FILEDEF command.
<li>A CMS FILEDEF command.
<li>A <var class="product">Model 204</var> <var>ALLOCATE</var> command (see the <i>Model 204 Command Reference Manual</i>).
<li>A <var class="product">Model 204</var> <var>[[ALLOCATE command|ALLOCATE]]</var> command.
<li>A <var class="product">Model 204</var> <var>DEFINE STREAM</var> command (see the <i>Model 204 Command Reference Manual</i>).
<li>A <var class="product">Model 204</var> <var>DEFINE STREAM</var> command.
</ul>
</ul>
   
   
Line 23: Line 23:


==Dataset example==
==Dataset example==
The following simple example is a program that displays the contents of a
The following simple example is a program that displays the contents of
sequential dataset:
sequential dataset (or stream) <code>SEQIN</code>:
<p class="code">ALLOCATE SEQIN WITH SCOPE=SYSTEM OLD SEQUENTIAL -
<p class="code">b
  DSNAME=PROD.TEST.DATA
begin
%ds is object dataset
%ds is object dataset
%l  is longstring
%l  is longstring
Line 42: Line 43:
end
end
</p>
</p>
'''Note:'''
<p class="note">'''Note:'''
If you want to do more extensive work with <var class="product">Model 204</var> journals,
If you want to do more extensive work with <var class="product">Model 204</var> journals,
the <var>[[Journal class|Journal]]</var> class is designed for that purpose.
the <var>[[Journal class|Journal]]</var> class is designed for that purpose. </p>


==The RecordFormat enumeration==
==The RecordFormat enumeration==
The <var>RecordFormat</var> [[Enumerations|enumeration]] indicates the format of the blocks in the sequential
The <var>RecordFormat</var> [[Enumerations|enumeration]] indicates the format of the blocks in the sequential dataset.
dataset.
While, strictly speaking, the <var>RecordFormat</var> enumeration actually describes block
While, strictly speaking, the <var>RecordFormat</var> enumeration actually describes block
formats or maybe file formats, it corresponds to the RECFM value used in DD cards,
formats or maybe file formats, it corresponds to the RECFM value used in DD cards,
Line 54: Line 54:
   
   
The values of the <var>RecordFormat</var> enumeration are:
The values of the <var>RecordFormat</var> enumeration are:
<table>
<table class="thJustBold">
<tr><th>U
<tr><th>U
</th><td>Undefined format (each block is treated as a single record).
</th><td>Undefined format (each block is treated as a single record).
</td></tr>
</td></tr>
<tr><th>F
<tr><th>F
</th><td>Fixed format (each block contains one fixed length record).
</th><td>Fixed format (each block contains one fixed length record).
</td></tr>
</td></tr>
<tr><th>V
<tr><th>V
</th><td>Variable format (each block contains one variable length record).
</th><td>Variable format (each block contains one variable length record).
</td></tr>
</td></tr>
<tr><th>FB
<tr><th>FB
</th><td>Fixed blocked format (each block contains one or more fixed length records).
</th><td>Fixed blocked format (each block contains one or more fixed length records).
</td></tr>
</td></tr>
<tr><th>VB
<tr><th>VB
</th><td>Variable blocked format (each block contains one or more variable length records).
</th><td>Variable blocked format (each block contains one or more variable length records).
</td></tr></table>
</td></tr></table>


'''Note:''' As with all enumerations, the <var>ToString</var> method implicitly converts an enumeration value to a character string whose value is the name of the enumeration value. For more information about methods available to all enumerations, see [[Enumerations#Common enumeration methods|"Common enumeration methods"]].
<p class="note">'''Note:''' As with all enumerations, the <var>ToString</var> method implicitly converts an enumeration value to a character string whose value is the name of the enumeration value. For more information about methods available to all enumerations, see [[Enumerations#Common enumeration methods|Common enumeration methods]]. </p>


==The DatasetState enumeration==
==The DatasetState enumeration==
Line 81: Line 85:
   
   
The values of the <var>DatasetState</var> enumeration are:
The values of the <var>DatasetState</var> enumeration are:
<table>
<table class="thJustBold">
<tr><th>Closed
<tr><th>Closed
</th><td>Object has just been created or just closed.
</th><td>Object has just been created or just closed.
</td></tr>
</td></tr>
<tr><th>Open
<tr><th>Open
</th><td>Object has been opened and can either be read from or written to.
</th><td>Object has been opened and can either be read from or written to.
</td></tr>
</td></tr>
<tr><th>AfterEnd
<tr><th>AfterEnd
</th><td>Last read from object detected end of file.
</th><td>Last read from object detected end of file.
</td></tr>
</td></tr>
<tr><th>Full
<tr><th>Full
</th><td>Last write to object detected a file full condition.
</th><td>Last write to object detected a file full condition.
Line 96: Line 103:


==List of Dataset methods==
==List of Dataset methods==
The [[List of Dataset methods|"List of Dataset methods"]] shows all the class methods.
The [[List of Dataset methods]] shows all the class methods.


[[Category:System classes]]
[[Category:System classes]]

Latest revision as of 15:35, 14 April 2021

The Dataset class provides an object-oriented interface to sequential datasets. This interface is more flexible than the traditional image-oriented interface used in SOUL. In addition, the class provides SOUL access to Model 204 streams — datastreams composed of one or more sequential data sets via the Model 204 DEFINE STREAM command.

The Dataset class is available in Sirius Mods 7.2 and later.

Beginning with Model 204 version 7.9, the Dataset class now supports read only access to VSAM datasets.

The Dataset class operates on data sets or streams defined by any of the following:

  • An MVS DD card.
  • A VSE DLBL card.
  • A CMS FILEDEF command.
  • A Model 204 ALLOCATE command.
  • A Model 204 DEFINE STREAM command.

The Dataset class uses two class-specific enumerations: RecordFormat and DatasetState.

Dataset example

The following simple example is a program that displays the contents of a sequential dataset:

ALLOCATE SEQIN WITH SCOPE=SYSTEM OLD SEQUENTIAL - DSNAME=PROD.TEST.DATA begin %ds is object dataset %l is longstring %ds = new('SEQIN') %ds:open repeat forever %l = %ds:readRecord if %ds:state eq afterEnd then loop end end if print %l end repeat end

Note: If you want to do more extensive work with Model 204 journals, the Journal class is designed for that purpose.

The RecordFormat enumeration

The RecordFormat enumeration indicates the format of the blocks in the sequential dataset. While, strictly speaking, the RecordFormat enumeration actually describes block formats or maybe file formats, it corresponds to the RECFM value used in DD cards, ALLOCATE statements, etc., so the term RecordFormat was used.

The values of the RecordFormat enumeration are:

U Undefined format (each block is treated as a single record).
F Fixed format (each block contains one fixed length record).
V Variable format (each block contains one variable length record).
FB Fixed blocked format (each block contains one or more fixed length records).
VB Variable blocked format (each block contains one or more variable length records).

Note: As with all enumerations, the ToString method implicitly converts an enumeration value to a character string whose value is the name of the enumeration value. For more information about methods available to all enumerations, see Common enumeration methods.

The DatasetState enumeration

The DatasetState enumeration describes the current state of a Dataset object. A newly created Dataset object starts in the Closed state and then changes state as certain methods are performed on it. Certain methods are restricted to Dataset objects in a particular subset of states.

The values of the DatasetState enumeration are:

Closed Object has just been created or just closed.
Open Object has been opened and can either be read from or written to.
AfterEnd Last read from object detected end of file.
Full Last write to object detected a file full condition.

List of Dataset methods

The List of Dataset methods shows all the class methods.