Previous Topic: TEMPLATETERR Statement—Specify the Template Territory for a Single Request or Request SetNext Topic: TEXTSTRING Statement—Specify a Text String to Search For


TEXTFILE Statement—Specify a Text File Name and Location

The TEXTFILE statement specifies the name and location (path) of the text file to search.

Supported Job Type

This statement is required for the Text File Reading and Monitoring job type.

Syntax

This statement has the following format:

TEXTFILE file_name
file_name

Specifies the path to and name of the text file to search.

Limits: Up to 256 characters; case-sensitive

i5/OS:

library

Specifies the name of the library that contains the object. The value must be a valid i5/OS library name.

Limits: Up to 10 characters

Notes:

  • You can specify *ALL to match any name.
  • You can specify a generic name.
object

Specifies the name of the object. The value must be a valid i5/OS object name.

Limits: Up to 10 characters

Notes:

  • You can specify *ALL to match any name.
  • You can specify a generic name.
member

Specifies a member in the *FILE object. The value must be a valid i5/OS member name.

Limits: Up to 10 characters

Notes:

  • You can specify *FIRST.
  • You can specify *ALL to match any name.

Note: If you do not specify a member, the agent searches the entire file object.

Note: Enclose values that contain delimiters (such as spaces) in double quotation marks.

Example: Specify a Text File Name on Windows

This example searches for a text string in the log text file on a Windows computer. The path to the text file is enclosed in single quotation marks because the path contains a space. The job searches between lines 1234 and 1876. The job completes successfully if the string is found.

AGENT WINAGENT
TEXTSTRING 'ERROR MESSAGE' EXIST
TEXTFILE 'c:\program files\agent\log'
SEARCHRANGE LINE FROM(1234) TO(1876)

Example: Specify a Text File Name on UNIX

This example searches the /export/home/logs/transmitter.log file in date and time mode. The job searches the content between May 20, 2010 at midnight and May 27, 2010 at 11:59 p.m. The date and time values are defined using the format specified in the TIMEFORMAT statement. The job completes successfully if the transmitted string is found.

AGENT UNIXAGENT
TEXTFILE '/export/home/logs/transmitter.log'
TEXTSTRING transmitted EXIST
SEARCHRANGE DATETIME +
  FROM('Thu May 20 00:00:00.000 EDT 2010') +
  TO('Thu May 27 23:59:59.999 EDT 2010')
TIMEFORMAT 'EEE MMM dd HH:mm:ss.SSS zzz yyyy' TIMEPOS(12)

Example: Specify a Text File Name on i5/OS

This example searches for a text string in the DATA member of a QSYS file object on an i5/OS computer. The job searches the content between lines 1 and 20. The job completes successfully if the string is found.

AGENT I5AGENT
TEXTFILE /QSYS.LIB/LIBRARY.LIB/RESULTS.FILE/DATA.MBR
TEXTSTRING 'Create file failed' EXIST
SEARCHRANGE LINE FROM(1) TO(20)