Skip to content

Instantly share code, notes, and snippets.

@oluies
Created February 24, 2015 22:50
Show Gist options
  • Save oluies/240c15c2d9a2dc57bfa3 to your computer and use it in GitHub Desktop.
Save oluies/240c15c2d9a2dc57bfa3 to your computer and use it in GitHub Desktop.
import java.util.{Enumeration, HashMap}
import com.ibm.mq.constants.{MQConstants, CMQCFC}
import com.ibm.mq.headers.pcf.PCFMessage
import com.ibm.mq.headers.pcf.PCFParameter
import scala.collection.JavaConverters._
object Main extends App {
val pcfCM: PCF_CommonMethods = new PCF_CommonMethods
try {
if (pcfCM.ParseParameters(args)) {
pcfCM.CreateAgent(args.length)
getMQStatus(pcfCM)
pcfCM.DestroyAgent
}
}
catch {
case e: Exception => {
pcfCM.DisplayException(e)
}
}
def getMQStatus(pcfCM:PCF_CommonMethods ) {
val request: PCFMessage = new PCFMessage(CMQCFC.MQCMD_INQUIRE_Q_MGR_STATUS)
request.addParameter(CMQCFC.MQIACF_Q_MGR_STATUS_ATTRS, Array[Int](CMQCFC.MQIACF_ALL))
val responses: Array[PCFMessage] = pcfCM.agent.send(request)
val i: Iterator[_] = responses(0).getParameters.asScala
while (i.hasNext) {
val p: PCFParameter = i.next().asInstanceOf[PCFParameter]
System.out.println(" " + p.getParameterName + " " + p.getValue)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment