Logo DWBI.org Login / Sign Up
Sign Up
Have Login?
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
New Account?
Go to Login
By continuing you indicate that you agree to Terms of Service and Privacy Policy of the site.

Calling C executable from Java Transform

Updated on Sep 30, 2020

We are going to do is, to call C++ Executable from Informatica, using Passive Java Transform and capture the output of the C++ using Java and write the result to corresponding target column.

There was a requirement to call a C++ executable binary from Informatica. The C++ program basically takes one input file name in the command line and calculates "value at risk" (VAR) values based on all the financial transaction records present in the given input file and outputs the final VAR value. This value along with other source data needs to be populated in the Target.

Here is the test environment setup.

  1. We have a source flat-file having 4 input columns out of which one column TCN bears the partial-filename which needs to be passed as argument to C++ executable.
  2. The C++ executable recieves the filename as arguments calculates the VAR for the corresponding file and outputs the VAR value.
  3. We capture the VAR value using the same Informatica Java Transform that calls the C++ executable and populate the corresponding target field.

Sample Source and Target Record.




Please find the Informatica Mapping and the Java Transformation properties below. Note the Java Transformation used is a Passive one.

Mapping to call C exec from Java
Mapping to call C exec from Java
Java Ports Tab
Java Ports Tab
Java Code- Import Packages
Java Code- Import Packages
Java Code to call C++ executable
Java Code to call C++ executable

Find the corresponding Java Code.

String CPP_Exec = "C:\\Users\\Saurav\\My Documents\\calc_var.exe";
String ip_fname = InputTCN;
String filename = CPP_Exec + " " + ip_fname;
String op_VAR;
Process p = Runtime.getRuntime().exec(filename);
BufferedReader input = new BufferedReader (new InputStreamReader(p.getInputStream()));
while((op_VAR = input.readLine()) != null)
	VAR= Integer.parseInt(op_VAR.trim());
catch(Exception e) 

Finally we are done. Calling a C++ executable from Informatica using Java Transformation.