| 
 | 
I have a Java class calling a service program with several parameters.  I
keep getting this error on one of the parameters:
 
Message ID . . . . . . :   CPF3C1D       Severity . . . . . . . :   30
Message type . . . . . :   Escape
Date sent  . . . . . . :   04/12/17      Time sent  . . . . . . :   10:10:58
 
Message . . . . :   Length specified in parameter 5 not valid.
Cause . . . . . :   The length of 14 for parameter 5 is not valid.  Values
for
  this parameter must be greater than 0 and less than 7.
Recovery  . . . :   Correct the length and call the API again.
 
 
It is defined as 
            AS400Text pMsgPgm = new AS400Text(10, system);
 
            
            AS400Text pFunction  = new AS400Text(1, system);
            
      AS400Text pUserId  = new AS400Text(10, system);
      
      AS400Text pErrorFld  = new AS400Text(10, system);
      
      AS400Text pErrorId  = new AS400Text(7, system);
      
      AS400Text pRetCd  = new AS400Text(1, system);
 
String MsgPgm = "          "; 
      String Function = "E";
      String UserId = "MCNEALJO";
      String ErrorFld = "          ";
      String ErrorId = "XXXXXXX";
      String RetCd = " ";
 
            parms[0] = new ProgramParameter(pMsgPgm.toBytes(MsgPgm));
            
            parms[1] = new ProgramParameter(pFunction.toBytes(Function));
            
            parms[2] = new ProgramParameter(pUserId.toBytes(UserId));
            
            parms[3] = new ProgramParameter(pErrorFld.toBytes(ErrorFld));
            
            parms[4] = new ProgramParameter(pErrorId.toBytes(ErrorId));
            
            parms[5] = new ProgramParameter(pRetCd.toBytes(RetCd));
            
 
            ServiceProgramCall sPGMCall = null;
 
            System.out.println("About to create the program");
            sPGMCall =  new ServiceProgramCall(system,
 
"/QSYS.LIB/MCNEALJO.LIB/TESTSRVPGM.SRVPGM",parms);
            sPGMCall.setProcedureName("TESTSRVPGM"); 
            System.out.println(sPGMCall.run());
 
            AS400Message[] ml = sPGMCall.getMessageList();
 
            for (int i=0; i<ml.length; i++)
               System.out.println(ml[i].getID() + ": " + ml[i].getText());
            }
            catch (Exception e){
                  System.out.println(e);
            }
 
Any idea why this message ?  I don't see a field that is 14 bytes long
anywhere. 
 
 
John McNeal
CARE Development
678-893-1739
 
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.