In this article, I am going to show you, How to pass the context variables and parameters from main Job to child sub job using Talend open studio.
Talend provides us a very good way of inter-component communication using parameters. We can easily pass context parameters from one job to another. This feature is very handy as we can create all the parameters in the main job and as per requirement pass the values of parameters to the sub jobs.
First create a child job :
1. Define three context variables as below and do not provide any default values.
2. Drag tJava component and print the values of the context variables defined in the Step 1.
tJava component properties
3. Execute the child Job.
As we have not provided any values to context variables in child job, It is not displaying any values in the output.
Now, its time to create the Main job and pass the values to the subjob.
4. Create a Main job like below.
Use tFileInputDelimited component read the delimited Input file and Drag the child job to the Job designer.
Input File:
EMP_ID;EMP_NAME;EMP_SALARY
101;Mark THomas;20,000
102;William Crow;53,000
103;Ramanujan K.;89,000
104;Stacy Wind;24,000
5. Open the settings of the child subjob and pass the values of the context variables defined in child job as below. Take the values of the fields from row2 link and pass it to context variables.
6. Main job is complete. Its time to execute it.
Now, you can see that child job is running iteratively for every record in the Input file and value is being displayed in the run console.
Similarly, you can pass the value from the link to another sub job using the context parameters.
You may also like to read..
Images not visible.
ReplyDeleteImages are not visible
ReplyDeletehello please can you update new sceen shot
ReplyDeleteThanks for the nice blog. It was very useful for me. I'm happy I found this blog. Thank you for sharing with us,I too always learn something new from your post. Fcs.Assam.gov.in
ReplyDeleteNo matter how many times I read this, I will never get bored of it.
ReplyDeletehttps://www.resumeyard.com