Built-In Before/After Subroutines
There are a number of built-in before/after subroutines supplied with IBM® InfoSphere® DataStage®:
- DSSendMail. This routine is an interlude to the local send mail program.
- DSWaitForFile. This routine is called to suspend a job until a named job either exists, or does not exist.
- DSJobReport. This routine can be called at
the end of a job to write a job report to a file. The routine takes
an argument comprising two or three elements separated by semicolons
as follows:
- Report type. 0, 1, or 2 to specify report detail. Type 0 produces a text string containing start/end time, time elapsed and status of job. Type 1 is as a basic report but also contains information about individual stages and links within the job. Type 2 produces a text string containing a full XML report.
- Directory. Specifies the directory in which the report will be written.
- XSL stylesheet. Optionally specifies an XSL
style sheet to format an XML report.
If the job had an alias ID then the report is written to JobName_alias.txt or JobName_alias.xml, depending on report type. If the job does not have an alias, the report is written to JobName_YYYYMMDD_HHMMSS.txt or JobName_YYYYMMDD_HHMMSS.xml, depending on report type.
- ExecDOS. This routine executes a command via an MS-DOS shell. The command executed is specified in the routine's input argument.
- ExecDOSSilent. As ExecDOS, but does not write the command line to the job log.
- ExecTCL. This routine executes a command via an InfoSphere Information Server engine shell. The command executed is specified in the routine's input argument.
- ExecSH. This routine executes a command via a UNIX Korn shell.
- ExecSHSilent. As ExecSH, but does not write the command line to the job log.
These routines appear in the list of available built-in routines when you edit the Before-stage subroutine or After-stage subroutine fields in an Aggregator, Transformer, or supplemental stage, or the Before-job subroutine or After-job subroutine fields in the Job Properties dialog box.
You can also copy these routines and use the code as a basis for your own before/after subroutines.
If NLS is enabled, you should be aware of any mapping requirements when using ExecDOS and ExecSH (or ExecDOSSilent and ExecSHSilent) routines. If these routines use data in particular character sets, then it is your responsibility to map the data to or from Unicode.