HPlogo Asynchronous Serial Communications Programmer's Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 8 Intrinsics Reference

FWRITE

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

Transfers a record of data to a file on any device.

Syntax

        I16V   UDS   I16V     U16V
FWRITE(filenum,buffer,length,controlcode);

Use

The FWRITE intrinsic transfers a logical record of data to a file on any device. When programming for asynchronous devices this means writing data to a terminal or printer. Completion status is indicated by condition codes, which your program should always check.

This intrinsic is completed "logically"; that is, once data is passed to an output buffer the call is considered to have completed and control is returned to the calling program. If the operation of the output device has been suspended through flow control, the actual writing of the data may not have taken place. There is no programmatic way to determine that printing has taken place.

Parameters

filenum

16-bit signed integer by value (required)

The file number of the file to be written to.

buffer

user-defined structure (required)

Passes the record to be written.

length

16-bit signed integer by value (required)

The number of halfwords or bytes to be written to the record. If this value is positive, it signifies halfwords; if negative, bytes. If the number is zero, no data transfer will occur.

NOTE: Whether or not "bytes" is specified, the physical data transfer will be on a byte-by-byte basis for an asynchronous device. If halfwords are specified, an "even" number of bytes are output.
controlcode

16-bit unsigned integer by value (required)

This parameter indicates the carriage control action to be used when the file is transferred to a line printer or terminal (including a spooled file whose ultimate destination is a line printer or terminal). This parameter is effective only for files opened with carriage control (CCTL) specified in the FOPEN or HPFOPEN call.

The controlcode parameter may contain 0, 1, or one of the octal codes from Table 8-11 “Selected Carriage Control Directives”. These options are used to indicate carriage control action as follows:

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. The results are a maximum of 132 characters of data per printed line. The values permissible for use as the first character to specify control are the same as the octal values described below, and listed in Table 8-11 “Selected Carriage Control Directives”.

When one of the octal codes listed in Table 8-11 “Selected Carriage Control Directives” is used as the value of controlcode the carriage control action associated with the specific code is applied to the data being transferred. (You must have specified CCTL through the FOPEN or HPFOPEN call, or through an overriding :FILE command.) The full record transferred is then printed, with a maximum of 132 characters per printed line.

If the file being written is not a spooled file, (that is, it is not written to disk before being output to the device), all of the octal codes listed in Table 8-11 “Selected Carriage Control Directives” can also be passed through FCONTROL(1).

A carriage control directive passed through FCONTROL(1) takes effect whether or not CCTL was specified for the file.

For spooled files, however, carriage control must be set using FWRITE. Additionally, the prespace/postspace control normally set through FCONTROL must be set through FWRITE for spooled files. You can use control codes %100 through %103 and %400 through %403 for this purpose.

If the controlcode parameter is not 0 or 1, and length is 0, only the space control is executed and no data is transferred.

The default carriage control is postspacing with automatic page eject. This applies to all Hewlett-Packard supported subsystems, with the exception of FORTRAN77/iX and COBOLII/iX, which have prespacing with automatic page eject.

Table 8-11 Selected Carriage Control Directives

Octal CodeCarriage
%2-%52Single space (with or without automatic page eject).
%53No space, (next printing at column 1).
%54Single space (with or without automatic page eject).
%60Double space (with or without automatic page eject).
%61Conditional page eject (form feed) is performed by the software. If the printer is not already at the top of the form, a page eject is performed. Ignored if:
  • Postspace mode: The current request has a transfer count of 0 and the current request was FOPEN (or 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 (or HPFOPEN), FCLOSE, or FWRITE specifying a carriage control directive of %61.

%62-%77 %104-%177Single space (with or without automatic page eject).
%2nnSpace nn lines (no automatic page eject); nn is any octal number from 0 through 77.
%300Skip to top of form (page eject).
%301Skip to bottom of form.
%302Single spacing with automatic page eject.
%303Skip to next odd line with automatic page eject.
%304Skip to next third line with automatic page eject.
%305Skip to next 1/2 page.
%306Skip to next 1/4 page.
%307Skip to next 1/6 page.
%310Skip to bottom of form.
%311Skip to one line before bottom of form.
%312Skip to one line before top of form.
%313Skip to top of form (same as %300).
%314Skip to next seventh line with automatic page eject.
%315Skip to next sixth line with automatic page eject.
%316Skip to next fifth line with automatic page eject.
%317Skip to next fourth line with automatic page eject.
%320No space, no return (next printing physically follows this).
%321-%377Single space (with or without automatic page eject).
%400 or %100Sets postspace movement option; this first print, then spaces. If previous option was prespace movement, the driver outputs a one line advance (equivalent to an octal code of %201 without automatic page eject) to clear the buffer.
%401 or %101Sets prespace movement option; this first spaces, then prints.
%402 or %102Sets single-space option, with automatic page eject (60 lines per page).
%403 or %103Sets single-space option, without automatic page eject (66 lines per page).

 

NOTE: If you select octal codes %55 and %60 with automatic page eject in effect (by default or following an octal code of %102 or %402), the resulting skip across a page boundary is to the top of the page. If automatic page eject is not in effect, a true double or triple space results, but the perforation between pages is not automatically skipped.

Condition Codes

CCE

Request granted.

CCG

Physical EOF. Should not occur for terminals or printers.

CCL

Request denied due to an error condition. Use FCHECK to obtain details.

Additional Discussion

See the discussion of FCONTROL(1) in this manual. See also the MPE/iX Intrinsics Reference Manual.

Feedback to webmaster