gtpa2m3gApplication Programming

Determining the Status of I/O Operations

The waitc function is used to delay processing of an entry until all I/O in process for that entry is complete. A single waitc, regardless of whether it is explicitly invoked or implied in another function call, applies to all pending I/O for the entry (it is not possible to restrict the waitc to 1 request). Control returns to the application program after all I/O requests are complete, and in C language the waitc function returns an integer value of zero.

In assembly language the WAITC requires a single parameter--the label of a routine in the requesting program--to which control will be transferred in case of hardware error or other abnormal condition. For example:

WAITC EXCEPT1

Should this routine be activated, the application must check I/O indicators in the ECB (CE1SUD, CE1SUG) to determine the condition and take appropriate action. (See System Error Processing for more information).

In C language the waitc function returns the value of ce1sug in case of hardware error or other abnormal condition. The application must determine the condition and take appropriate action. (See System Error Processing for more information).

On many types of output operations, the data record is detached from the ECB upon execution of the library function call, in which case the waitc function is meaningless. In this situation, the application program cannot determine when output operations are completed. Standard system conventions must be relied on to handle errors.

The time for completion of an I/O operation is substantial compared with CPU processing speed. Accordingly, following the execution of waitc and during the delay pending I/O completion, TPF may transfer control to another entry. This may result in a transfer to the same program (or some other program) on behalf of a different entry. In addition to the explicit waitc function, many functions in TPF contain an implicit waitc. The TPF C/C++ Language Support User's Guide, TPF General Macros, and TPF System Macros specify, for every C function and assembler macro, the circumstances under which a waitc is implied.

Standard Record Header

A standard header, which ranges from 8 to 32 bytes, is used for all data file records in the TPF system. The first 8 bytes comprise 4 fields that are present in all record types:



The 8 bytes starting at X'008' of a standard header can contain either 4-byte forward and backward chain address fields or zeros. If these fields are not used for chaining, they can be used by the application for other data. The following shows a 4-byte file address standard header:

The 16 bytes starting at position X'010' of a standard header can contain either 8-byte forward and backward chain address fields or zeros. If these fields are not used for chaining, they can be used by the application for other data. The following shows an 8-byte file address standard header:

Program record headers have 8 bytes. The content of the header depends on the program attributes.

For the following items:

the record header consists of the following:



For the following item:

the record header consists of the following:



For the following item:

the record header consists of the following:



Record Identification

This field is used by the system for a record integrity verification called identification or ID check. Assignment of record identifications (IDs) is a manual procedure involving a level of control to ensure that there is no duplication of identification assignment. Upon a request for I/O services, system action on the record identification varies as follows:

Record Code Check

An optional record code check may be requested by placing a nonzero value in the record code. This field is used by the application environment to do an additional data integrity check. This check may also be used as a security check. For example, the same code may be placed in all the records of a data chain that is only to be accessed by selected programs. The record code check procedures are identical to those used for the record identification check.