tAS400Row Component- Getting Output parameters from RPG program call

Highlighted
One Star

tAS400Row Component- Getting Output parameters from RPG program call

Has anyone been able to successfully get an output parameter passed back into Talend from an RPG program on an AS400? Currently, I'm using the tAS400Row component to execute an RPG program, and I'm able to pass input parameters successfully, but I'm not sure how to get an output value passed back into Talend.
Example: Below is an example of the program call I'm currently making using the tAS400Row component:
CALL LAURA.CLAA2 ('anyone@example.com','Some text for email subject line')
This calls a program on the AS400 which sends an email to "anyone@example.com" based on the input parameter, and the subject line of the email would be "Some text for email subject line" - based on the second parameter.
I'd like to be able to call another program which takes in two parameters, and returns a third or even a fourth value as output parameters. How can this be accomplished?
Employee

Re: tAS400Row Component- Getting Output parameters from RPG program call

You can call an RPG for AS400 platform directly using a custom routines and calling that code into a tSystem.
An RPG method/call can be invoke via the jt400 library(jar file).
You can probably find couple of sample about this method call on this forum or find it on the IBM community.
Your custom routine would be like this one (rely to the jt400.jar) :
public static void callRPG(String email, String text) {
boolean pgmrun;

AS400 as400 = new AS400();
System.out.println("AS400 obj created..." );

ProgramCall pgm = new ProgramCall(as400);
try{
pgm.setProgram(QSYSObjectPathName.toPath("LAURA", "CLAA2 ","PGM"),null);
pgmrun = pgm.run();
System.out.println("pgm.run() = " + pgmrun);
if (pgmrun != true) {
AS400Message[] msgList = pgm.getMessageList();
for (int i=0; i<msgList.length; i++)
System.out.println(msgList.getText());
}

} catch (Exception e) {
System.out.println("error=" + e);
}

System.out.println("Call completed." );
as400.disconnectService(AS400.COMMAND);
}
Best regards;

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 2

Part 2 of a series on Context Variables

Blog

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