3

This question is specifically related to the JT400 class ProgramCallDocument, with it's method callProgram(String ProgramName)

I've tried wapping the call in a try/catch - but it's not throwing an exception, the debugger goes into the callProgram method, and just sits there indefinitely.

A small amount of specific information about the API is available here:

http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/com.ibm.etools.iseries.toolbox.doc/rzahhxpcmlusing.htm

Here's the code that I'm running:

AS400 as400System = AS400Factory.getAS400System()
ProgramCallDocument programCallDocument = new ProgramCallDocument(as400System, "com.sample.xpcml.Sample.xpcml")
programCallDocument.setStringValue("sampleProgramName.value", sampleValue)

Boolean didProgramCallDocumentRunSuccessfullyOnTheAS400 = programCallDocument.callProgram("sampleProgramName")

The last line of that snippet is the one that just sits there. I left out the try/catch for brevity.

The XPCML file that the ProgramCallDocument constructor uses is just a proprietary XML format that IBM uses for specifying the parameter lengths and types for a program call. I can come back and add it in if it would be helpful, but the ProgramCallDocument constructor runs validation on the XML, and it didn't come up with any validation errors. I'm not familiar with JT400, or how it does Program Calls, so any assistance would be wonderful.

As a further note, doing some more digging on a related issue today I also found this SO post:

Monitor and handle MSGW messages on a job on an IBM i-series (AS/400) from Java

I think it's relevant to this question, because it's about ways to trap MSGW status on the Java/Groovy side.

Community
  • 1
  • 1
Jason Lowenthal
  • 790
  • 1
  • 5
  • 16

1 Answers1

3

It's very likely the called program went into a MSGW status (error).

Check WRKACTJOB JOB(QZRCSRVS) to find the program call job and see the status as well as review the job log.


It may be easier to call a native program using the CommandCall class or as a JDBC stored procedure.

Here's an example of the CommandCall usage in Groovy:

sys = AS400Factory.AS400System
cmd = new CommandCall(sys)
if (!cmd.run "CALL MYLIB.MYPGM PARM('${sampleValue}')") {
    println cmd.messageList
}
James Allman
  • 40,573
  • 11
  • 57
  • 70
  • OK, I'll check on that. Thanks. – Jason Lowenthal Mar 21 '14 at 17:23
  • Running `WRKACTJOB JOB(QZDASOINIT)` I'm not seeing anything in MSGW status. I wonder if I'm looking in the wrong place? – Jason Lowenthal Mar 21 '14 at 17:32
  • CommandCall... that's a good thought. I'll give it a look. Thanks – Jason Lowenthal Mar 21 '14 at 18:00
  • @JasonLowenthal It may have spawned a separate job. Try searching for it with `WRKACTJOB SBS(QUSRWRK)`. Also check for messages with the `DSPLOG` command. – James Allman Mar 21 '14 at 18:03
  • I got some help from someone that knows more about AS400 than I do. We found the MSGW messages, found out what was wrong with the ProgramCallDocument, and fixed it. I was missing a parm in my XML, which caused MSGW. Thanks for the tip, good job! – Jason Lowenthal Mar 21 '14 at 18:43
  • 2
    Glad you got it solved. Minor added info... The `WRKACTJOB JOB(QZDASOINIT)` wasn't successful probably because your Java program call wasn't through the Database server. I don't have an immediate example to verify, but I'd expect `WRKACTJOB JOB(QZRCSRVS)` to be a better choice (or simply `WRKACTJOB` and sort by 'Status'). The `QZRCSRVS` jobs are for the Remote Command/Distributed Program Call host server. For later use, you might check to see if that's where your Java calls are handled. – user2338816 Mar 22 '14 at 00:09
  • @user2338816 You are correct. I confirmed with the [AS400.getJobs(AS400.COMMAND)](http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/rzahh/javadoc/com/ibm/as400/access/AS400.html#getJobs(int)) method. I have updated my answer with this information. Thanks! – James Allman Mar 22 '14 at 02:15