Passes the file number of the file to be written on.
buffer
user-defined structure (required)
Passes the record to be written.
length
16-bit signed integer by value (required)
Passes the number of half words or bytes to be written to the record. If
this value is positive, it signifies half words; if negative, bytes. Zero
indicates that no transfer occurs.
If length is less than the recsize
parameter associated with the record, only the first
length (half words or bytes) is written.
If length is larger than the logical record size and
NOBUF (aoption in FOPEN/HPFOPEN) is not
specified, the FWRITE request is refused and CCL (1) is returned.
If NOBUF is specified, length cannot exceed the
physical record size unless the multirecord aoption is
specified also.
If the multirecord aoption in FOPEN/HPFOPEN is
specified, the excess half words or bytes are written to succeeding
physical records and carriage-control is specified, the actual data
transferred is limited to recsize minus one byte.
(ASC) For asynchronous devices, the physical data transfer is
byte-by-byte. If half words are specified, an even number of bytes is
output.
controlcode
16-bit unsigned integer by value (required)
Passes a carriage-control code, effective if the file is transferred to a
line printer or terminal (including a spooled file whose destination is a
line printer or a terminal). This parameter is effective only for files
opened with carriage-control specified.
The options are:
0
Print the full record transferred, using single spacing.
This results in a maximum of 132 characters per printed line.
1
Use the first character of the data written to satisfy
space control and suppress this character on the printed output. This
results in a maximum of 132 characters of data per printed line.
Use any octal code from Table 6-2
"Carriage Control Directives" to determine space control and print
the full record transferred. This results in a maximum of 132 characters
per printed line.
If the controlcode parameter is not 0 or 1, and
length is 0, only the space control is executed and no
data is transferred.
Determine whether the carriage-control directive takes effect before
printing (prespace movement) or after printing (postspace movement), with
the FCONTROL intrinsic.
For spooled files, use FWRITE instead of FCONTROL to
set the prespace/postspace control and the auto/no auto page eject
control; use control codes %100 through %103 and %400 through %403 for
this. If one of the above controls is specified with
length=0, no physical I/O occurs.
When a file is opened with CCTL, use the carriage-control codes in one of
the following ways:
As the value of the controlcode parameter.
When controlcode=1, as the first byte of the
buffer array.
The default carriage-control code is postspacing with automatic page
eject. This applies to all Hewlett-Packard subsystems except FORTRAN
77/XL and COBOLII/XL (these have prespacing with automatic page eject).
(KSAM) This parameter must be specified to satisfy internal requirements,
but it is ignored.
Table 6-2 Carriage Control Directives
Octal Code (ASCII)
Description of Carriage Action
%2 - %52 (" ")
Single space (with or without automatic page eject)
%53 ("+")
No space (next printing at column 1), cannot be used more than once on
the Hewlett-Packard 2608A/S without losing data
%54 (" ")
Single space (with or without automatic page eject)
%55 ("-")
Triple space (with or without automatic page eject)
%56 - %57 (" ")
Single space (with or without automatic page eject)
%60 ("0")
Double space (with or without automatic page eject)
%61 ("1")
Conditional page eject (form feed) performed by the software; if the
printer is not at top-of-form, a page eject is performed. Ignored if:
Postspace mode
The current request has a transfer count of 0 and the previous
request was FOPEN, HPFOPEN, FCLOSE, or
FWRITE specifying a carriage-control directive of %61.
Prespace mode
The previous request has a transfer count of 0, and the current
request and previous request are any combination of FOPEN,
HPFOPEN, FCLOSE, or FWRITE specifying a
carriage-control directive of %61.
%62
Skip to one line before top of form (valid for Hewlett-Packard 2608S
and 2563A printers only)
%63
A conditional page eject form feed is performed by the printer; not at
top-of-form, a page eject is performed (valid for Hewlett-Packard 2608S and
2563A printers only)
%62 - %77 (" ")
Single space (with or without automatic page eject; for terminals and
serial printers)
%104 - %177 (" ")
Single space (with or without automatic page eject; for terminals and
serial printers)
%2nn
Space nn lines (no automatic page eject);
nn is any octal number from 0 through 77
User option (Hewlett-Packard 2613/17/18/19), skip to one line before
bottom of form (Hewlett-Packard 2608A/S)
%312
User option (Hewlett-Packard 2613/17/18/19), skip to one line before
top of form (Hewlett-Packard 2608A/S)
%313
User option (Hewlett-Packard 2613/17/18/19), skip to top of form
(Hewlett-Packard 2608A)
%314
Skip to next seventh line with automatic page eject
%315
Skip to next sixth line with automatic page eject
%316
Skip to next fifth line with automatic page eject
%317
Skip to next fourth line with automatic page eject
%310 - %317
(Hewlett-Packard 2607)
%314 - %317
(Hewlett-Packard 2613/17/18/19)
%320
No space, no return (next printing physically follows this)
%321-%377 (" ")
Single space (with or without automatic page eject)
%400 or %100
Set postspace movement option (prints first, then spaces). If previous
option was prespace movement, the driver outputs a line with a skip to VFC
Channel 3 (automatic page eject in effect) or a one line advance
(equivalent to an octal code of %201 without automatic page eject) to clear
the buffer
%401 or %101
Set prespace movement option (spaces first, then prints)
%402 or %102
Set single-space option, with automatic page eject (60 lines per page)
%403 or %103
Set single-space option, without automatic page eject (66 lines per page)
NOTE: If octal codes %55 and %60 are selected with automatic page eject
in effect (by default or following an octal code of %102 or %402), the
resulting skip is to a location absolute to the page. A code of %60 is replaced
by %303, and a code of %55 is replaced by %304. Therefore, the resulting skip
can be less than two or three lines, respectively.
If automatic page eject is not in effect, a true double or triple space results,
but the perforation between pages is not automatically skipped. For the
Hewlett-Packard 2608S and 2563A, if auto-eject and feature mode are in effect,
a code of %60 is replaced by two codes of %302, and a code of %55 is replaced
by three codes of %302. The resulting skip is double or triple space with
auto-eject, respectively.
Figure 6-2 Carriage-Control Data
Operation Notes
If information is written to a fixed-length record and the NOBUFaoption in FOPEN/HPFOPEN is not specified, any unused
portion of the record is padded with binary zeros or ASCII blanks.
When the FWRITE intrinsic is executed, the logical record pointer is
set to the record immediately following the record just written, or to the
first logical record in the next block for NOBUF files. If RIO access
is used, the modified record is set to the ACTIVE state.
When an FWRITE call writes a record beyond the current logical
end-of-file indicator, this indicator is advanced. However, this is noted in
the file label only when the file is closed or when an extent is allocated. If
the physical bounds of the file are reached, CCG (0) is returned.
If a magnetic tape is unlabeled (as specified in the FOPEN/HPFOPEN
intrinsic, or in the FILE command) and the program attempts to write
over or beyond the physical or simulated end-of-tape (EOT) marker, the
FWRITE intrinsic returns CCL (1). The actual data is written to the
tape, and a call to FCHECK reveals an end-of-tape file error. After
the EOT marker is crossed, all writes to the tape transfer the data
successfully but return CCL (1) until the tape crosses the EOT marker again in
the reverse direction (rewind or backspace).
If a magnetic tape is labeled (as specified in the FOPEN/HPFOPEN
intrinsic, or in the FILE command), CCL (1) is not returned when the
tape passes the EOT marker. Attempts to write to the tape after an EOT marker
cause end-of-volume (EOV) markers to be written. A message is printed on the
system console requesting another volume (reel of tape) be mounted.
For message files and circular files, this intrinsic logically appends the
record to the end of the file. If a circular file is full, the first block is
deleted, the remaining blocks are logically shifted to the file's head, and the
new record is appended to the end of the file. If a message file is full and
there are no readers, the process waits if there is an FCONTROL=45 in
effect or if this is the first FWRITE after an FOPEN/HPFOPEN
call. Otherwise, CCG (0) is returned.
Control codes are ignored for byte stream files. Byte stream files can not be
opened with carriage control.
Condition Codes
CCE (2)
Request granted.
CCG (0)
Request denied. The physical bounds of the file
prevented further writing.
CCL (1)
Request denied. An error occurred;
length exceeded the size of the record in nonmultirecord
mode, the FSETMODE option was enabled to signify recovered tape
errors, or the end-of-tape marker was sensed. If the file is being written
to a multivolume labeled magnetic tape set, CCL (1) is not returned when
the end-of-tape marker is sensed. Instead, end-of-volume labels are written,
and a request is issued to mount the next volume.