× 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.



Thanks guys.

We probably will use the approach to call a single RPG program (customized) that will do the two calls - this works for sure :). We we're trying to avoid this because this implies installation of that custom RPG on the client environment.


The approach to use a SP isn't possible because we need to pass binary data with 9999 byte length.

Also I've tested the approach of using setThreadSafe(false) on ProgramCall but the problem remains.
We didn't tested the QCMDEXC because it is limited to 6000 characters (we need to pass binary data).


But possibly the main problem here is that we are trying to emulate a RPG program that per si calls two other programs.
There is something between the two calls that on Java we lost and in RPG it simply works.


Thanks.
Tiago Cavaleiro.


From: Tiago Cavaleiro
Sent: quinta-feira, 22 de Setembro de 2011 17:37
To: 'java400-l@xxxxxxxxxxxx'
Subject: Calling RPG program (more than 1 time) and maintening the context between the two calls

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.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.