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



The line:

sys = new AS400(machName, userID, Password);

will create a new reference to the as400. You only need to do this once. On subsequent calls use the same 'sys' instance.




----- Original Message ----
From: Dave Murvin <davem@xxxxxxxx>
To: java400-l@xxxxxxxxxxxx
Sent: Friday, 3 October, 2008 4:42:08
Subject: Program called by PCML not ending

Apologies if this is a duplicate.  I wasn't subscribed (I thought I
was) and didn't see anything on this in the archives.

Hello;

We have an RPGLE program that is called using PCML from a Java
application by  a software vendor.  The call to the RPGLE program
results in a server job being started that then calls the RPGLE
program.  The RPGLE program does it's thing and returns information
to the calling Java program.  This all works okay, except the server
job never ends and each time the vendor calls this pcml program, it
starts another server job.  There are hundreds of these jobs and we
have to bring down the subsystem to kill them.

What are we or the vendor missing?  I would think that when the job
ends, it should just go away.

Thanks for the help.

Dave

Server jobs looks like this in wrkactjob:


Opt  Subsystem/Job  User        Type  CPU %  Function        Status

      QUSRWRK        QSYS        SBS      .0                  DEQW
        QZRCSRVS    SHIP_SVC    PJ      .0                  TIMW
        QZRCSRVS    SHIP_SVC    PJ      .0                  TIMW
        QZRCSRVS    SHIP_SVC    PJ      .0                  TIMW
        QZRCSRVS    SHIP_SVC    PJ      .0                  TIMW
        QZRCSRVS    SHIP_SVC    PJ      .0                  TIMW
        QZRCSRVS    SHIP_SVC    PJ      .0                  TIMW
        QZRCSRVS    SHIP_SVC    PJ      .0                  TIMW
        QZRCSRVS    SHIP_SVC    PJ      .0                  TIMW
        QZRCSRVS    SHIP_SVC    PJ      .0                  TIMW

A partial list of the PCML java code:


            sys = new AS400(machName, userID, Password);
            ProgramCallDocument pcml;
            try
            {
                  sys.setGuiAvailable(false);

                  // uncomment lines below for logging (never got
this to work but kept them
                  // they are from ibm.com example PCML program...
                  //com.ibm.as400.data.PcmlMessageLog.setTraceEnabled(true);
                  //com.ibm.as400.data.PcmlMessageLog.setLogFileName("PCML.log");


                  KQLOG.D("Beginning PCML");
                  KQLOG.D("    Constructing ProgramCallDocument for
PSHPINF API...");

                  // Construct ProgramCallDocument
                  // First parameter is system to connect to
                  // Second parameter is pcml resource name.
                  // PCML source file "pshpinf.pcml" must be found in
the M3 classpath.
                  pcml = new ProgramCallDocument(sys, "PSHPINF");

                  // set Varsity input parameters
                  HDISH.setCONO(MMUPDREPDS.getM9CONO());
                  HDISH.setINOU(1);
                  HDISH.setDLIX(MMUPDREPDS.getM9RIDI());
                  IN91 = !HDISH.CHAIN("00", HDISH.getKey("00"));
                  // Delivery number DLIX
                  //this.PXNUM = HDISH.getDLIX();
                  //this.PXEDTC = 'L';
                  //this.PXDCFM = LDAZD.DCFM;
                  //this.PXALPH.clear();
                  //SRCOMNUM.COMNUM();
                  XXDLIX.move(HDISH.getDLIX());
                  pcml.setValue("PSHPINF.DELIVERYNO", XXDLIX);

                  //  Package/Carton Number  PANR
                  XXPANR.moveRight(MMUPDREPDS.getM9PACN().toStringRTrim());
//BR02002 MICKYB
                  pcml.setValue("PSHPINF.PACKAGENO",  XXPANR);

                  // Total package TPKG
                  // Get Total Package
                  int count = 0;
                  PTRNS.setCONO(HDISH.getCONO());

                  PTRNS.setDIPA(0);

                  PTRNS.setWHLO().move(HDISH.getWHLO());

                  PTRNS.setDLIX(HDISH.getDLIX());
                  PTRNS.SETLL("00", PTRNS.getKey("00",
4));
                  while (PTRNS.READE("00", PTRNS.getKey("00", 4))) {
                        count++;
                  }
                  //this.PXNUM = count;
                  //this.PXDCFM = LDAZD.DCFM;
                  //this.PXALPH.clear();
                  //SRCOMNUM.COMNUM();
                  XXCNT.move(count);
                  pcml.setValue("PSHPINF.TOTALPKGS", XXCNT);
                  // Total Package end

                  // User ID to run RPG program
                  XXUSER.moveLeftPad(this.DSUSS);
                  pcml.setValue("PSHPINF.USERID", XXUSER);
                  pcml.setValue("PSHPINF.TRACKINGNO", EnvName);
                  pcml.setValue("PSHPINF.STATUSCODE", " ");

                  // Call PSHPINF API
                  pcml.callProgram("PSHPINF"); // program
name  <-----  Dave this is the call right here.  Above setups up
the parameters, below here is the return processing....

                  // Returned values from PSHPINF API
                  StatusCode = (String) pcml.getValue("PSHPINF.STATUSCODE");
                  ShipperTrackerNo = (String)
pcml.getValue("PSHPINF.TRACKINGNO");
            }
            catch (PcmlException pe)
            {
                  String err =  pe.getMessage();
                  if (err.length() > 50)
                  {
                        ShipperTrackerNo =
err.substring(err.length()-50, err.length());
                  }
                  else
                  {
                        ShipperTrackerNo = err;
                  }
                  StatusCode = "1";
                  IN60 = true;
                  this.MSGDTA.moveLeftPad(pe.getMessage());
                  this.MSGID.moveLeftPad("CPF9898");  // Package
number &1 does not exist.
            }
            catch (Exception pe)
            {
                  String err =  pe.getMessage();
                  if (err.length() > 50)
                  {
                        ShipperTrackerNo =
err.substring(err.length()-50, err.length());
                  }
                  else
                  {
                        ShipperTrackerNo = err;
                  }
                  StatusCode = "1";
                  IN60 = true;
                  this.MSGDTA.moveLeftPad(pe.getMessage());
                  this.MSGID.moveLeftPad("CPF9898");  // Package
number &1 does not exist.
            }
            varStatus.move(StatusCode);

            KQLOG.D("Varsity user:  " + XXUSER);
            KQLOG.D("Varsity status code returned 0=OK  1=Error:  "
+ varStatus);
            KQLOG.D("Varsity tracking number:  " + ShipperTrackerNo);

            // Display error if found
            if (StatusCode == "1") {
                  IN60 = true;
                  this.MSGDTA.moveLeftPad(ShipperTrackerNo);
                  this.MSGID.moveLeftPad("CPF9898");  // Package
number &1 does not exist.
            }

            // Update ETRN with varsity number returned
            PTRNS.setCONO(HDISH.getCONO());

            PTRNS.setDIPA(0);

            PTRNS.setWHLO().move(HDISH.getWHLO());

            PTRNS.setDLIX(HDISH.getDLIX());
            PTRNS.setPANR().moveLeftPad(MMUPDREPDS.getM9PACN());
            IN91 = !PTRNS.CHAIN_LOCK("00", PTRNS.getKey("00"));
            if (!IN91) {
                  PTRNS.setETRN().moveLeftPad(ShipperTrackerNo);
                  PTRNS.UPDAT("00");
            }
      }      // ZVARSITY END B



Dave Murvin
DRM Enterprises, Inc.

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.