PREP_PROCESS_FILE

Use the PREP_PROCESS_FILE script function to retrieve the content of a text file, such as a log or trace file, which is available on a particular computer. The content of the file is stored in an internal list (data sequence) line by line. The script lets you filter for a particular text in the file. The script function returns a reference to the data sequence that you can use for further processing by assigning the return code to the :PROCESS script statement. Use the GET_PROCESS_LINE script function to access content in the data sequence.

Important!

Notes:

Syntax

PREP_PROCESS_FILE (Host, File,[ Filter] [, "COL=Definition1[, Definition2]"][, UC_LOGIN=Login object])

Parameters

Defining Columns

This script function reads the entire line of a data sequence. The data can also be accessed when the line is divided into columns. The columns can be defined in the first line of the file itself, or specified in the parameters of PREP_PROCESS_FILE. The following restrictions apply:

Important! The script aborts if you exceed these limits.

To define columns in the script function, specify the following parameters:

COL=Definition1[, Definition2]

Where

Examples

The following example reads the contents of a text file, and retrieves all lines that contain the string "Start". The script prints the retrieved lines in the activation report.

:SET &HND#=PREP_PROCESS_FILE(WIN21,"\\FServer\UC4\BSP\INPUT.TXT","*Start*")
:
PROCESS &HND#
:   
SET &LINE#=GET_PROCESS_LINE(&HND#)
:  
PRINT &LINE#
:
ENDPROCESS

The following example reads all lines of a file, and divides the retrieved data into columns as defined in the first line of the file itself. The script specifies a Login object to log on to the computer where the file is located.

:SET &HND = PREP_PROCESS_FILE(WIN21, "\\FServer\LOG.TXT", ,"COL=FILE",'UC_LOGIN=UC4FT')

The following script includes parameters that define column names and widths. Columns without a name are ignored.

:SET &HND = PREP_PROCESS_FILE(WIN21, "\\FServer\UC4\DIALOG\TEMP\UCDJ_LOGG_01.TXT","*DB-INFO*","COL=LENGTH,LENGTH_TAB='74=PATH,25=NAME,5=VALUE,2=STATUS,9=DATE,7=TIME'")

The following script defines the tabulator as a separator for the columns. The script only prints the content of the third column in the activation report.

:SET &HND# = PREP_PROCESS_FILE(UNIX01, "/uc4/test.txt",,"COL=DELIMITER,DELIMITER=<TAB>")
:
PROCESS &HND#
:   
SET &LINE# = GET_PROCESS_LINE(&HND#,3)
:   
PRINT &LINE#
:
ENDPROCESS

See also:

seealso

Script Elements for Data Sequences