How to execute .exe which runs on windows using talend.

Four Stars

How to execute .exe which runs on windows using talend.

Hi All,
I have a .exe which runs on windows, it reads column in a input file and gives transformed output.
Requirement: I have multiple Input files and each file has 3 columns, need to pass the 3rd column to .exe and .exe will return transformed output in form of columns in tab delimited say 5 columns. Need to append 1st and 2nd columns from input file to this output, ie, for each input file read by .exe, i need to get one output file with first 2 columns in input file + new columns generated by .exe.
 I tried calling the exe from batch script, the problem here is its taking very long time to read the files and give the ouptut.
sample data in input file: 
CYHD 1420071840 CYHD 010024Z AUTO 26017G22KT 3SM -SN FEW021 SCT026 BKN034 OVC041 M12/M14 A2963 RMK SLP072

batch script I used:
@echo off
set "TAB= "
set "SPACE= "
set z=0
set srcdir=C:\Users\502525968\Desktop\Source10\
set outdir=C:\Users\502525968\Desktop\Target10\
set filefilter=*.dat

rem rd /s /q %outdir%
rem mkdir %outdir%

for /r %srcdir% %%g in (%filefilter%) do (
set currfile=%%~nxg
echo processing %%~nxg
for /f "tokens=*" %%r in (%srcdir%/%%~nxg) do (
set /a z=0
call :processline %%r
)
set /a z=0
call :addcolumn
)
set "col1="
SET "col2="
SET "col3="

goto :eof

:processline

for /f "tokens=*" %%c IN ("%*") do for %%B in (%%c) do ( 
call :addcolumn %%B
)

exit /b

:addcolumn
set /a z+=1
if %z% == 1 (
if not "%col1%" == "" (
if not "%col2%" == "" (
MetarParser10.exe -m "%col3%" -l >> %outdir%/%currfile%
echo %col1%%TAB%%col2%>> %outdir%/%currfile%
)
)
set "col1="
set "col2="
set "col3="
)

if %z% == 1 (set "col1=%TAB%%1") else ( if %z% == 2 (set "col2=%1") else ( if %z% == 3 (set "col3=%1") else ( set "col3=%col3%%SPACE%%1" )))

exit /b

goto :eof

:eof


can we implement this in talend or is there any way to tune this.
Thanks,
Srinivas

Moderator

Re: How to execute .exe which runs on windows using talend.

Hi pitani13,

Have you tried to use talend component to achieve your goal? tFileinputXXX-->(Transformed processing)-->tFileOutputXXX.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: How to execute .exe which runs on windows using talend.

Hi, how can we call .exe which executes on windows in talend and can we pass parameter to the .exe in talend.

Thank you..

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog