Script Function: This script function uses specific Job objects (event jobs) in order to process commands on a computer and it returns the Console output that can be used for further processing as an internal list (data sequence).
PREP_PROCESS(Host, EventJob, [Filter], Action, [Column separation]..., [UC_LOGIN=Login object])
Syntax |
Description/Format |
---|---|
Host |
Computer (agent name) on which the event runs. |
EventJob |
Name part of the event job that should be executed. |
Filter |
Defines a filter condition for the content of the returned line (case insensitive). Format: script literal or script variable |
Action |
Assigns a value to a script variable of the event job, Specific syntax: Variable=Assignment Variable - Name of the event job's script variable which assumes the value assignment. It is specified without the & character. Assignment - Value of the script variable. This is mainly an action (command, program call or activation of a file) that should be executed in the target system, or any other value assignment (variables of the attribute dialog). You can use variables set in the ATTRDIA.* include objects found in client 0. The sixth example below sets the queue object assignment for UNIX. A specific syntax is required in order to query the UNIX file system. |
Column separation
|
You can also specify that data sequence lines should be subdivided in columns. Use the following format: COL=Definition1[, Definition2]. Definition1: Allowed values: "NONE" (default value), "FILE", "LENGTH", "DELIMITER" "NONE" = No subdivision in columns Definition2: Defines column sizes and names (optional) or the delimiter Allowed values: "LENGTH_TAB" and "DELIMITER"
Note that separation by columns only works correctly if values do not contain the reserved String "ยงยงยง". |
UC_LOGIN |
Name of a Login object. Note that this script function requires login data. The relevant event job must include valid login information if the parameter UC_LOGIN has not been specified. |
Return code |
---|
Reference to the data sequence of the command. |
The script function PREP_PROCESS creates a data sequence such as the results of:
Executing a BS2000 Console command or querying a UNIX file system requires the AE utilities UCYEBXXZ or UCXE???F to be installed.
Console and OS commands are processed by means of event jobs which start in the background on the computer of the specified agent (Host). A command's result lines are available in the form of an internal list (data sequence) via the script function's return code.
The names of event jobs are structured as follows: "EVENT.EventJob". "EVENT." is a pre-determined
part of the job name. The part "EventJob", however, can be defined in any way. The definition of an event job is given in terms of particular
attributes and the general script structure.
event
jobs are supplied in system client 0000. You can use them directly or as a template in the individual clients. If required, you can adjust their contents. Keep in mind to change the script procedure in EVENT.UNIXCMD to avoid that the report will be deleted if a return code >0 occurs.
The following internal steps are passed when the data sequence that is provided by PREP_PROCESS is being processed:
Note that the RunID is shown as a converted string (see RUNNR2ALPHA) and not as a number.
By default, this script function reads an entire line. You can also access it in a structured way if the line has been subdivided into columns. The following rules apply:
GET_PROCESS_LINE can be used to access particular columns.
The script function returns a data sequence reference. This reference is passed to the script statements :PROCESS and :ENDPROCESS as a start parameter. In combination with the script function GET_PROCESS_LINE, you can now process each individual line of the data sequence and its columns.
No error message is displayed if the data sequence does not contain the indicated content. The processing of the data sequence that is defined between :PROCESS and :ENDPROCESS does simply not take place.
You cannot assign a new value to the script variable which contains the data sequence reference. The data sequence must be discarded with the script statement :CLOSE_PROCESS first, and then the variable can be reused.
This script statement causes all open transactions of the script to be written to the AE databaseA database is an organized collection of data including relevant data structures..
In the first example, the command "/STA P" is executed on the BS2000 computer "C70". The required ID and account are read from the Login object.
:SET &HND# = PREP_PROCESS("C70","BS2000CMD",,"CMD=/STA P","UC_LOGIN=ADMIN")
The next example executes a command on a BS2000 console which outputs all open applications. No filter is specified for the line content.
:SET &HND# = PREP_PROCESS("C70","BS2000UCON",,"CMD=/BCDISP DISP=O","UC_LOGIN=ADMIN")
The third example retrieves the directories of a given drive on the Windows computer "WIN23".
:SET &HND# = PREP_PROCESS("WIN23","WINCMD","*DIR*","CMD=DIR C:","UC_LOGIN=ADMIN")
The fourth example reads the SAP monitor "MON1" from the monitor set "AE". The individual columns of the monitor data which have been defined in the file should be accessed. User and SAP client are read from the specified Login object.
:SET &HND# = PREP_PROCESS("T46","R3MONITOR","*","MONSET=AE","MONNAM=MON1","COL=FILE","UC_LOGIN=AEADMIN")
The fifth example runs a command on the UNIX agent "UNIX01" which returns information about connections with the port 2400.
:SET &HND# = PREP_PROCESS("UNIX01","UNIXCMD",,"CMD=netstat -an | grep 2400","UC_LOGIN=LOGIN.UNIX")
The sixth example sets the queue object assignment. Note that the value of uc_queue in this example comes from the ATTRDIA.UXIX include object.
:SET &HND# = PREP_PROCESS("UNIX01",'*','cmd=dir','uc_queue=&$QUEUE#',"UC_LOGIN=LOGIN.UNIX")
See also:
Script element | Description |
---|---|
Discards an unnecessary data sequence. |
|
They are used to define a loop for line by line processing of data sequences. For example, the contents of sequential files or the result of a command. |
|
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