HELP WRITE — VMS 4.6
Writes the specified data to the output file indicated by the
logical name. The data is written as one record in the output file.
Format:
WRITE logical-name expression[,...]
Additional information available:
ParametersCommand QualifiersExamples
Parameters
logical-name Specifies the logical name assigned to the file to which a record is to be written. Use the logical name assigned by the OPEN command when the file was opened. (The OPEN command assigns a logical name to a file and places the name in the process logical name table.) In addition, you can specify the process-permanent files identified by the logical names SYS$INPUT, SYS$OUTPUT, SYS$ERROR, and SYS$COMMAND. expression[,...] Specifies data to be written as a single record to the output file. You can specify data items using character string expressions. See Section 5.7.1 of the VAX/VMS DCL Concepts Manual for more information on string expressions. You can specify a list of expressions separated by commas; the command interpreter concatenates the items into a single record and writes the record to the output file. The maximum size of any record that can be written is less than 1024 bytes, unless you specify the /SYMBOL qualifier, in which case the maximum is 2048 bytes. (See the "Description" section below.)
Command Qualifiers
Additional information available:
/ERROR
/ERROR=label Specifies a label on a line in the command procedure to receive control if the write request results in an error. If no error routine is specified and an error occurs during the writing of the file, the current ON condition action is taken. The error routine specified for this qualifier takes precedence over any action statement indicated in an ON command. If an error occurs and control passes successfully to the target label, the reserved global symbol $STATUS retains the code for the error that caused the error path to be taken.
/SYMBOL
/SYMBOL Causes the expression to be interpreted and its expanded value placed in a 2048-byte buffer before the write operation is performed. If you specify multiple expressions, their values are concatenated and placed in the 2048-byte buffer. Use the /SYMBOL qualifier if you need to write a very large record (see the preceding "Description" section). Each expression specified must be a symbol. You cannot specify character string expressions (that is, strings in quotation marks) with the /SYMBOL qualifier. If you do not use the /SYMBOL qualifier, the entire command, including the expression or expressions, is placed in a 1024-byte buffer, as explained in the "Description" section.
/UPDATE
/UPDATE Specifies that an existing record be modified (updated) using the specified record. You must be able to read and write to a file in order to use the /UPDATE qualifier. You can use the WRITE/UPDATE command only after a READ command. The WRITE/UPDATE command modifies the last record you have read. With sequential files, you must replace a record with another record of the same size when you use the WRITE/UPDATE command.
Examples
1. $ WRITE SYS$OUTPUT "Beginning second phase of tests"
The WRITE command writes a single line of text to the current output
device.
2. $ OPEN/APPEND OUTPUT_FILE TRNTO::DBA1:[PGM]PLAN.DAT
$ WRITE OUTPUT_FILE "BEGINNING PHASE 3"
The OPEN/APPEND command opens the file PLAN.DAT at the remote node
TRNTO, and positions the pointer at the end of the file. The WRITE
command writes a record to the end of the file PLAN.DAT.
3. $ OPEN/APPEND MYFILE [JONES]TESTING.DAT
$ WRITE/SYMBOL MYFILE A,B,C
This example assumes that the symbols A, B, and C have already been
defined. The OPEN/APPEND command opens the file [JONES]TESTING.DAT
and positions the pointer at the end of the file. The WRITE/SYMBOL
command concatenates the values of the symbols A, B, and C, and
writes this data to a new record at the end of the file.