WriteRecord (Dataset subroutine)

From m204wiki
Revision as of 00:41, 15 November 2012 by JAL (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Write a record to this dataset (Dataset class)


Syntax

dataset:WriteRecord( string) Throws WriteError

Syntax terms

dataset A reference to an instance of a Dataset object.
string A string or longstring variable that contains the records to be written.

Usage notes

  • To use the WriteRecord method, the Dataset object must be an output object, that is, its Output value must be True. Using WriteRecord against an input dataset results in request cancellation.
  • The Dataset object must be in the Open state to use the WriteRecord method. Using WriteRecord against a dataset in the Closed or Full state results in request cancellation.
  • If a WriteRecord method is used after a WriteRecord method, the block containing the record written by the preceding WriteRecord is written, if it has not already been written.
  • For F and FB format files, the output string written by WriteRecord must be shorter than or equal in length to the value of RecordLength. Records shorter than the RecordLength value are padded with blanks so their length exactly equals the RecordLength. Output strings that are too long result in request cancellation.
  • For V and VB format files, the output string written by WriteRecord must be shorter than or equal in length to the RecordLength value minus four. Four is subtracted because the WriteRecord method adds the required RDW before the record. This is true even under CMS, where records are not really stored on disks with BDWs and RDWs — they are mapped from the MVS format to the CMS format by BSAM simulation. Output strings that are too long result in request cancellation.
  • If there is no more room for a WriteRecord in a file, the dataset switches from the Open to the Full state. After this, a WriteRecord or WriteBlock results in request cancellation.
  • Since WriteRecord blocks the data before writing it, WriteRecord usually returns before the data has actually been written to disk. As such, it is possible that data written by a previous WriteRecord might not have actually been written to disk, either because of an I/O error or, more likely, because the file filled.

    See also