0

I am calling as400 system from Java. I am able to connect to a program of as400 system but not able to get the output data. It is giving me empty message.

AS400 as400 = new AS400("as242g.na.sysco.net", "dprint", "dprint");
System.out.println(as400);
ProgramParameter[] parameters=new ProgramParameter[4];
AS400Text opcoText=new AS400Text(3,as400);
AS400Text emoptyText=new AS400Text(1,as400);
AS400Text indicatorText=new AS400Text(1,as400);
parameters[0]=new ProgramParameter(opcoText.toBytes("056"));
parameters[1]=new ProgramParameter(emoptyText.toBytes(" "));
parameters[2]=new ProgramParameter(indicatorText.toBytes("Y"));
parameters[3] = new ProgramParameter(10);
String fullProgramName = "/QSYS.LIB/SCSUINT.LIB/DPIM10CL.PGM";
System.out.println(fullProgramName);
ProgramCall programCall=new ProgramCall(as400);
try {
    programCall.setProgram(fullProgramName,parameters);
    if (programCall.run()) {
        System.out.println("run");
        AS400Text text1 = new AS400Text(10,as400);
       String message=(String) text1.toObject(parameters[3].getOutputData());
       System.out.println(message);
    }
    else {
        System.out.println("false");
    }
} catch (PropertyVetoException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (AS400SecurityException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (ErrorCompletingRequestException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (InterruptedException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (ObjectDoesNotExistException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

Could someone please help what changes need to be done to get the desired output result

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
unknown
  • 412
  • 7
  • 20
  • There seems to be quite a lot of examples on the Internet. Did you try searching for ___as400 from java___? There are several questions on SO, including https://stackoverflow.com/questions/46095504/calling-as-400-rpg-programs-from-java There is also this [blog](https://yusy4code.blogspot.com/p/as400-web-options.html) By the way, doesn't IBM have support for this? – Abra Sep 29 '20 at 07:25
  • Can you write the output you're receiving ? Is it `run` then an empty line ? Or does your call ends in an Exception, and then : which catch block, with what message? – Marc Le Bihan Sep 29 '20 at 07:28

0 Answers0