A script-based export object will have a Host Script defined. During the export process, the host script is executed and the results returned. During the drag-and-drop creation of an export object from a single table or view, a script can be generated by selecting one of the 'Script based' export options. This script can then be edited to more fully meet any requirements.
Script-based exports on Windows support both DOS Batch and PowerShell scripts.
There are several conventions that must be followed if these host scripts are to be used by the RED Scheduler.
- The first line of data in standard out must contain the resultant status of the script. Valid values are '1' to indicate success, '-1' to indicate a Warning condition occurred but the result is considered a success, '-2' to indicate a handled Error occurred and subsequent dependent tasks should be held, -3 to indicate an unhandled Failure and that subsequent dependent tasks should be held.
- The second line of data in standard out must contain a resultant message of no more than 256 characters.
- Any subsequent lines in standard out are considered informational and are recorded in the audit trail. The normal practice is to place a minimum of information in the audit trail. All bulk information should be output to standard error.
- Any data output to standard error is written in the error/detail log. Both the audit log and detail log can be viewed from the WhereScape RED tool under the Scheduler window.
- When performing Script based exports, it is easy to use the Rebuild button beside Script Name field to rebuild the scripts.