GET_PROCESS_LINE
Script Function: Retrieves the current line content of a data sequence.
Syntax
GET_PROCESS_LINE (Data sequence reference [, [Column] [, [STR_SUBSTITUTE_VAR] [, Row ] ] ])
Syntax |
Description/Format |
---|---|
Data sequence reference |
The reference to a data sequence that should be processed. |
Column |
Access to a column of the data sequence's line.
Dynamic variables (SQL, SQLI and Multi) can include any number of columns which depends on the relevant data source. Static variables only include 6 value columns ("1" to "6"). "1" returns the value of the key, "2" through "6" return the 5 value columns. So "6" returns value of column 5. FILELIST-Variables generally have only one column that can be addressed using "1". |
STR_SUBSTITUTE_VAR |
The lines of the data sequence are also searched for script variables that should be replaced with their values. Note that you must set a comma if you use this parameter is used but do not specify a Column. :SET &VALUE# = GET_PROCESS_LINE(&HND#, ,STR_SUB_VAR) |
Line | Line of the data sequence that should be accessed. Format: A number without quotations, script literal or script variable |
Comments
The script function GET_PROCESS_LINE reads a line or columns of a data sequence. The data sequence is provided by the following script elements:
- CREATE_PROCESS
- LOAD_PROCESS
- PREP_PROCESS
- PREP_PROCESS_AGENTGROUP
- PREP_PROCESS_COMMENTS
- PREP_PROCESS_DOCU
- PREP_PROCESS_FILE
- PREP_PROCESS_FILENAME
- PREP_PROCESS_PROMPTSET
- PREP_PROCESS_REPORT
- PREP_PROCESS_VAR
- PREP_PROCESS_VAR_XML
The script function GET_PROCESS_LINE is used within the script statements :PROCESS and :ENDPROCESS. These script statements form a loop for the line-by-line processing of the data sequence.
Please note: As of v9, GET_PROCESS_LINE has to be in a PROCESS loop formed by script statements.
The individual lines of a data sequence can also be subdivided in columns. You can specify this setting by using the parameters COL=LENGTH or COL=DELIMITER when you generate the data sequence. Particular columns can be accessed with their numbers (1 - first column) or with the column name if it has been specified.
The whole line is returned if the column is not specified or if you use "0". The line is truncated after 255 characters.
If the values of a Variable object are retrieved, the current line includes the Key (static variable) or the result column (dynamic variable) plus the corresponding values. The value "1" for Column readsthe Key/Result, the values "2" to "6" (static variables) reads the relevant value column. The result column corresponds to the first value column if no Result format is defined in the Variable object (SQL, SQLI, MULTI).
The number of value columns that is used in dynamic variables with the sources "SQL", "SQL - internal" or "Multi" is not limited and depends on the settings that have been made in the Variable objects and the data type.The comment columns can also be
read individually.
If the column number is not specified when a Variable object is accessed, the system returns the value of all columns (Key / Result included) separated by "ยงยงยง" characters.
SAP monitors can specifically be accessed. The SAP agent separates the individual lines that are supplied by SAP monitor in fixed columns. It saves column names and column sizes in the first line of the file that should be processed by the Automation Engine. The following columns can be accessed by using GET_PROCESS_LINE:
- CONTEXT - Name of the monitored context
- PATH - Path specification of a value
- NAME - Name of the value
- VALUE - Current value
- STATUS - Status: 1 = green, 2 = yellow, 3 = red
- DATE - Date of the verification
- TIME - Time of the verification
You can also use the parameter STR_SUBSTITUTE_VAR or its short form STR_SUB_VAR. Script variables are then searched within the line and replaced with their values. This function is very useful in combination with PREP_PROCESS_FILE. For example, you can prepare a text file that contains script variables in alterable positions in order to facilitate processing. No matter from where the data sequence is retrieved (file, report, Variable object), the values can be set by using script (see example 5 below).
Furthermore access to a specific line of the data sequence is possible. Enter the number of the line at the corresponding ccript function parameter. The first line is number 1. Line numbers from data sequences can be retrieved with the script function GET_PROCESS_INFO.
Note that by default, GET_PROCESS_LINE truncates blanks that are used at the end of the line that should be read. The administrator can deactivate this behavior in the setting GET_PROCESS_LINE_RTRIM of the variable UC_SYSTEM_SETTING.
Examples
Example 1 retrieves the directories of a drive and writes them to the activation report within the loop using :PRINT.
:SET &HND# = PREP_PROCESS("PC01","WINCMD","*DIR*","CMD=DIR C:")
:PROCESS &HND#
: SET &LINE# = GET_PROCESS_LINE(&HND#)
: PRINT &LINE#
:ENDPROCESS
Example 2 retrieves the values of a variable and writes them to the activation report within the process loop using :PRINT.
:SET &HND#=PREP_PROCESS_VAR(UC_CLIENT_SETTINGS)
:PROCESS &HND#
: SET &RET1# = GET_PROCESS_LINE(&HND#,1)
: SET &RET2# = GET_PROCESS_LINE(&HND#,2)
: PRINT "&RET1# &RET2#"
:ENDPROCESS
Example 3 reads all the Automic Web Interface's log file lines which provide information about the database. Column size and column names are specified and the relevant information is output in the activation protocol. Spaces (column 2 and 4) are ignored.
:SET &HND# = PREP_PROCESS_FILE(WIN21, "F:\AUTOMIC\DIALOG\TEMP\UCDJ_LOGG_01.TXT","*DB-INFO*","COL=LENGTH","LENGTH_TAB='8=DATUM,1,6=ZEIT,7,200=TEXT'")
:PROCESS &HND#
: SET &COL1# = GET_PROCESS_LINE(&HND#,1)
: SET &COL2# = GET_PROCESS_LINE(&HND#,3)
: SET &COL3# = GET_PROCESS_LINE(&HND#,"TEXT")
: PRINT "&COL1# &COL2#
&COL3#"
:ENDPROCESS
Example 4 reads the SAP monitor "MON1" from the monitor set "AE". The individual columns of the monitor data should be accessed. The lines of the data sequence are output in the activation report.
:SET &HND# = PREP_PROCESS("T01","R3MONITOR","*","MONSET=AE","MONNAM=MON1","COL=FILE","UC_USER_ID=AE","UC_SAPCLIENT=001")
:PROCESS &HND#
: SET &PATH# = GET_PROCESS_LINE(&HND#,"PATH")
: SET &NAME# = GET_PROCESS_LINE(&HND#,"NAME"")
: SET &VALUE# = GET_PROCESS_LINE(&HND#,"VALUE"")
: SET &STATUS# = GET_PROCESS_LINE(&HND#,"STATUS")
: SET &DATE# = GET_PROCESS_LINE(&HND#,"DATE")
: SET &TIME# = GET_PROCESS_LINE(&HND#,"TIME")
: PRINT "&PATH# &NAME#
&VALUE# &STATUS# &DATE# &TIME#"
:ENDPROCESS
Definition of the column sizes and names in the file (first line) that is provided by the SAP agent.
COL=LENGTH,LENGTH_TAB='74=PATH,25=NAME,5=VALUE,2=STATUS,9=DATE,7=TIME'
Example 5 reads the lines of a text file and replaces the included script variables with their values. The modified lines are then written to the activation report.
:SET &NAME# = SYS_ACT_ME_NAME()
:SET &DATE# = SYS_DATE_PHYSICAL("MM/DD/YYYY")
:SET &TIME# = SYS_TIME_PHYSICAL("HH:MM")
:SET &JPNAME# = SYS_ACT_PARENT_NAME()
:SET &HND# = PREP_PROCESS_FILE ("WIN01","C:\AUTOMIC\REPORT.TXT")
:PROCESS &HND#
: SET &RET# = GET_PROCESS_LINE (&HND#,,STR_SUB_VAR)
: PRINT &RET#
:ENDPROCESS
Abstract of the ready-made text file REPORT.TXT:
&date#/&time#
Report for &NAME#:
Activated by workflow: &JPNAME#
See also:
Script Elements - Data Sequences
Sample Collection
Setting the End Status depending on the Report Content
Calling an MBean
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function