Home / Talend

Executing non-Talend objects and operating system commands

Rating: 4.0Blog-star
Views: 3052
by Ravindra Savaram
Last modified: January 29th 2021

Often, when running a schedule, it is necessary to execute a mixture of TALEND AND NON-TALEND OBJECTS, such as database scripts, batch files, or shell scripts. This exercise shows how this is easily achieved using Talend.

MindMajix Talend Training course is designed to make you an expert in developing ETL solutions using Talend platform. Start Learning!


Note that this exercise is for Windows only.

Getting ready

Open the job jo_cook_ch11_0080_systemCalls.

How to achieve it…

1. Drag a tSystem component onto the canvas.
2. Set the Command to the following:

"cmd /c"+context.cookbookData+"/batchFiles/jo_cook_ch11_0080_batchFile .bat"

3. Add a tJava component, and add the following code:

System.out.println("Return code"+ ((Integer)globalMap.get("tSystem_1_EXIT_VALUE")));

4. Link the two components using and onSubjobOk trigger and then run the job.

How it works…

The tSystem component sends a call to the operating system to execute a native command. In our case, the command is to execute a .bat file that we have coded.

When the .bat file completes, the return code can be accessed using the EXIT_VALUE global map variable.

There’s more…

Although this exercise is for Windows, the same principle applies for Linux. The only difference being that cmd /c is not required on the command line.

Explore TALEND Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!

About Author

NameRavindra Savaram
Author Bio


Ravindra Savaram is a Content Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.