WRITE (Write a Record) Macro
The WRITE macro transfers a record from virtual storage to an output file.
Format
Requirements for the caller
- AMODE:
- 24
- RMODE:
- 24
- ASC Mode:
- Primary
Parameters
- filename | (1)
- For filename specify the same name, you used as name in the DTFxx macro for the file. Register notation must be used if your program is to be self-relocating.
- SQ | UPDATE
- For sequential work files, specify SQ for magnetic tape work files.
For disk work files, specify:
- SQ for a formatting write.
- UPDATE for a non-formatting write.
When writing to an FBA disk, a non-formatting WRITE (with UPDATE) writes the current CI (control interval), while a formatting WRITE (with SQ) writes the CI and follows it immediately with a Software-End-Of-File (SEOF).
When writing to a CKD disk, a formatting WRITE writes count, key, and data, while a non-formatting WRITE writes only data.
- area | (0)
- For a sequential file, this specifies the name, as a symbol or in register notation, of the output area that is used by the file.
- length | (r)
- Specifies the actual number of bytes to be written on a sequential file. Determines only records of undefined format (RECFORM=UNDEF).
- AFTER
- For a DA file, specify AFTER to write a record after the last record written, regardless of key or identifier.
- EOF
- Applies only to the WRITE...AFTER form of the macro. Specify EOF to write an end-of-file on a track after the last record on the track, if this is wanted.
- ID
- For DA files, specify ID to write at a location that is determined by the record identifier in the count area of the records.
- KEY
- For an indexed sequential file, specify KEY for random updating. For a direct-access file, specify KEY to write at a location that is determined by the record key (control information is in the key area of the records).
- NEWKEY
- Applies only to indexed sequential files. Specify NEWKEY to write
a new (not updated) record in the file.
When loading or extending the file, precede the WRITE filename,NEWKEY with a SETFL macro and follow it with an ENDFL macro.
When adding a record after sequential retrieval, issue an ESETL macro before writing the record.
- RZERO
- For a direct-access file, specify RZERO to reset the capacity record of a track to its maximum value and erase the track after record zero.