Deferred program switching for conversational JMP applications
You can make a deferred program switch in a conversational JMP application. A deferred program switch changes the transaction code in the scratchpad area (SPA) before the SPA is returned to IMS. When an application makes a deferred program switch, the application replies to the terminal and passes the conversation to another conversational application.
Use the setTransactionName(String)
method of the
com.ibm.ims.dli.tm.IOMessage
class to specify the transaction code in the
SPA.
To make a deferred program switch in a conversational JMP application:
Procedure
-
Call the
insert(IOMessage)
method to send the output message to the terminal. -
Call the
setTransactionName(String)
method to set the name of the transaction code in the SPA. -
Call the
insert(IOMessage)
method to send the SPA to IMS.
Code sample of deferred program switching
The following code sample demonstrates how deferred program switching is performed in a JMP application.
package sample.jmp;
import com.ibm.ims.dli.tm.Application;
import com.ibm.ims.dli.tm.ApplicationFactory;
import com.ibm.ims.dli.tm.IOMessage;
import com.ibm.ims.dli.tm.MessageDestinationSpec;
import com.ibm.ims.dli.tm.MessageQueue;
import com.ibm.ims.dli.tm.Transaction;
public class SampleJMPDeferredPGM {
private static IOMessage spaMessage = null;
private static MessageQueue msgQueue = null;
private static Application app = null;
private static IOMessage inputMessage = null;
private static Transaction tran = null;
public static void main(String[] args) {
try {
app = ApplicationFactory.createApplication();
spaMessage
= app.getIOMessage("class://sample.jmp.SPAMessage");
inputMessage
= app.getIOMessage("class://sample.jmp.InMessage");
msgQueue = app.getMessageQueue();
tran = app.getTransaction();
MessageDestinationSpec mds
= new MessageDestinationSpec();
mds.setAlternatePCBName("TPPCB1");
mds.setDestination("IVTCM");
String in = new String("");
while (msgQueue.getUnique(spaMessage)) {
if (msgQueue.getNext(inputMessage)) {
in = inputMessage.getString("Message").trim();
if (in.equalsIgnoreCase("DeferredPGMSwitch2")) {
inputMessage.setString("Message", spaMessage.getString("Message"));
msgQueue.insert(inputMessage, MessageQueue.DEFAULT_DESTINATION);
// Setting Deferred Program Switch
inputMessage.setString("Message", "Setting Deferred Program Switch");
msgQueue.insert(inputMessage, MessageQueue.DEFAULT_DESTINATION);
spaMessage.setString("Message", "SampleJMPDeferredPGM");
spaMessage.setTransactionName("IVTCM");
msgQueue.insert(spaMessage, mds);
inputMessage.setString("Message", "SampleJMPDeferredPGM Completed");
msgQueue.insert(inputMessage, MessageQueue.DEFAULT_DESTINATION);
tran.commit();
} else {
inputMessage.setString("Message", spaMessage.getString("Message"));
msgQueue.insert(inputMessage, MessageQueue.DEFAULT_DESTINATION);
inputMessage.setString("Message",
"Input Message was not 'DeferredPGMSwitch2'");
msgQueue.insert(inputMessage, MessageQueue.DEFAULT_DESTINATION);
tran.commit();
}
}
}
} catch(Exception e){
e.printStackTrace();
}
}
}