Information icon IBM InfoSphere DataStage and InfoSphere QualityStage, Version 8.5
space Feedback

Subroutine Statement

Marks the start of an external subroutine. Not available in expressions.

Syntax

Subroutine [name] ( argument1[ ,argument2 ]... )

name is a name that identifies the subroutine in any way that is helpful to make the program easy to read.

argument1 and argument2 are the names of variables used to pass arguments between the calling program and the subroutine. A subroutine used in a transform must have one or more arguments; a before subroutine or an after subroutine must contain two arguments.

Remarks

The Subroutine statement must be the first noncomment line in the subroutine. Each subroutine can contain only one Subroutine statement. The Call statement that calls the subroutine must specify the same number of arguments as the Subroutine statement.

Example

This example shows how a before/after routine must be declared as a subroutine. The Designer client will automatically ensure this when you create a new before/after routine.

Subroutine MyRoutine(InputArg, ErrorCode)
* Users can enter any string value they like when using
* MyRoutine from within the job Designer. It will appear
* in the variable named InputArg.
* The routine controls the progress of the job by setting
* the value of ErrorCode, which is an Output argument.
* Anything non-zero will stop the stage or job.
ErrorCode = 0             ;* default reply
* Do some processing...
... 
Return

PDFThis topic is also in the IBM InfoSphere DataStage Server Job Developer's Guide.

Update timestamp Last updated: 2010-09-30