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

FCONTROL

MPE documents

Complete PDF
Table of Contents
Index

E0300 Edition 4 ♥
E0394 Edition 3

Syntax Parameters Operation Notes Condition Codes

Performs various control operations on a file or on the device where the file resides, including:
  • Verifying I/O.

  • Reading the hardware status word for the device where the file resides.

  • Setting a terminal's timeout interval.

  • Repositioning a file at its beginning.

  • Writing an end-of-file marker.

Syntax



            I16V     I16V     *
  FCONTROL (filenum, itemnum, item);

Parameters


filenum

16-bit signed integer by value (required)

Passes the file number of the file for which the control operation is to be performed.

itemnum

32-bit signed integer by value (required)

Specifies which operation is to be performed. (Refer to Table 9-1 "FCONTROL Itemnum/Item Values")

item

type varies (required)

Passes/returns a value associated with a control operation as indicated by the corresponding itemnum parameter. (Refer to Table 9-1 "FCONTROL Itemnum/Item Values")

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

Table 9-1 FCONTROL Itemnum/Item Values

Itemnum Mnemonic Item Description
0U16General device control:

The value specified is passed to the appropriate device driver. A value from the driver is returned in item. Not valid for spooled device files.

Not applicable to KSAM files.
1U16Carriage control (CCTL):

Not applicable to KSAM files.
2I16Complete I/O:

Ensures that requested I/O has been physically completed. Valid only for buffered files. Posts the block being written (full or not).

Item is ignored.

A checkpoint record is written. In the event of a system crash, recovery is done to this state of the files.
3U16Device status:

Returns a record containing information about the state of the device associated with the file immediately after the last I/O operation (including HPFOPEN/FOPEN) on the file. The record size and contents are device-dependent.

Not applicable to KSAM files.
4U16Set timeout interval:

Passes the timeout interval, in seconds, to be applied to input from the specified file. The maximum value allowed is 655.35 seconds. If input is requested from a file but is not received in this interval, the FREAD request terminates prematurely with CCL. The interval is specified in seconds and returned in item. If this interval is zero, any previously established interval is cancelled, and no timeout occurs.

A timeout value should be used for programs reading from an unattended device to prevent "hangs". Timeouts can be used to terminate binary reads, but only as a safeguard to prevent a program from waiting too long for a read to complete.

Only valid for terminal and message files. Only affects the next read if the addressed file is being read from the terminal; it must be reissued for each read. If this code is applied to a message file, item specifies the length of time that a process waits when reading from an empty file or writing to a full one and the timeout remains enabled until it is explicitly cancelled.

Denotes a halfword in the stack that contains the time-out interval, in seconds, to be applied to input from the terminal.

During block mode reads, the timer halts when a DC2 character is received. The block mode read timer is activated by the system software; these values are not user changeable.

Not applicable to KSAM files.
5U16Reposition file at its beginning:

The file is repositioned to the first logical record, the record with the lowest value in the current key.
6U16Write end-of-file:

Marks the end-of-file (EOF) on disk. It performs the function of itemnum=2 and writes the file label. This guarantees that the end-of-file is correct and the extent bit map is updated.

Item is ignored.
7U16Space forward to tape mark:

Not used for KSAM XL/64 files. For CM KSAM files, it clears the key and data buffers of all information and reads the first two sectors of the key file from disk to buffer.

Operation Notes


None.

Condition Codes


CCE

Request granted.

CCG

Not returned.

CCL

Request denied. An error occurred.

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




FCLOSE


FERRMSG