HPlogo Using KSAM XL and KSAM 64 > Chapter 9 KSAM Intrinsics

FWRITE

MPE documents

Complete PDF
Table of Contents
Index

E0300 Edition 4 ♥
E0394 Edition 3

Syntax Parameters Operation Notes Condition Codes

Writes a logical record from the buffer to a file.

Syntax



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

Parameters


filenum

16-bit signed integer by value (required)

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 halfwords or bytes to be written to the record. If this value is positive, it signifies halfwords; if negative, bytes. Zero indicates that no transfer occurs.

If length is less than the record size, the remaining portion of the record is padded with the fill character that is specified during the file creation. The default for ASCII is blank. The default for binary is binary zero.

If length is larger than the logical record size, the FWRITE request is refused and CCL is returned.

controlcode

16-bit unsigned integer by value (required)

This parameter must be specified to satisfy internal requirements, but it is ignored.

Operation Notes


This intrinsic does not read the advance flag. It positions the logical record pointer and the physical pointer to the appropriate record. When its function is completed, it sets the advance flag to FALSE.

When the FWRITE intrinsic is executed, the logical record pointer is set to the record immediately following the record just written. When an FWRITE call writes a record beyond the current logical end-of-file indicator, this indicator is advanced. If the physical bounds of the file are reached, CCG is returned.

Condition Codes


CCE

Request granted.

CCG

Request denied. The physical bounds of the file prevented further writing.

CCL

Request denied. An error occurred: an I/O error occurred;

  • a duplicate key value occurred when duplicates are not allowed

  • length does not include all keys

  • sequential processing was specified in the flag word of the ksamparam in FOPEN and the primary key is not in ascending order.

Refer to this intrinsic in the MPE/iX Intrinsics Reference Manual for other codes pertaining to KSAM files.




FUPDATE


FWRITELABEL