Dataset class: Difference between revisions
Line 49: | Line 49: | ||
the <var>[[Journal class|Journal]]</var> class is designed for that purpose. | the <var>[[Journal class|Journal]]</var> class is designed for that purpose. | ||
==The RecordFormat enumeration== | ==The RecordFormat enumeration== | ||
The <var>RecordFormat</var> 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, | ||
ALLOCATE statements, etc., so the term <var>RecordFormat</var> was used. | <var>ALLOCATE</var> statements, etc., so the term <var>RecordFormat</var> was used. | ||
The values of the <var>RecordFormat</var> enumeration are: | The values of the <var>RecordFormat</var> enumeration are: | ||
Line 72: | Line 72: | ||
</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"]]. | |||
==The DatasetState enumeration== | ==The DatasetState enumeration== | ||
The <var>DatasetState</var> enumeration describes the current state of a <var>Dataset</var> object. | The <var>DatasetState</var> enumeration describes the current state of a <var>Dataset</var> object. |
Revision as of 21:14, 16 August 2011
The Dataset class provides an object-oriented interface to sequential datasets. This interface is more flexible than the traditional image-oriented interface used in User Language. In addition, the class provides User Language access to Model 204 streams — datastreams composed of one or more sequential datasets via the Model 204 DEFINE STREAM command (see the Model 204 Command Reference Manual).
The Dataset class is available in Sirius Mods 7.2 and later.
The Dataset class operates on datasets 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 (see the Model 204 Command Reference Manual).
- A Model 204 DEFINE STREAM command (see the Model 204 Command Reference Manual).
The Dataset class uses two class-specific enumerations: RecordFormat and DatasetState.
The "List of Dataset methods" lists all the methods in this class.
Dataset example
The following simple example is a program that displays the contents of sequential dataset (or stream) SEQIN:
b %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. |
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".