WRITE - IBM Mainframe

The WRITE command is to write a new record to a file on either a local or remote system. The required data must be moved into the working storage area of the record to be added before issuing the WRITE command. When the WRITE is successful the record will be added to the file. This command can also be used in writing a file to a CICS-maintained data table, which then updates both the source VSAM KSDS and the in-memory data table, unless the XDTAD user exit rejects the record from the table. The command format is the same for both the CICS-maintained table and a VSAM KSDS file. When writing to a VSAM ESDS file, the record is always added at the end of the file. VSAM will not use the RIDFLD option data area containing the key when calculating the RBA of the new record, but the new RBA is returned to the application program in the RIDFLD option data area.

When writing to a VSAM/KSDS file, the record will be added to the file based on the key value in the RIDFLD option data area. This key value must match the key in the record to be added. ESDS and KSDS records can be of either fixed-length or variable-length formats. But those records for a relative record file must be fixed-length. MASSINSERT operations must proceed with ascending keys, and must be terminated by an UNLOCK before another request to the same dataset. The syntax of the WRITE command is given below:

The various options are given below:

FILE (filename) - Contains the name of the file to be accessed. The FCT entry for the filename will determine where the location (local or remote) of the data set resides. However, when the SYSID option is used, the location of the filename is assumed to exist on a remote system regardless of what the entry has defined in the FCT if one exists on the local system.

  • FROM (data_area) - Option specifies the storage location containing the record to be written out to the file.
  • KEYLENGTH (data_value) - Halfword binary length (PIC S9(4) comp) returning the length of the key.

The common handle conditions are DISABLED, DUPREC, FILENOTFOUND, ILLOGIC, INVREQ, IOERR, ISCINVREQ, LENGERR, NOSPACE, NOTAUTH, NOTOPEN, and SYSIDERR.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

IBM Mainframe Topics