16.10 - File Read - Access Module

Teradata Tools and Utilities Access Module Programmer Guide

Access Module
May 2017
Programming Reference

The File Read function reads a block of data from an open file. The structure follows:

typedef struct _pmiRW
  char       EyeCatcher[pmiMAX_EC_LEN];/* Struct eyecatcher string */
  pmUInt32   StructLength;             /* Length of this structure */
  void      *FIData;
  pmUInt32   BufferLen;
  char      *Buffer;
} pmiRW_t;

where the following is true:

Parameter Field Description
EyeCatcher input Structure description string, such as pmReadParms.
StructLength input Total structure length, including the EyeCatcher string.
FIData input Value provided by the Access Module in response to a previous file open request call.
BufferLen output Length of the returned data block.
Buffer input Pointer to the buffer area into which the Access Module is to return the data block.

Return Codes

The following File Read return codes supplement those listed in Typical Interface Return Codes.

Return Code Description
pmrcBadFp An invalid or meaningless value in FIData.
pmrcWriteOnly The file specified by FIData is opened for write operations only.
pmrcEOF An end-of-file was encountered. BufferLen is zero.

Usage Notes

Consider the following when specifying the File Read parameters:
  • Requirements – A File Read function is required when the Reqtype field of the pmiCmdBlock_t structure is pmiPIDMOptRead.
  • BlkHeaderLen Value – The returned BlkHeaderLen value indicates the number of bytes at the beginning of each block returned on read operations that are Access Module specific. If, for example, the Access Module needs to prefix each record with a four-byte block length and that block length was present at the beginning of the returned read buffer, then the BlkHeaderLen is set to 4. If, however, the Access Module does not include that field in its returned data, then the BlkHeaderLen value is set to 0.