Question

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.

Was it helpful?

Solution

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
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top