HPlogo MPE/iX Intrinsics Reference Manual > Chapter 6 Command Definitions (FLUSHLOG-GETUSERMODE)

FWRITEDIR

MPE documents

Complete PDF
Table of Contents
Index

Edition 7 E0701 ♥
Edition 7 E0300
Edition 6 E0195

NM and CM callable.

Writes a specific logical record from the stack to a disk file.

Syntax



             I16V     UDS     I16V    I32V
  FWRITEDIR (filenum, buffer, length, lrecnum);

Parameters


filenum

16-bit signed integer by value (required)

Passes the file number of the file to be written to.

buffer

user-defined structure (required)

Passes the record to be written. This structure should be large enough to hold all of the information to be transferred.

length

16-bit signed integer by value (required)

Passes the number of half words or bytes to be written to the file. A positive value is in half words; a negative value is in bytes.

For files opened BUF:

  • If length <= record size, the length is transferred in half words or bytes and remaining portions of the record is padded with fill characters.

  • If length = 0, no transfer occurs and the record address is overwritten with default fill characters (blanks for ASCII files; null characters for binary files).

  • If length > record size, CCL (1) is returned and no transfer occurs.

For files opened NOBUF and nonmultirecord:
  • Length is transferred in half words or bytes up to the file limit (ignores all block boundaries) and remaining portions of the last block written to is padded with fill characters.

lrecnum

32-bit signed integer by value (required)

Passes the relative number of the logical record, or block number for NOBUF files, to be written. Zero indicates the first record.

Operation Notes


This intrinsic differs from the FWRITE intrinsic, the FWRITE intrinsic writes only the record pointed to by the logical record pointer. Use the FWRITEDIR intrinsic only for disk files composed of fixed-length or undefined-length records.

When information is written to a fixed-length record and NOBUF is not specified in the FOPEN/HPFOPEN call that opens the file, any unused portion of the record is padded with binary zeros or ASCII blanks.

When the FWRITEDIR intrinsic is executed, the logical record pointer is set to the record immediately following the record just written, or the first logical record of the next block for NOBUF files.

If RIO access is used, the modified record is set to the ACTIVE state.

When an FWRITEDIR call writes a record beyond the current logical end-of-file indicator, the indicator is advanced. This can result in the creation of dummy records to pad the records between the previous end-of-file and the newly written record. When the new record is in the same extent, these dummy records are filled with binary zeros or with ASCII blanks.

When the physical bounds of the file prevent further writing because all allowable extents are filled, the end-of-file condition (CCG (0)) is returned to the program.

Not applicable to message files.

(KSAM) This intrinsic cannot be used for KSAM files. If called for a file created as a KSAM file, CCL (1) is returned.

Condition Codes


CCE (2)Request granted.
CCG (0)Request denied. The physical end-of-file was encountered.
CCL (1)Request denied. An error occurred.

Related Information


Intrinsics FUPDATE, FWRITE, FWRITELABEL, FREADDIR
Manuals Accessing Files Programmer's Guide




FWRITE


FWRITELABEL