-

FILE_TELL_2

Type Function block
Description Determines the current position of the file pointer in a file.

In order to determine the current position of the file pointer (relative offset from start of file), the valid handle for the file is assigned to HANDLE. This handle is created when the file is opened with the FILE_OPEN_2 function block.

As soon as the REQ input is set to TRUE, the inputs are validated. The REQ input must remain set to TRUE, until the file tell operation is completed (regardless of whether the operation succeeded or failed). The BUSY output is TRUE while the operation is being executed asynchronously on a Service Thread. Execution of the function block is complete when the DONE output is set to TRUE. The current position of the file pointer can be read at the POSITION output following successful execution.

If an error occurred during execution, ERROR is set to TRUE, and the error code can be read from the STATUS output.
Notes
  • The status of the DONE, BUSY, POSITION, ERROR, and STATUS outputs are maintained as long as REQ is TRUE.
  • When the function block is used as global function block, it is not thread-safe. In this case, make sure to prevent concurrent calls (e.g., by using the MUTEX function block).
  • Function blocks have to be instantiated. The instance name of the function block has to be declared in the 'Variables' table of the POU where the FB is going to be used. The instance name must be unique within the POU.
Parameters Inputs

REQ

HANDLE

Outputs

DONE

BUSY

ERROR

STATUS

POSITION