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.
|
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).