WRITE
Can be used in FASTREXX procedures.
Writes a record to the specified data set or sets.
- Returns
- A single blank.
- ddname
- Specifies a record is to be written to the data set identified
by the specified ddname. If ddname is
omitted when used with a DSC or DSP function, the default is the ddname
of the primary output data set. The primary output data set depends
on the File Manager function or panel being used:
Function or panel option Primary output data set is… Print Utility (option 3.2) Determined by the value of the PRINTOUT field on the Set Print Processing Options panel. For details, see Set Print Processing Options panel (option 0.1). Copy Utility (option 3.3) or DSC function The data set that is the target of the copy function. For the DSC function, if a ddname is associated with the primary output data set, then specifying that ddname is the same as omitting the argument. Do not target the primary output data set with another ddname.
DSP function When used in a batch job, the primary output data set is SYSPRINT. When used in a REXX procedure, the primary output data set is determined by the PRINTOUT parameter of the SET function. For details, see SET (Set Processing Options). If a ddname is associated with the primary output data set, then specifying that ddname is the same as omitting the argument. Do not target the primary output data set with another ddname.
- The pre-allocated data set DCB attributes. Existing record formats, lengths and block sizes are preserved.
- If it has been allocated without DCB attributes then these attributes are inherited from the input data set.
- Newly allocated data sets with DISP=(NEW,…) are initialized to an "empty" state and only contain an EOF record.
- Existing data sets with data are handled as follows:
- DISP=(OLD,…) data sets are reset to an "empty" state and contain only an EOF record; all previously existing data is lost.
- DISP=(MOD,…) data sets have their data preserved unaffected.
- If it has been assigned a value by the procedure, the variable OUTREC.ddname, where ddname is the ddname specified in the WRITE function.
- If the variable OUTREC.ddname has not been assigned a value, or has been unassigned using the DROP instruction, the File Manager-defined variable, OUTREC.
The length of the record written depends upon the data set attributes of the output data set. If the output data set contains variable-length records, the length of the record is determined from the length of the data in the REXX variable. If the length of the data is greater than the maximum record length specified in the data set attributes, the record is truncated. If the output data set contains fixed-length records, the length of the record written is the length specified in the data set attributes, truncated or padded as necessary.
If the record format of the output data set specifies that the records contain a carriage control character, depending on the output device, the first character of the record data in the REXX variable is interpreted as a carriage control character. For more information about records containing carriage control characters, see the z/OS DFSORT Installation and Customization.
If you are using the DSC function or Data Copy Utility and the input data set is a PDS(E) and the ddname of the target refers to a PDS(E), then members are created in the target data set with names matching the name of the input data set member as the result of the WRITE execution.
Example 1
If FLD(1,2) = 01 Then WRITE('DD01')
Example 2
If FLD(1,2) = 02 Then WRITE('DD02','DD02COPY')