PREP_PROCESS_FILENAME

Use the PREP_PROCESS_FILENAME script function to retrieve a list of files that are available in a specific computer directory. The script lets you filter for particular file names, and specify whether to include subdirectories and folders. On the host, the Agent retrieves the files. The script function returns a reference to a 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 each line in the data sequence.

Important! Agents for applications (Oracle applications, PeopleSoft, and SAP) do not support PREP_PROCESS_FILENAME.

Syntax

PREP_PROCESS_FILENAME (Host, File name, [Wildcards], [Subfolder], [Filter] [, "COL=Definition1[, Definition2]"] [, "UC_LOGIN=Login object"])

Note: Include commas between the parameters even if you omit parameters. Do not place a comma after the last parameter that you specify.

Parameters

Parameter Description Format Allowed Values Default Value
Host Name of the Agent on the computer on which the files are located. Script literal or script variable n.a. n.a.
File name

Path and file name to search for.

Notes:

  • Use the wildcard character * to stand for any number of characters, or ? for a single character in the file name.

  • Do not use wildcards in the path.

Script literal or script variable n.a. n.a.
Wildcards (Optional) Indicates whether the file name is specified with wildcard characters. Script literal or script variable
  • Y

    File name contains wildcard characters, case insensitive.

  • N

    File name does not contain wildcard characters, case sensitive.

Y
Subfolder (Optional) Determines whether to include subfolders and subdirectories in the search. Script literal or script variable
  • Y

    Subfolders and subdirectories are included.

  • N

    Subfolders and subdirectories are excluded.

N
Filter

(Optional) Additional filter for file names in the data sequence.

Notes:

  • The filter is case insensitive.

  • Use the wildcard character * to stand for any number of characters, or ? for a single character.

Script literal or script variable n.a. *
COL Use the following format COL=Definition1[, Definition2]. For more information, see Defining Columns. Script format n.a. n.a.
UC_LOGIN=Login object

(Optional) Name of a Login object. The login user in the Login object is checked for access to the file system that should be scanned.

Important!

  • If you do not specify a Login object, the user must have the following privilege: File Transfer: Start without Login object specified and the FT_ANONYMOUS=Y must be set. For more information, see Granting Automation Engine Privileges and UC_HOSTCHAR_DEFAULT - Host Characteristics.

  • Enclose the complete phrase UC_LOGIN=Login object in quotation marks.

  • (z/OS) UserIDs without a password (such as PROTECTED UserIDs in the Login object) cannot be used anymore since v12.1 when login security was improved and password requirements were changed. See Login (LOGIN).

Script literal or script variable n.a. n.a.

Defining Columns

To split the data sequence lines into columns, specify the Column separation parameter as follows:

COL=Definition1[, Definition2]

Parameter Description Format Allowed Values Default Value
COL Keyword for column separation. Keyword n.a. n.a.
Definition1 Defines whether the data sequence lines are split into columns. Script literal or script variable
  • NONE Lines are not split into columns.

  • LENGTH Sets a predefined column size.

    Note: Use LENGTH_TAB in Definition2 to specify the size.

  • DELIMITER Separates columns with a delimiter.

    Note: Use DELIMITER in Definition2 to specify the delimiter.

NONE
Definition2

(Optional) Defines column sizes and names, or the delimiter.

Note: If you specify Definition2, you must specify Definition1.

Script literal or script variable
  • LENGTH_TAB Specifies column sizes and column names.

    Example:

    "COL=LENGTH,LENGTH_TAB='3=drive,100=file name'"

    Notes:

    • Separate individual column definitions with commas.

    • Specify up to 22 columns with a total of 2048 bytes.

    • Specify the column size as the number of characters. The maximum size is 255 characters.

    • (Optional) specify column names. Names can be up to 32 characters long.

    • Use quotation marks before the first and after the last column definition. Use double quotation marks if you use single quotation marks for script literals in Definition2, or vice versa.

  • DELIMITER Defines a delimiter that separates columns. The lines of the data sequence are returned as columns that are placed before, between or after the delimiter string.

    Example:

    "COL=DELIMITER,DELIMITER=*'*"

    'COL=DELIMITER,DELIMITER=@"@'

    Default Value: ;

    Notes:

    • You can use any characters as the delimiter.

    • The delimiter can be a string of up to 10 characters.

    • Enclose the delimiter with any character: *Delimiter*. The enclosing characters are not displayed in the output.

    • A column is not separated if a line does not include a delimiter.

    • If you use single quotation marks as delimiters, then you must enclose Definition2 in double quotation marks, or vice versa.

n.a.

Important Considerations

Keep the following rules and behaviors in mind when using this script function:

  • This script function writes all open transactions of the script to the AE database. For more information, see Script Processing.
  • You cannot assign a new value to the script variable that contains the reference to the data sequence. Use :CLOSE_PROCESS to discard the existing data sequence, and then assign a new value.
  • There is no error message if the data sequence does not contain the content that you specify. The :PROCESS script statement does not process the data sequence in this case.

Return Codes

The script function retrieves a reference to a data sequence that contains a list of retrieved file names. The following return codes indicate errors:

  • 20240: Login information is missing
  • 20303: Automation Engine authorization error
  • 20349: Agent is not available
  • 20510: A CP or WP is specified instead of an Agent
  • 20514: Invalid entry when used with wildcard characters

Examples

The following example lists all HTML documents contained in the Web Help of the Automic Automation documentation. The use of wildcards is explicitly specified. The resulting list of files is printed in the activation report.

:SET &HND# = PREP_PROCESS_FILENAME("WIN01", "c:\AUTOMIC\documentation\webhelp\german\uc*.htm", "Y",,,, "UC_LOGIN=WIN_LOGIN")

:PROCESS &HND#

:SET &LINE# = GET_PROCESS_LINE(&HND#)

:PRINT &LINE#

:ENDPROCESS

The following example creates a list of all stylesheets that are supplied with the Automation Engine documentation. All subfolders of the documentation directory are included in the search. The result contains no drive specification, and is written to the activation report.

:SET &HND# = PREP_PROCESS_FILENAME("WIN01", "\AUTOMIC\documentation\uc*.css", "Y","Y",)

:PROCESS &HND#

:SET &LINE# = GET_PROCESS_LINE(&HND#)

:PRINT &LINE#

:ENDPROCESS

The following example creates a list of all AE programs. The individual lines are split in columns, with the columns separated by backslashes. The script retrieves the fifth column in the data sequence, which contains the file name of the program, and writes the results in the activation report.

:SET &HND# = PREP_PROCESS_FILENAME("WIN01", "c:\AUTOMIC\server\bin\*.exe",,,, "COL=DELIMITER, DELIMITER=*\*")

:PROCESS &HND

:SET &LINE# = GET_PROCESS_LINE(&HND#, 5)

:PRINT &LINE#

:ENDPROCESS

The following example retrieves the same files, but this time, a filter excludes all files except those that contain the string "server" in the file name.

:SET &HND# = PREP_PROCESS_FILENAME("WIN01", "c:\AUTOMIC\server\bin\*.exe",,, "*server*", "COL=DELIMITER, DELIMITER=*\*")

:PROCESS &HND#

:SET &LINE# = GET_PROCESS_LINE(&HND#, 5)

:PRINT &LINE#

:ENDPROCESS

See also: