I have tried many times to pass a multi dimensional array from rpg(AS400) to java,but it didn't works, Is there any possibility to pass multi dimensional array fromRPGLE (AS400) to java can some one help.
Asked
Active
Viewed 420 times
-4
-
2[Why is “Can someone help me?” not an actual question?](https://meta.stackoverflow.com/q/284236/2970947) – Elliott Frisch Oct 20 '17 at 15:37
-
[I downvoted because "didn't work" doesn't work as a problem description](http://idownvotedbecau.se/itsnotworking/). Please include a [mcve] showing what code you were trying along with a **specific** problem description. – EJoshuaS - Stand with Ukraine Oct 20 '17 at 16:31
-
I know how to pass a single dimesional array maybe that will help. – danny117 Nov 03 '17 at 14:10
-
This is really cutting edge stuff for the RPG programmer. There aren't a lot of examples on how to do this in the wild. – danny117 Mar 05 '18 at 17:09
1 Answers
1
The problem is you are trying to pass something which is a non primitive. In java you would just pass the class to the method or procedure. Where RPG is pretty much limited to passing primitives.
So possibly you could create a constructor for the multi dimensional array that takes an array of string and build the multi dimensional array in java.
Here's how to pass event args which is defined as string[]. I'm only passing one but you could pass more.
h DftActgrp(*NO) ActGrp('Java')
d xls2csv pr extproc(*JAVA
d :'XLSX2CSV.XLSX2CSV':'main')
d static
d args O CLASS(*JAVA:'java.lang.String')
d dim(1)
d Const
d inputargs s O CLASS(*JAVA:'java.lang.String')
d dim(1)
d crtString PR o EXTPROC(*JAVA:
d 'java.lang.String':
d *CONSTRUCTOR)
d RPGBytes 250A Const Varying
c *entry plist
c parm path 200
c/free
inputargs(1) = crtstring(%trim(path));
xls2csv(inputargs);
*inlr = *on;
return;
Or you can return a multi dimensional array from from a java class and pass that class to the java program. Either way your going to have to make a java class that has a constructor for creating a multi dimensional array class.