Function BlockFileSeekPLCopen motion icon

Description

This function block sets the current position in an open file.

Figure 7-213: The FileCopy Function Block

Related Functions

FileClose, FileEOF, FileOpenA, FileOpenR, FileOpenW, FileReadLine, FileReadBinData, FileWriteBinData, FileWriteLine

See also: File Management

Arguments

Input

Execute Description On the rising edgeClosed A rising edge is the transition of a digital signal from low to high. It is also called positive edge test if the end of the file is reached in a file that is open for reading.
  Data Type BOOL
  Range 0, 1
  Unit N/A
  Default
ID Description ID of the open file.
  Data Type UDINT
  Range N/A
  Unit N/A
  Default
POS Description Number of bytes to offset from ORG.
  • If ORG = SEEK_SET, then POS should be ≥ 0
  • If ORG = SEEK_END, then POS should be ≤ 0
  • If ORG = SEEK_CUR, then POS can be positive or negative
  Data Type DINT
  Range N/A
  Unit N/A
  Default
ORG Description Origin of the move.
  • SEEK_SET = beginning of the file
  • SEEK_CUR = current position
  • SEEK_END = end of the file
  Data Type DINT
  Range SEEK_SET, SEEK_CUR, SEEK_END
  Unit N/A
  Default

Output

Done Description If TRUE, then the command completed successfully
  Data Type BOOL
Error Description If TRUE, an error has occurred
  Data Type BOOL
ErrorID Description Indicates the error if Error output is set to TRUE. See the table in Search IndexFile and TCP/IP Function Block ErrorID Output
  Data Type DINT

Example

Structured Text

(* FileSeek example *)
CASE StepCounter OF
0:
  (* Move to beginning of the file *)
  Inst_FileSeek(TRUE, MyInputFileID, 0, SEEK_SET);
  StepCounter := StepCounter + 1;
1:
  Inst_FileSeek(TRUE, MyInputFileID, 0, SEEK_SET);
  IF Inst_FileSeek.Done THEN
     Inst_FileSeek(FALSE, 0, 0, SEEK_SET);
     StepCounter := StepCounter + 1;
  END_IF;
END_CASE;