Script functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,…: Retrieves the listShows entities in a grid view of registeredThis is the status of a task that runs within a group and is waiting for its start. output of jobs that have already run and makes the result available as an internal list (data sequenceAn internal listing of Console outputs or lines of Variable objects, etc. The lines of a data sequence can be accessed by using a PROCESS loop or the script element GET_PROCESS_LINE. The script elements PREP_PROCESS* generate data sequences.) for further processing.
PREP_PROCESS_REPORTLIST([RunID], [Filter])
Return code |
---|
Reference to the data sequence of the job output list. |
This script function retrieves the list of registered job output that is available in the Directory tab of the report dialog. This includes the external files and the default reports.
The return codeThe value that represents the result of tasks and script functions. of this script function is a data sequence reference. It can be assigned to the script statements :PROCESS and :ENDPROCESS as a start parameter, thereby creating a loop. The number of loops corresponds to the number of job output entries. The script function GET_PROCESS_LINE can be used to access the individual columns (altogether eight) of each line.
No new value can be assigned to the script variable containing the data sequence reference. The data sequence must be discarded with the script statement CLOSE_PROCESS first and then the variableIt stores or retrieves values dynamically at runtime. An individual Automation Engine object type. can be re-used.
All job output files are used if the Filter parameter is not specified (corresponds to Filter = *).
The following columns of each entry can be read:
Column number | Value |
---|---|
1 |
Report type (such as ACT, REP, REV01 etc.) External job output files are named as follows:
NNN - three-digit sequential number |
2 |
Point in time at which creation of the job output started. Format: YYYY-MM-DD HH:MM:SS |
3 |
Point in time at which creation of the job output ended. Format: YYYY-MM-DD HH:MM:SS |
4 | Title (only for SAP jobs) |
5 |
Is it an XML report? (Only for SAP jobs) Possible values: |
6 |
Full path and name of the external job output file or the job report (report type = REP). In default reports (such as ACT), this column is empty. |
7 |
Possible values: |
8 |
Is the job output stored in the AE databaseA database is an organized collection of data including relevant data structures.? Possible values: |
The first simple example reads the output file names and paths of the last execution of the job JOBS.WIN.OUTPUT and writes them to the activation report.
:SET &RUNID# = GET_STATISTIC_DETAIL(,RUNID,JOBS.WIN.OUTPUT)
:SET &HND# = PREP_PROCESS_REPORTLIST(&RUNID#)
:PROCESS &HND#
:SET &FILENAME# = GET_PROCESS_LINE(&HND#, 6)
: IF &FILENAME# = ""
: ELSE
: PRINT "File name = &FILENAME#"
: ENDIF
:ENDPROCESS
In the following example, a Windows job generates two files and registers them as job output. The following lines are included in the job's Process tab:
dir C:\temp >> C:\temp\test.txt
:REGISTER_OUTPUTFILE "C:\temp\test.txt","N"
dir C:\windows >> C:\temp\test2.txt
:REGISTER_OUTPUTFILE "C:\temp\test2.txt","N"
The job's "Post Process" includes the script element PREP_PROCESS_REPORTLIST which queries the complete job output list and writes the individual columns of each line to the job log with a process loop. A file transferTransfers files from one computer to another. A particular Automation Engine object type (FileTransfer object). starts for each external output file and transfers this file to a different computer. The agent, job loginAn Automation Engine object type that stores account credentials used by agents on target systems. and the file's complete path are passed on to the FileTransfer object.
:PSET &AGENT_JOB# = GET_ATT(HOST)
:PSET &LOGIN_JOB# = GET_ATT(LOGIN)
:SET &HND# = PREP_PROCESS_REPORTLIST()
:PROCESS &HND#
: SET &RH_TYPE# = GET_PROCESS_LINE(&HND#, 1)
: SET &START_TIME# = GET_PROCESS_LINE(&HND#, 2)
: SET &END_TIME# = GET_PROCESS_LINE(&HND#, 3)
: SET &TITLE# = GET_PROCESS_LINE(&HND#, 4)
: SET &IS_XML# = GET_PROCESS_LINE(&HND#, 5)
: SET &FILENAME# = GET_PROCESS_LINE(&HND#, 6)
: SET &ON_AGENT# = GET_PROCESS_LINE(&HND#, 7)
: SET &IN_DB# = GET_PROCESS_LINE(&HND#, 8)
: PRINT "Report type = &RH_TYPE#"
: PRINT "Start = &START_TIME#"
: PRINT "End = &END_TIME#"
: PRINT "Title = &TITLE#"
: PRINT "XML report? = &IS_XML#"
: PRINT "File name = &FILENAME#"
: PRINT "On the Agent? = &ON_AGENT#"
: PRINT "In the database? = &IN_DB#"
: IF &FILENAME# = ""
: PRINT "No external output file"
: ELSE
: IF &ON_AGENT# = 1
: PSET &FT_FILE# = &FILENAME#
: SET &AKT# = ACTIVATE_UC_OBJECT(JOBF.OUTPUTHANDLING,,,,,PASS_VALUES,)
: ENDIF
:ENDIF
: PRINT
:ENDPROCESS
The activating job's data is now specified as the source agent and login in the script of the FileTransfer object. The path and name of the external job output file are also set as the source file. For the destination, the name of the source file is used; the path is changed to "C:\output\".
:PUT_ATT FT_SRC_HOST = &AGENT_JOB#
:PUT_ATT FT_SRC_LOGIN = &LOGIN_JOB#
:PUT_ATT FT_SRC_FILE = &FT_FILE#
:SET &POS# = STR_FIND_REVERSE(&FT_FILE#, "\") + 1
:SET &FNAME# = STR_CUT(&FT_FILE#, &POS#)
:SET &DST_FILENAME# = STR_CAT("C:\output\",&FNAME#)
:PUT_ATT FT_DST_FILE = &DST_FILENAME#
See also:
Script Element | Description |
---|---|
Uses filter criteria to retrieve the report lines of executable objects and provides the result as an internal list (data sequence) for further processing. |
|
Definition of a loop for line-by-line processing of a data sequence such as the content of a sequential file or the text result of a command, for example. |
|
This is used to retrieve content from the current line of a data sequence. |
Script Elements - Data Sequences
Sample Collection
Setting an End Status Depending on the Report Content
Calling an MBean
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function
Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support |
Copyright © 2016 Automic Software GmbH |