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



> From: RCRafols@xxxxxxxxxxxx
> 
> Still another JTOpen error.  When I run PgmCall, I get an
> java.lang.ArrayIndexOutOfBoundsException error.

This works:

        // Create a call with two 5-byte parameters
        AS400 host = new AS400();
        ProgramCall pc = new ProgramCall(host);
        ProgramParameter[] plist = new ProgramParameter[] {
                new ProgramParameter(5),
                new ProgramParameter(5)
        };
        pc.setProgram("/QSYS.LIB/SANDBOX.LIB/SB0002.PGM");
        pc.setParameterList(plist);
                
        // Set each parameter with EBCDIC data by converting Strings
        AS400Text cvtAlpha5 = new AS400Text(5);
        plist[0].setInputData(cvtAlpha5.toBytes("00001"));              
        plist[1].setInputData(cvtAlpha5.toBytes("XXXXX"));              
        pc.run();
                
        // Get the result and print it
        String result = (String)
cvtAlpha5.toObject(plist[1].getOutputData());
        System.out.println(result);
        host.disconnectAllServices();


This will create a program call with a parameter list containing two
parameters, each length 5.  This is the length in bytes.  The length
required depends on the data type; for alpha data it is one byte per
character.

The cvtAlpha5 converter can convert from a Java String to an array of
EBCDIC bytes and vice versa.  You use it to put data into an alpha
parameter and to get data out of an alpha parameter.  Since both
parameters are the same length, I was able to use the same converter.

The RPG program SB0002 moves the data from parameter one into parameter
2.  After the call, the Java program prints the results of the second
parameter.

d xidata          s              5                              
                                                                
C     *entry        plist                                       
C                   parm                    xidata            5 
C                   parm                    xidata2           5 
C                                                               
C                   eval      xidata2 = xidata                  
C                   eval      *inlr = *on                       
C                   return                                      

The output is "00001".

Joe


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.