Automation Engine Script Guide > Ordered by Function > Read or Modify Objects > :MODIFY_STATE

:MODIFY_STATE

Script Statement: Modifies the return code or status text of a job when it has finished

Syntax

:MODIFY_STATE Property=Value

Syntax

Description/Format

Property

Property for the job's end
Format: script variable or AE name

Allowed values: "RETCODE", "STATUS_TEXT"
"RETCODE" = Job's return code
"STATUS_TEXT" = Job's status text 

Value 

New assignment for the job's property
Format: script literal, script variable, AE name, number without quotations or script function

For "RETCODE": Numerical value.
For "STATUS_TEXT": Alphanumeric string, maximum 32 characters. 

Description

:MODIFY_STATE can be used for the subsequent modification of a job's return code or the status text. Hence, this script statement is only allowed in the Post Process tab.

You can use this script statement to subsequently assign the status ENDED_NOT_OK to a job which ended normally from the technical point of view, for example. This might be necessary for a job in which an error occurred that was not detected until its report was analyzed.
See: PREP_PROCESS_REPORT.

Modifying the return code influences the status of a job. The status results from the maximum return code that has been defined for a normal job end (Runtime tab). If the modified return code is higher than the specified maximal return code, the status is set to ENDED_NOT_OK. If the modified return code is lower than or equal to the specified maximum return code, the job ends on the status ENDED_OK.

You can also specify an individual status text for the job's end. It then replaces the text which the Job Messenger put out in the trailer.

Changes are logged in the Post processing tab of the job report. The modified values are also displayed in the Detail Window of the job.

Example

In the following example, a job running under Windows should copy a non-existing file. The job would end normally with return  code "0". The result that the file to be copied was not found could only be seen from the job report.

The job report is now analyzed in the post process of the job. The absence of the file that should have been copied is recognized and the return code is changed. As a result, the job is canceled.

:SET &HND# = PREP_PROCESS_REPORT(,,,"*cannot find the file*")
:
PROCESS &HND#
:  
MODIFY_STATE STATUS_TEXT="Files not found"
:  
MODIFY_STATE RETCODE=50
:
ENDPROCESS

 

See also:

Script element Description

:EXIT

This terminates the processing of a script and sends a return code

GET_UC_OBJECT_STATUS

Returns the status of an activated object

Script Elements - Read or Modify Objects

Sample Collection
Setting End Status depending on Report Content

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function