× 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: Keith_McCully@wunderman.co.uk
>
> I'm using a ProgramCall object to call an iSeries CL program from
> a java class.

> From: joepluta@PlutaBrothers.com
>Keith, have you tried reducing this to the bare minimum?
--

 Simply coding a
>minimal CL program with the DLTF, and then a minimal Java program calling
>it?  If so, would you mind posting your Java code so we can see if the same
>behavior exists?

Joe, I've listed a reduced version of my Java program and trimmed down the CL to
just the DLTF with  MONMSG     MSGID(CPF2100 CPF3200). I repeated the file lock
test and ,as before,  got CPF9898 for the message ID and '.' for the message
text.
Thanks, Keith

import java.util.*;
import com.ibm.as400.access.*;

public class MsgTest{

String lib;
String file;
double length;

MsgTest(String l, String f, String len){
        lib=l;
        file=f;
try {
            length = ( new Double(len)).doubleValue();

} catch(NumberFormatException n){(len)).doubleValue();and
          System.err.println("Error : record length not numeric");
          return;
}

}


 public void crtQSYSFile(){

AS400 sys=null;
ProgramCall prog=null;

 try{
        sys = new AS400();
        prog = new ProgramCall(sys);
        String progName = "/QSYS.LIB/QGPL.LIB/MSGTEST.PGM";
        ProgramParameter [] parm = new ProgramParameter[3];
        AS400Text objtext = new AS400Text(10, sys);
        parm[0] = new ProgramParameter(objtext.toBytes(lib));
        parm[1] = new ProgramParameter(objtext.toBytes(file));
        AS400PackedDecimal dec = new AS400PackedDecimal(5, 0);
        parm[2] = new ProgramParameter(dec.toBytes(new
java.math.BigDecimal(length)));

        prog.setProgram(progName, parm);

                prog.run();
                AS400Message [] msgList = prog.getMessageList();

                System.err.println("AS/400 messages:");
                for (int j=0; j<msgList.length; j++){
                        System.err.println(msgList [j].getID());
                        System.err.println(msgList [j].getText());
                }

 }catch(Exception e){
         System.err.println("Program " + prog.getProgram() + " did not run!");
         System.out.println("Caught exception: " + e.getMessage());
             e.printStackTrace();
 }finally{
        sys.disconnectAllServices();
 }

}

 public static final void main(String[] args) {

 MsgTest mt  = new MsgTest(args[0], args[1], args[2]);

            mt.crtQSYSFile();

  }

}
--



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