Hi everybody!

I have problem with calling rpg servicePGM subProc that has *NOPASS parm 
in prototype. The problem is in third parameter. If called from other RPG 
program subProcedures %PARMS BIF works as expected. But if I pass 
parameters from Java program, %PARMS bif returns 2 althought  I passed 3 
parameters.
        P getACCOUNT      B                   EXPORT
     D getACCOUNT      PI
     D  accountTXT                   20A
     D  accountBAL                   15S 0
     D  accountBALTX                 17A        OPTIONS(*NOPASS)
      /free
       getAltAccADD(accInfoDS);
       If ERROR=0;
          accountTXT=%CHAR(cnum)+%triml(%editw(acod:'0    '));
          accountBAL=BAL*(-1);
                 //** PART WITH PROBLEM **
          IF %parms=3;
             accountBALTX = getAsCroValStr(accountBAL);
          ENDIF;
       Else;
          accountTXT='No account...';
          accountBAL=0;
       ENDIF;
       return;
      /end-free
     P                 E 


This is part of JAVA code:
private boolean runSubprocedure(String subProcName,String accType)
                throws
                        PropertyVetoException,
                        AS400SecurityException,
                        ErrorCompletingRequestException,
                        IOException,
                        InterruptedException,
                        ObjectDoesNotExistException,
                        DOMException {

                /* prepare bytes for arrays*/
                byte[] bytes1 = text1.toBytes("                    ");
                byte[] bytes2 = zdec2.toBytes(0);
                byte[] bytes3 = text3.toBytes("00000000000000000");

                /* Prepare Program parameters */
                pp2[0] = new ProgramParameter(bytes1);
 pp2[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE);
                pp2[0].setOutputDataLength(20);
                pp2[1] = new ProgramParameter(bytes2);
 pp2[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE);
                pp2[1].setOutputDataLength(15);
                pp2[2] = new ProgramParameter(bytes3);
 pp2[2].setParameterType(ProgramParameter.PASS_BY_REFERENCE);
                pp2[2].setOutputDataLength(17);
                /* Prepare spc - serviceProgramCall - to call subproc*/
                spc.setProcedureName(subProcName);
 spc.setReturnValueFormat(ServiceProgramCall.NO_RETURN_VALUE);
                spc.setParameterList(pp2);

                /* Creates XML node ACCOUNT with info about account 
attributes */
                if (spc.run()) {
                        Element acc = doc.createElement("ACCOUNT");
                        Element accId = doc.createElement("AccId");
                        accId.appendChild(
                                doc.createTextNode(((String) 
text1.toObject(pp2[0].getOutputData())).trim()));
                        Element accDe = doc.createElement("AccDesc");
                        accDe.appendChild(doc.createTextNode(accType));
                        Element accAm = doc.createElement("AccAmount");
                        accAm.appendChild(
                                doc.createTextNode((String) 
text3.toObject(pp2[2].getOutputData())));
                        totalAmmount += 
zdec2.toDouble(pp2[1].getOutputData());
                        acc.appendChild(accId);
                        acc.appendChild(accDe);
                        acc.appendChild(accAm);
                        accountsNode.appendChild(acc);
                        return true;
                } else {
                        addErrors(spc.getMessageList());
                        return false;
                }
        }

Best regards,
Igor Bešlić, dipl. ing. rač. 
VOLKSBANK d.d.
OJ Informatika
Varšavska 9, 10000 Zagreb
tel: +385 1 4801 895

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 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.