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



 
Can a call to a service program return info passed in the parms like you
can with ProgramCall?  I can get it to work just fine with ProgramCall,
but ServiceProgramCall is proving to be a little more difficult.  I have
only seen examples that try to do a .getOutputData() with ProgramCall.
I keep getting null being sent back.

Anybody know for sure?

Aaron Bartell


     P CallRPG_var     B                   Export
     D CallRPG_var     PI
     D  pInput                       30A   Const
     D  pOutput                      30A
      /Free

       pOutput = 'It is working yahoo!';
       Return;

      /End-Free
     P CallRPG_var     E 



public class CallRPG_var {

    public static void main(String[] parameters) {
        try {
            AS400 as400 = new AS400("172.11.11.11", "JJJ", "JKKK");
            

            AS400Text text1 = new AS400Text(50, as400);
            byte[] inData = text1.toBytes("jjjeeeeuuuunnnkkkkk!!!!!");
            byte[] outData = text1.toBytes(" ");

            ProgramParameter[] parmlist = new ProgramParameter[2];
            parmlist[0] = new ProgramParameter(inData);
            parmlist[1] = new ProgramParameter(outData);
 
parmlist[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE);
 
parmlist[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE);

            ServiceProgramCall srvPgm = new ServiceProgramCall(as400);
 
srvPgm.setProgram("/QSYS.LIB/ALBARTELL.LIB/CALLRPGSV.SRVPGM");
            srvPgm.setProcedureName("CALLRPG_VAR");
 
srvPgm.setReturnValueFormat(ServiceProgramCall.NO_RETURN_VALUE);
            srvPgm.setParameterList(parmlist);
            if (srvPgm.run() != true) {
                AS400Message[] msgList = srvPgm.getMessageList();
                System.out.println("The program did not run.  AS/400
messages : ");         
                for (int i = 0; i < msgList.length; i++) {
                    System.out.println(msgList[i].getText());
                }
            }

            System.out.println(parmlist[1].getOutputData());
        } catch (Exception e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
        }
    }
}



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.