Process Page

As a developer and object designer you add functional logic to your objects on their Process pages using the Automation Engine scripting language. All executable objects have at least a Process page. Depending on its type, the object may have more than one Process page on which you can write scripts.

Process pages can contain up to 32767 lines. However, if the script generates more than 1000 JCL lines, its generation is canceled. If your script generates more JCL lines, you can change this limit using MAX_JCL_LINES in the :PUT_ATT script statement.

Processing Order

The scripts in the Process pages are processed in the following order:

  1. Pre-Process page and Process page
  2. Post Process page

Pre-Process Page

Available for Job objects (JOBS) only. On the Pre-Process page you enter statements that prepare the Job for execution. A typical example is the :PUT_ATT statement, which sets attributes such as the Agent. The script on this page is processed at the same time as the script on the Process page.

Since pre-process statements are executed in the Job header, you can add statements that are executed before the Job Messenger gets involved in the execution.

Tip: Use the :INC_SCRIPT script statement to insert the content of this page on any other process page.

Process Page

Platform-specific information:

Enabling an Interpreter for Windows and UNIX

You can enter a script for use with an external interpreter. To enable the interpretation of that script, use :BEGIN_EXT_INTERPRETERS... :END_EXT_INTERPRETERS.

The binary files of the Storage can be attached and transferred to the Windows Agent using the :ATTACH_RES script function.

To be able to use these functions, configure the UC_EXT_INTERPRETERS_* and :REGISTER_VARIABLE variables.

Windows BAT and PowerShell Examples

  • This Windows BAT script puts the output of the C:\Temp directory into a file and checks whether the command ran successfully. If the command does not complete successfully, the Job ends with the return code from the dir command:

    dir C:\temp /S >> C:\temp\test.txt@

    set retcode=%errorlevel%

    @if NOT %ERRORLEVEL% == 0 goto :retcode

  • This Windows PowerShell script gets content of the C:\Temp directory and puts the output into a file. The error code from Powershell is then checked. If it is not 0, the job aborts with $LastExitCode. This exit code is the equivalent to %ERRORLEVEL% in the CMD.EXE/.BAT script.

    Get-ChildItem C:\Temp > C:\Temp\test.txt

    if( $LastExitCode -ne 0 )

    { __uc_return $LastExitCode }

The __uc_return function can be used for ending of PowerShell jobs. This function works only if the Windows job type is set to Interpreter. The function does not work with the new functions :BEGIN_EXT_INTERPRETERS... :END_EXT_INTERPRETERS.

Post Process Page

Available for Job objects (JOBS) only. Scripts on the Post Process page are processed after the Job has ended normally or after a partial completion. A Job has partially completed if, for example, it is canceled. With post-processing commands you influence how a Job ends.

The following rules apply:

  • Post process scripts cannot include JCL lines
  • Post process commands are NOT executed in cases of ENDED_LOST task statuses
  • You cannot use the following script statements on the Post Process page:
    • :PUT_ATT

      Setting attributes for Job generation is irrelevant

    • :EXIT

      Canceling script processing with return code > 0 is not allowed

    • :STOP

      Interrupting script processing is not allowed

Tips: 

  • Use the :RSET script statement to transfer script variables between the Process and Post Process pages. This script statement returns the value that has been assigned to the script variable in the Process page.
  • Use the :MODIFY_STATE script statement to change the final ending of a Job. This script statement lets you modify the Job return code and status supplied by the Job Messenger in the trailer.
  • Use the PREP_PROCESS_REPORT script statement on the Post Process page to analyze reports. You can then define an ENDED_NOT_OK status for a Job even if the Job has technically ended normally.

See also: