FIOManager

FIOManage

Initialization

To use the functionality, a variable must be declared of type FIOManage.

Cyclic Operation

To manage files or directories cyclically, FIOManageFn_Cyclic() must be called in the CYCLIC routine of your program, once every scan, unconditionally. This function should not be called on the same FIOManage variable more than once per scan.

FIOManageFn_Cyclic(FIOManage);

The FIOManage structure can then be used to delete old files or directories.

IF (Scan) THEN

	FIOManage.IN.PAR.FileDevice := 'Recipes';
	FIOManage.IN.PAR.ItemName := 'test';
	FIOManage.IN.PAR.MaxNumItems := 5;
	FIOManage.IN.PAR.Mode := MANAGE_FILE_MODE;

	FIOManage.IN.CMD.Scan := 1;

ELSIF (FIOManage.OUT.STAT.Done OR FIOManage.OUT.STAT.Error)

	FIOManage.IN.CMD.Scan := 0;

END_IF

Reference

FIOManage Data Structure

The FIOManage structure provides the interface for managing files and directories.

Inputs

The FIOManage inputs are divided into commands (IN.CMD) and parameters (IN.PAR). Commands are used to initiate operations, and parameters determine how the commands will be processed.

Commands
  • Scan - Scan the FileDevice and Directory and delete old items (files and/or directories). Only items that match the ItemName will be affected. Only the newest items will be kept, up to MaxNumItems. The Mode input determines which items are affected.
  • DeleteAll - Delete all of the items in the current FileDevice and Directory.
  • AcknowledgeError - Acknowledge any errors that occur.
Parameters
  • FileDevice - The file device to manage.
  • Directory - The directory within the file device to manage. This can be left blank unless the file device is the root folder.
  • ItemName - The name of the file, with optional extension, or directory to be managed. The name acts as a filter; any file or directory that begins with ItemName will be managed.
  • MaxNumItems - The maximum number of files or directories to keep.
  • Mode - The mode of operation. This will tell the manager to manage files, directories, or both. Supported modes are MANAGE_FILE_MODE, MANAGE_DIR_MODE, and MANAGE_BOTH_MODE. Files are managed by default.

Outputs

The FIOManage outputs contain status information (OUT.STAT).

  • Busy - Operation is currently being processed.
  • Done - Operation completed successfully. Done is reset when the input command is reset.
  • Error - Error occurred during operation. Error is reset with the AcknowledgeError command.
  • ErrorID - Current error ID number.
  • ErrorString - Current error text information.
  • ErrorLevel - Current error level.
  • ReadyForCMD - The FIOManage is ready to accept a new command. It is equivalent to NOT(Busy OR Done OR Error).

Error ID Numbers

  • 20700 - fiERR_INVALID_PATH - Invalid path.
  • 20701 - fiERR_DATA_SIZE - Data length is too small (DirRead).
  • 20702 - fiERR_NO_MORE_ENTRIES - No more file handles available.
  • 20703 - fiERR_NOT_SUPPORTED - System error.
  • 20704 - fiERR_INVALID_TYP - Invalid type.
  • 20705 - fiERR_EXIST - File already exists.
  • 20706 - fiERR_ACCESS - Access not possible with the desired mode.
  • 20707 - fiERR_MODE - Illegal mode.
  • 20708 - fiERR_FILE_NOT_FOUND - File not found. Check IN.PAR.FileName.
  • 20709 - fiERR_FILE_DEVICE - File device not found. Check IN.PAR.FileDevice.
  • 20710 - fiERR_SPACE - Not enough memory to write file.
  • 20711 - fiERR_SEEK - Invalid file offset.
  • 20712 - fiERR_FILE - File not allowed.
  • 20713 - fiERR_LESS_VIRTUAL_MEMORY - Not enough memory to write file.
  • 20714 - fiERR_COM_FILE_OPEN - System error.
  • 20715 - fiERR_COM_FILE_CLOSE - System error.
  • 20716 - fiERR_COM_FILE_READ - System error.
  • 20717 - fiERR_COM_FILE_WRITE - System error.
  • 20718 - fiERR_COM_FILE_IOCTL - System error.
  • 20719 - fiERR_DATA - Invalid parameter. Check IN.PAR.pData.
  • 20720 - fiERR_ASYNC_MANAGER - System error.
  • 20721 - fiERR_FILE_NOT_OPENED - File not opened.
  • 20722 - fiERR_INVALID_DIRECTORY - Invalid directory. Check IN.PAR.FileDevice and IN.PAR.FileName.
  • 20723 - fiERR_DIR_NOT_EXIST - Directory does not exist. Check IN.PAR.FileDevice and IN.PAR.FileName.
  • 20724 - fiERR_DIR_NOT_EMPTY - Directory is not empty.
  • 20725 - fiERR_DIR_ALREADY_EXIST - Directory already exists.
  • 20726 - fiERR_DETMEMINFO - System error.
  • 20727 - fiERR_NOT_ENOUGH_FREEMEM - Not enough memory to write file.
  • 20728 - fiERR_DIR_INVALID_HANDLE - System error.
  • 20729 - fiERR_PARAMETER - System error.
  • 20730 - fiERR_DEVICE_ALREADY_EXIST - Device already exists.
  • 20731 - fiERR_DEVICE_INVALID_HANDLE - Invalid device handle.
  • 20732 - fiERR_NETIO_IP_UNEQUAL - IP address error. Check hostname.
  • 20796 - fiERR_INIT - System error.
  • 20797 - fiERR_DEVICE_DRIVER - System error.
  • 20798 - fiERR_DEVICE_MANAGER - File device error. Check IN.PAR.FileDevice.
  • 20799 - fiERR_SYSTEM - System error.
  • 50000 - FIOWRAP_ERR_INVALIDOP - Internal error.
  • 50001 - FIOWRAP_ERR_INVALIDFILTER - Input required for IN.PAR.ItemName. Set IN.PAR.ItemName := ‘*’ to manage all files or directories.
  • 50002 - FIOWRAP_ERR_INVALIDDIR - Cannot manage in root directory. Check IN.PAR.FileDevice and IN.PAR.FileDirectory.
  • 50003 - FIOWRAP_ERR_MAXFILESIZE - Error while appending: maximum file size would be exceeded.

Error ID numbers 20700 - 20799 are passed on directly from the FileIO library. For additional information on these errors, please see the Automation Studio Online Help.