:STOP
Script Statement: It cancels the processing of a script
Syntax
:STOP [Stop Mode]
Syntax |
Description/Format |
---|---|
Stop Mode |
You can pass on the following parameters to the :STOP statement in the form of Stop Modes: NOMSG, Message Number[, Message Text] MSG, Error Number, Error Text |
Comments
:STOP cancels the activation of an object. Therefore, this script element cannot be used in the Post Process tab. Automic recommends using the statement :MODIFY_STATE instead.
Stop Mode NOMSG
The :STOP statement with Stop Mode NOMSG can be used in objects which do not require an agent for processing. It is therefore possible to work only with script statements (to set variables, for example).
You can also create a message by using the parameter Stop Mode NOMSG. The Message Number is syntactically necessary but is not evaluated. The Message Text is stored in the statistics and sent as part of the confirmation when a call is made via the CallAPI. As a result thereof, the run number (RunID) of a started task can be returned to the CallAPI.
Because Stop Mode NOMSG ends task activations without errors, these tasks will not appear as canceled tasks in the statistics.
Stop Mode MSG
Stop Mode MSG can be used to cancel the activation of an object with an error message. You can define an Error Number and an Error Text. This is especially important for objects that start via the AE CallAPI. The returned information is the only information about the script execution. Error numbers 50 to 59 are reserved for users.
Return code 4 is used for the error number 50 and return code 8 for the numbers ranging from 51 to 59.
Note that you can only use the error numbers 50 - 59. Using other error numbers will cause the script to abort with an error message that informs you that the specified error number is not valid.
Because Stop Mode MSG cancels task activations with an error, these tasks are listed in the statistics as canceled tasks .
If you use the :STOP statement without any parameters or with Stop Mode MSG, script processing will abort with an error and a database rollback takes place. All transactions that were not specifically executed will be rolled back. If you have used script variables, it can happen that the Variable objects that are located at the beginning of the script already include their new values but those located at the script end won't.
The system writes transactions to the AE database (commit) when script processing is interrupted. This occurs:
- automatically in intervals of 5 second,
- because of script statements such as ACTIVATE_UC_OBJECT, GET_FILESYSTEM, :READ, PREP_PROCESS, PREP_PROCESS_FILE,
- when you use the script statement :WAIT.
You can use the script statement :WAIT 0 in order to force an interruption in script processing and also, to force a database commit.
Examples
The following example returns an error message that informs you whether a job was correctly activated or not.
:SET &ACTNR# = ACTIVATE_UC_OBJECT(JOBS, MM)
:IF &ACTNR# = "0"
: STOP MSG,
50, "Error in activating the job
MM."
:ELSE
: PRINT "The job MM was activated with the activation
number &ACTNR#."
:ENDIF
See also:
Script element | Description |
---|---|
Terminates the processing of a script and sends a return code. |
|
This is used to stop processing of the script for a specified period of time. Meanwhile, other tasks are completed. |
Script Elements - Activate Objects
Script Elements - Error Handling and Messages
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function