Passing a value from the parent Job to the child Job is a common real world requirement. This article serves as a best practice guide.
This procedure was written with:
The following environment was used to create the suggested procedure.
In this example reads data from a text file in a parent Job and passes fields from each row to the child Job. The data is used in the child Job.
Create a Job called ParentJob. The Job design is as follows. (You will configure tRunJob in the Third Step).
Create a child Job. Call it ChildJob.
Drag and drop a tJava from the Palette to the Job editor. On the tJava component, type in the following Java code:
Open the Contexts viewer, define two context variables: name and scope, as follows:
Return back to the parent Job, configure the tRunJob component as seen below:
Execute the Job ParentJob. The following results will print to the console:
The most important technical point is using the context variable, defined in the child Job, to pass a value from parent Job to child Job.