GET_PROCESS_LINE
Use the GET_PROCESS_LINE script function to read an entire line or specific columns from a data sequence. You must use this script function within a process loop to iterate through the sequence.
Notes:
- For an overview of script elements you can use to create and manage data sequences, see Script Elements for Data Sequences.
- For more information on constructing loops for line-by-line processing, see :PROCESS... :TERM_PROCESS... :ENDPROCESS.
Syntax
GET_PROCESS_LINE (Data sequence reference [, [Column] [, [STR_SUBSTITUTE_VAR] [, Line]]])
Parameters
| Parameter | Description | Format / Allowed Values |
|---|---|---|
| Data sequence reference | Defines the specific data sequence to be processed. | Script variable |
| Column |
(Optional) Accesses a targeted column within the data sequence line. The available values depend heavily on the source of the data sequence:
|
Number (without quotes), script literal, or script variable |
| STR_SUBSTITUTE_VAR or STR_SUB_VAR |
(Optional) Searches the line content for script variables and automatically replaces them with their actual assigned values. Note: You must include a comma placeholder if you utilize this parameter but omit the Column parameter (e.g., GET_PROCESS_LINE(&HND#,,STR_SUB_VAR)). |
Keyword |
| Line |
(Optional) Explicitly defines the line number to access. The first line is 1. Use negative numbers to count backward from the end. Notes:
|
Number (without quotes), script literal, or script variable |
SAP Monitors
You can specifically access SAP monitors. The SAP Agent divides the lines supplied by the monitor into fixed columns, saving column names and sizes in the file's first line. You can access the following columns 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 indicator (1 = green, 2 = yellow, 3 = red)
- DATE: Date of the verification
- TIME: Time of the verification
Examples
The following example retrieves the directories of a drive and writes them to the activation report line-by-line within the process loop using :PRINT:
: SET &HND# = PREP_PROCESS ("PC01", "WINCMD", "*DIR*", "CMD=DIR C:")
: PROCESS &HND#
: SET &LINE# = GET_PROCESS_LINE (&HND#)
: PRINT &LINE#
: ENDPROCESS
This example retrieves the values from a VARA object and prints the first two columns to the activation report within the process loop:
: 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
This snippet reads log file lines containing database information, using predefined column sizes and names to extract relevant data while ignoring the spaces in columns 2 and 4:
: SET &HND# = PREP_PROCESS_FILE (WIN21, "F:\AUTOMIC\DIALOG\TEMP\UCDJ_LOGG_01.TXT", "*DB-INFO*", "COL=LENGTH", "LENGTH_TAB ='8=DATE,1,6=TIME,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
The following example reads the SAP monitor "MON1" from the monitor set "AE". It accesses the individual columns of the monitor data and prints them to 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
The column sizes and names are defined dynamically via the SAP Agent in the file's first line:
COL=LENGTH,LENGTH_TAB='74=PATH,25=NAME,5=VALUE,2=STATUS,9=DATE,7=TIME'
This example uses the STR_SUB_VAR parameter to read a text file line-by-line and automatically replace any embedded script variables with their current assigned values before outputting them:
: 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 prepared REPORT.TXT text file:
&date#/&time#
Report for &NAME#:
Activated by workflow: &JPNAME#
Depending on your settings, the report file output may look similar to the following:
2022-11-23 15:59:56 - U00020408 "11/23/2022/15:59"
2022-11-23 15:59:56 - U00020408 ""
2022-11-23 15:59:56 - U00020408 "Report for JOBS.CREATE_TEST_FILE:"
2022-11-23 15:59:56 - U00020408 ""
2022-11-23 15:59:56 - U00020408 "Activated by workflow: "
See also: