× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Every time you make another call you get a new thread which is destroyed
after it returns. You either have to save the values in say a user space but
messy.

A better solution might be to make the RPG call a stored procedures. SQL
maintains context between calls.

On Thu, Sep 22, 2011 at 10:37 AM, Tiago Cavaleiro <
Tiago.Cavaleiro@xxxxxxxxxxx> wrote:

Hi all,

Can anyone give me some tips regarding a problem I'm having?

So we're doing some project using Websphere to integrate with iSeries (we
achieved to access DB2 on iSeries, calling RPG programs using ProgramCall,
etc..). Until here everything OK, our problem is related with the following:

Imagine we're on iSeries and call a RPG program that does the following:

· Fulfill Data Structure (1)

· Call X.PGM with DS as parameter (2)

o Eval return parameter, if OK then: (3)

§ Change a field value on the input DS (4)

§ Call X.PGM with DS (5)

· Print return parameter (the return is OK) (6)


Hope that my bullets explanation were representative. :)
Ok so when we emulate this on the Java (doing the same steps the program
called from iSeries does), we're getting some error on step 6 (saying that
the program didn't find any reference...) - we think this is because the two
ProgramCall calls occurs in different contexts (or the second call doesn't
have the first call context).

On our code we're reusing the ProgramCall, we've just change the parameter
value using ProgramParameter.setInputData(). Is it possible to have the same
behavior on Java that we have on RPG program?


Sample code below:

AS400 sys = session.getSystem();
String pgmPath = QSYSObjectPathName.toPath("XPTOLIB",
"PROGRA", "PGM");

Object[] inData = ...;

ProgramParameter[] parameters = new ProgramParameter[] {
new
ProgramParameter(DATATYPES[0].toBytes(inData[0]), ..),
new
ProgramParameter(DATATYPES[1].toBytes(inData[1]), ..),
new
ProgramParameter(DATATYPES[2].toBytes(inData[2]), ..),
new
ProgramParameter(DATATYPES[3].toBytes(inData[3]), ..),
new
ProgramParameter(DATATYPES[4].toBytes(inData[4]), ..),
new
ProgramParameter(DATATYPES[4].toBytes(inData[4]), ..),
new
ProgramParameter(DATATYPES[6].toBytes(inData[6]), ..),
new
ProgramParameter(DATATYPES[7].toBytes(inData[7]), ..),
new
ProgramParameter(DATATYPES[8].toBytes(inData[8]), ..),
new
ProgramParameter(DATATYPES[9].toBytes(inData[9]), .),
new
ProgramParameter(DATATYPES[10].toBytes(inData[10]), ..),
new
ProgramParameter(DATATYPES[11].toBytes(inData[11]), .),
new
ProgramParameter(DATATYPES[12].toBytes(inData[12]), ..)
};
ProgramCall pgm = new ProgramCall(sys);

boolean success = false;
try {
// first call
success = pgm.run(pgmPath, parameters);
if (!success) {
throw new ConnectionException("We've received
success=false.");
}
System.out.println("job number: " +
pgm.getServerJob().getNumber());
}
catch (Exception e) {
...// do logging etc..
}

outData = ...// process array
parameters[...].getOutputData();


printResponse(outData);

String status = outData[6].toString();
if ("R".equals(status)) {

try {
parameters[5].setInputData(dsaim2);
} catch (PropertyVetoException e1) {
e1.printStackTrace(); // test purpose only
}

success = false;
try {
// second call
success = pgm.run(h56h1r, parameters);
if (!success) {
throw new ConnectionException("We've
received success=false.");
}
System.out.println("job number: " +
pgm.getServerJob().getNumber());
}
catch (Exception e) {
...// do logging etc..
}

outData = ...// process array
parameters[...].getOutputData();

// were we see on the console the problem
printResponse(outData);





Thanks in advance!

Tiago Cavaleiro


________________________________

Disclaimer/Implicações legais
http://www.exictos.com/disclaimer/e-mail.htm

________________________________

Antes de imprimir este "e-mail" pense no meio ambiente.
Por favor considere as suas responsabilidades ambientais! Antes de imprimir
o Email, pergunte a si mesmo se realmente precisa duma cópia em papel.
--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing
list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.