PREP_PROCESS_FILENAME
Script Function: It retrieves a list of the file names that are available in a specified computer directory and provides the result for further processing in the form of an internal list (data sequence).
Syntax
PREP_PROCESS_FILENAME (Host, File name, [Wildcards], [Subfolder], [Filter] [,"COL=Definition1[, Definition2]"][ ,"UC_LOGIN=Login object"])
Syntax |
Description/Format |
---|---|
Host |
The computer (name of the agent) on which the files are stored. |
File name |
The path and the file name that should be searched. The wildcard characters "*" and "?" can be used in file names. "*" stands for any character, "?" for exactly one. Paths must not contain wildcard characters. Whether uppercase and lowercase letters are considered depends on what is specified in the parameter Wildcards. |
Wildcards |
This indicates whether the file name is specified with wildcard characters. Allowed values: "Y" (default value) and "N" "Y" = File name with wildcard characters; uppercase and lowercase letters are not distinguished |
Subfolder |
This indicates whether subfolders or subdirectories should be included in the search. Allowed value: "Y" and "N" (default value) "Y" = Subfolders or subdirectories |
Filter |
This is an additional option for filtering the lines of the data sequence. Case-insensitive; uppercase or lowercase spelling is accepted. The wildcard characters "*" and "?" can be used. "*" stands for any character, "?" for exactly one. Default: "*" |
Definition1 |
This determines whether the lines of the data sequence should be split in columns. Allowed values: "NONE" (default value), "LENGTH", "DELIMITER" "NONE" = No columns |
Definition2 |
This determines column sizes and names (optional) or the delimiter. Allowed values: "LENGTH_TAB" and "DELIMITER"
|
Login object |
The name of a Login object. Put the complete phrase UC_LOGIN=Login object in inverted commas. |
Return code |
---|
The reference to a data sequence of the file list. "20240" - Login information is missing. |
Comments
The script function PREP_PROCESS_FILENAME provides a list of file names for further processing with AE Script. On the host, the files are retrieved by the agent and processed as a data sequence.
The parameter File name is used to call the files that should be listed. If File name contains a drive indication, all found files are displayed in the same way. You can specify whether subfolders or subdirectories should be considered. You can also filter the list of files that were found.
Wildcards, Subfolders, Filters and the parameters for splitting columns are optional. Note that you must use a comma in order to indicate that one of the parameters is not used. You can use any of the optional parameters as the last parameter. Make sure that no comma is used after the last parameter. Definition2 cannot be used without Definition1.
By default, the script function GET_PROCESS_LINE reads the complete line of a data sequence. You can also access it in a structured way when the lines are divided in columns. The following rules apply in this case:
- The number of columns is limited to 22 and a total size of 2048 bytes.
- The column width must not exceed 255 characters.
- The column name is limited to a maximum of 32 characters.
To access particular columns, you can use GET_PROCESS_LINE.
By using the optional parameter UC_LOGIN, you can assign the name of a Login object to this script function. PREP_PROCESS_FILENAME uses the login data that has been defined in the Login object. In doing so, you can access connected network drives, for example. Users require the Privilege "File transfer: Start without user ID" when the script function PREP_PROCESS_FILENAME should be used without the parameter UC_LOGIN.
The script function's return code refers to a data sequence which is passed on to the script statements :PROCESS and :ENDPROCESS in the form of start parameters. In combination with the script function GET_PROCESS_LINE, each individual line of the data sequence and its columns can now be processed.
Note that no error will occur when the data sequence does not contain the required content.The only effect is that the data sequence that is defined between :PROCESS and :ENDPROCESS does not take place.
You cannot assign a new value to the script variable that contains the reference to the data sequence. You must first discard the data sequence that includes the script statement CLOSE_PROCESS, and then you can reuse the variable.
Agents for applications (Oracle Applications, PeopleSoft or SAP) do not support PREP_PROCESS_FILENAME.
This script statement causes all open transactions of the script to be written to the AE database.
Examples
The following example lists all HTML documents that the WebHelp of the Automation Engine Documentation includes. It is explicitly specified that wildcard characters are used. The result will be written to 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 second example creates a list of all stylesheets that are supplied with the Automation Engine Documentation. All subfolders of the documentation directory should be searched. The result contains no drive specification and is written to the 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 third example creates a list of all AE programs. The individual lines are split in columns. The columns are separated by backslashes. The 5th column that contains the file name of the program is accessed while the data sequence is being processed. The result is written to the activation protocol.
: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 fourth example is based on the third example but a filter is set so that only the file name of the Automation Engine is written to the activation protocol.
: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:
Script element | Description |
---|---|
Discards an unnecessary data sequence |
|
Loop for line by line processing of a data sequence - a sequential file or a command result, for example |
|
This is used to retrieve content from the current line of a data sequence. |
Script Elements - Data Sequences
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function