Automation Engine Script Guide > Ordered by Function > Data Sequences > PREP_PROCESS_REPORTLIST

PREP_PROCESS_REPORTLIST

Script function: Retrieves the list of registered output of jobs that have already run and makes the result available as an internal list (data sequence) for further processing.

Syntax

PREP_PROCESS_REPORTLIST([RunID], [Filter])

Syntax

Description/Format

RunID

RunID of a job that has already run and whose registered output (internal report plus job output files) should be retrieved.

Format: AE name, script literal or script variable

The script element refers to its own object if this parameter is not specified. This script element should only be used in the Post Process tab as otherwise it is not possible to retrieve all job output data.

Filters

Filters for the name of a job output file.

The wildcard characters * (placeholder for any number of characters) and ? (placeholder for exactly one character) can be used several times.

Format: script variable or script literal

Return code

Reference to the data sequence of the job output list.

Comments 

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 code 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 variable 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:
"0" - No
"1" - Yes

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

Job output is on the agent?

Possible values:
"0" - No
"1" - Yes

8

Is the job output stored in the AE databaseA database is an organized collection of data including relevant data structures.?

Possible values:
"0" - No
"1" - Yes

 

Example 1

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

Example 2

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 transfer starts for each external output file and transfers this file to a different computer. The agent, job login 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

PREP_PROCESS_REPORT

Uses filter criteria to retrieve the report lines of executable objects and provides the result as an internal list (data sequence) for further processing.

:PROCESS... :TERM_PROCESS... :ENDPROCESS

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.

GET_PROCESS_LINE

This is used to retrieve content from the current line of a data sequence.