Help with AS/400 array

235 pts.
iSeries RPG programming
iseries v5r4
Java classes
hi evryone,

i'm a beginner with Java and i try this:


AS400Array txtarr =new AS400Array(AS400PackedDecimal(55,0),100);

parmList[0] = new ProgramParameter(txtarr.toBytes(new BigDecimal(0)),55);

ProgramCall pgm =

new ProgramCall(sistem,"/qsys.lib/xxx.lib/....pgm",parmList);

in my RPG program i have this:

D numcli       s          55 0  dim(100)

C           parm       numclie  

i need get this array from rpg, how can i make this happening, i know that i need a ( for )instruction in java, to cacth the value from this array.

but anyone give me a example code for this kind of instructions?

thanks in advanced.


Software/Hardware used:
V5R4 OS400

Answer Wiki

Thanks. We'll let you know when a new response is added.

This is a test sample where a service program procedure expects a DS DIM() parameter

RPG prototype :


d modDs ds template qualified
d fieldA 10a
d fieldB 10a

d setDs pr
d myDs likeds(modDs) dim(100)

The call from java :

ServiceProgramCall service = new ServiceProgramCall(as400);

// define the parameter
AS400DataType[] types = new AS400DataType[]{
new AS400Text(10),
new AS400Text(10),

AS400Structure struc = new AS400Structure(types);
AS400Array ar = new AS400Array(struc, 100);

Object[] o = new Object[100];
for (int i = 0; i < o.length; i++) {
o[i] = new Object[]{“A”, “B”};

byte[] b = ar.toBytes(o);
ProgramParameter p1 = new ProgramParameter();

try {
service.setProgram(QSYSObjectPathName.toPath(“MYLIB”, “MYSRVPGM”, “SRVPGM”));


service.setParameterList(new ProgramParameter[] {p1});

boolean ran =;

Discuss This Question: 4  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TomLiotta
    I'm not clear exactly what you're looking for. Please review the comments for How to prevent parameter 2 from getting into parm 1 in iSeries. There is an example program there that uses FOR to loop through a parm that carries an array. If that isn't quite what you're looking for, please describe differences. Tom
    125,585 pointsBadges:
  • BUG68
    what i need is the code for java program, when i need use AS400Array class how i make, and how i define this kind of instructions for AS400Array(AS400PackedDecimal(55,0),. Is this the right way for what i have imn my RPG program or not? Before i put this question i travel across WEB, principally in IBM but i don't any friendly code for my doubt. thanks again for everybody
    235 pointsBadges:
  • TomLiotta
    I might be more of a novice than you are for this question. Nevertheless, I'd look first at the toDouble() method of the AS400PackedDecimal() class. And with 55-digit numbers going to BigDecimals, you might instead need to use the toObject() method of AS400PackedDecimal. I'm pretty sure it'll be a while before I find example code that helps you. But maybe you can make progress just by having a suggestion. Tom
    125,585 pointsBadges:
  • BUG68
    HI, again, i think i discovered a first step: String parme1 =""; AS400PackedDecimal x1=new AS400PackedDecimal(9,0); AS400Array nume1 =new AS400Array(x1,50); AS400Text y1=new AS400Text(40); AS400Array txt1 =new AS400Array(y1,50); parmList[0] = new ProgramParameter(x1.toBytes(0),50); parmList[1] = new ProgramParameter(y1.toBytes(parme1),50); i want now see de output, what i need for GET instructions? thanks Tom, for your first help.
    235 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: