Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

WRITE statement

The WRITE statement can be used with SEQUENTIAL UPDATE files (if VSAM), with DIRECT UPDATE files, and with any OUTPUT file. It transmits a record from the program and adds it to the data set.

Read syntax diagramSkip visual syntax diagram>>-WRITE FILE--(file-reference)--FROM--(reference)-------------->
 
>--+---------------------+--;----------------------------------><
   +-KEYFROM(expression)-+
   '-KEYTO(reference)----'
 

The keywords can appear in any order.

A WRITE statement cannot be used to update a consecutive data set accessed as a SEQUENTIAL UPDATE file. In order to update a consecutive data set by a SEQUENTIAL UPDATE file, you must retrieve a record with a READ statement before you can update it via a REWRITE statement.

Also, if you want to add records to the end of an existing sequential file, it has to be opened as OUTPUT and you must specify either DISP=MOD in its DD statement (if running under z/OS batch) or APPEND(Y) in its environment variable (if running under Windows, AIX or z/OS UNIX).


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)