The WRITE command will output the database table record currently residing in the input buffer (placed there by a successful execution of a READ, SCAN, or EQUI-JOIN command) associated with the table-name defined in the COPY TABLE statement. The output will reside in a blocked, variable length record in a sequential output file (QSAM for MVS). Control information will be automatically included in the file with the data records to establish table ownership during a reload.
WRITE table-name [DATA-ONLY] [APPEND READ table-name KEY occurrence-name FIELD COBOL-field-name] [FATAL].
Three fields of control information are attached to each user data record as a 12 byte prolog. The first field contains the 3-character table occurrence name (DATACOM-NAME), a second field contains a pointer, relative to zero, of the last byte plus one of the user data, and the third field is not used, but is maintained for consistency with the other database interfaces.
Specifying the DATA-ONLY option will output a file with no CA-Datamacs/II prolog and epilog attached to the data records.
If an ELEMENT or DATAVIEW keyword was encoded on the COPY TABLE statement, then only those fields defined to that ELEMENT or DATAVIEW will be written to the output file. Otherwise, all fields defined to the record are written out.
The optional APPEND keyword will cause the subsequent LOAD run to not add the data record unless the specified key already exists in the database. By selecting the FATAL option, the user has the choice of immediately terminating the LOAD function, or to bypass the error with an appropriate message and continue the LOAD.
These APPEND commands are added as an epilog immediately following the user's data. If none are present then a hex 'FF' will terminate the user data.
Multiple APPEND READ's are permitted.
The source of data for the key value must be contained in the user's data, which was written to the output file and is pointed to by the FIELD keyword. This is a 1-to-30 character COBOL field name. Concatenated key fields are supported by allowing the specification of multiple COBOL fields, specified in the sequence the fields should be concatenated. Separate each field with a comma and enclose them with parenthesis.
The KEY keyword is the group level 1-to-32 character occurrence name of a key related to this table.
The WRITE command can only be used in conjunction with the UNLOAD function.
When the APPEND is used, the size of the user data portion of the record cannot change between the UNLOAD and reLOAD, and the same element list must be used for both functions.
| Copyright © 2009 CA. All rights reserved. | Tell Technical Publications how we can improve this information |