WRITE-FILE

File 203
Statement PROCESS
Task This view makes it possible to write data to a file or to an LMS element. See also WRITE-SPOOL Programming Notes at the bottom of this view description.

Relevant Error Codes

Code Text
530 Access denied by Security Facility.
531 Password missing or incorrect.
551 Member not specified.
556 File is in use.
560 Segment length greater than 253.
565 Syntax error in dataset name.
590 End-of-data reached during UPDATE-INPLACE.
592 Record length error for variable UPDATE-INPLACE.
678 Member already exists.
692 You are not permitted to access member.
699 Not enough main storage available.
700 Invalid value specified (DSORG/RECFM/TYPE).
701 DSNAME missing.
722 Requested dataset not found.
733 User ID does not exist.
737 No more index space for inserting record.
798 Task was not started under TSOS.
799 Entire Systems Management Adapter internal error.
854 Permanent I/O error.
856 Operator unable to mount volume.
870 RECORD field not in search buffer.
872 Record format not supported.
873 Record length missing.
874 RECORD-LENGTH > LRECL.
875 Position of data field > RECORD-LENGTH.
881 Error occurred while opening file.
882 Error occurred while closing file.
883 Dataset is full.
889 Permanent I/O error while writing dataset.
899 Permanent I/O error while reading dataset.
981 Invalid value specified (BLKCTRL/BLKSIZE/LRECL).
982 Error during use of ISAM key.
983 UPDATE-INPLACE not supported by LMS.
985 Access to tape file not allowed.
991 Unknown product.
993 Open error.
998 Member not found.

Field Descriptions

Dictionary Field Name Format/

Length/

Desc/

Mu

Description

DISP (A3) Disposition of file. Possible values:
  D MOD Add records to the end of sequential file.
    NEW Create new file.
    STR Only for ISAM files:
    Replace or add records identified by the
    value in KEY.
DSNAME (A54) Required. Fully qualified file name.
  D  
DUPLICATE-KEY (A3) For ISAM only:
  D NO Default. No duplicate keys allowed.
    YES Duplicate keys allowed.
ELEMENT (A64) Name of the LMS element to be written.
  D  
ELEMENT-PASSWORD (A8) Password for protected LMS element.
  D  
ELEMENT-RECORD-TYPE (N3) Record type (LMS only).
  D  
ELEMENT-TYPE (A8) Type of LMS element to be written.
  D Types C and L are not supported.
ELEMENT-USER-DATE (A14) Is written as element information into LMS library. Format: YYYY-MM-DDaaaa, where aaaa can be any 4-character string.
  D  
ELEMENT-USER-TIME (A8) Is written as element information into LMS library. Format: HH:MM:SS.
  D  
ELEMENT-VERSION (A24) Version of LMS element to be written.
  D  
EXPIRATION-DATE (A5) The file's new expiration date in format YYDDD.
  D  
EXPIRATION-DATX (D) Expiration date in Natural format.
  D  
FUNCTION (A8) Function to be performed. Possible options:
  D Blank Default. Write a record.
    CLOSE All records have been written.
    Specify this on the last request.
IDENTIFIER (A8) Required if multiple update views are executing in parallel. All requests for the same view must have the same identifier.
  D  
KEY (A253) ISAM key.
  D  
LMS-RESET-FLAG (A3) If YES is specified in this field with FUNCTION=CLOSE, all previous writes for this LMS element are reset.
  D  
PAD (N2) Only for ISAM: padding factor (default is 15).
  D  
PASSWORD (A8) Password for protected file.
  D  
PRODUCT (A1) Access method used:
  D M LMS
RECORD (A253) Record to be written.
  D  
RECORD-LENGTH (N5) Length of record (used only if record format is variable). Can be omitted.
  D  
RECORD-NUMBER (N9) Number of record to be written.
  D  
SEGMENT-LENGTH (N3) Length of segment.
  D  
SEGMENT-NUMBER (N5) Number of segment. If SEGMENT-NUMBER=1, a new logical record is started. If SEGMENT-NUMBER > 1, the segment is a continuation.
  D  
TAPE-UNLOAD (A3) Unload TAPE during CLOSE:
  D NO Rewind tape to the beginning (default).
    YES Unload tape.
UPDATE-INPLACE (A3) Possible options:
  D NO Don’t update existing record in place
    (default).
    YES Update record in place.

WRITE-FILE Programming Notes

WRITE-FILE is an UPDATE view, that is, data is transmitted from the Natural program (client side) to ESA (server side).

The Entire Systems Management Adapter view WRITE-FILE returns error codes and error messages that describe whether the requested operation has been executed successfully or not. The DEFINE DATA section of the Natural program should only contain the fields shown below:

1 WRITE-SPOOL VIEW OF WRITE-SPOOL
  2 ERROR-CODE
  2 ERROR-TEXT
  2 SYSTEM-MESSAGE-CODE
  2 SYSTEM-CODE

These fields in DEFINE DATA are the fields returned from the WRITE-FILE view in Entire Systems Management Adapter to the calling Natural program. It is not necessary to define any other fields in the DDM; accessing any fields other than those above may lead to unpredictable results.