OpenTP1 Version 7 Programming Guide

[Contents][Index][Back][Next]

1.2.3 Message handling UAP (MHP)

A UAP used for message exchange processing is called a message handling program (MHP). The MHP enables an own system connected with the MCF to communicate in message exchange mode. For details on message exchange processing see 3.6 Message exchange processing.

The MHP can use the functions of OpenTP1 message exchange facilities. The MHP can also request SPP services from MHP processing by using the RPC.

To use the MHP, the MCF must be at the node at which the MHP exists.

The figure below shows the MHP.

Figure 1-13 Outline of MHP

[Figure]

Organization of this subsection
(1) MHP configuration
(2) MHP start
(3) During MHP operation
(4) MHP termination
(5) Outline of MHP processing
(6) Note

(1) MHP configuration

Like the SPP, the MHP comprises a main function and service functions.

An application which is scheduled according to the application name in a message received by the MCF is created as a service function (a service program when COBOL language is used). Create more than one service function, link the service functions with a main function (a main program when COBOL language is used), and group all the functions into an executable file. Then, define the MHP executable file, comprising one main function and multiple service functions, as a service group in OpenTP1.

Since the facility for dynamic loading of service functions groups multiple services into a UAP shared library# before using them, it is not necessary to group them in the main function.

#
UAP shared library creation refers to linking the UAP object files created by compiling UAP source files and grouping them in a shared library.

The figures below show MHP configurations, the first of which uses a stub and the second of which uses dynamic loading of service functions.

Figure 1-14 MHP configuration (using a stub)

[Figure]

Figure 1-15 MHP configuration (using dynamic loading of service functions)

[Figure]

(2) MHP start

The MHP can be started either at the same time as OpenTP1 or anytime after OpenTP1 is started. If the first method is selected, MHP processing will start as soon as OpenTP1 starts. The starting time can be selected according to the purpose of the MHP.

(a) Starting at the same time as OpenTP1

Before starting OpenTP1, specify that the MHP is to start at the same time as OpenTP1. Specify the user server name of the MHP in the definition command dcsvstart for the user service configuration definition.

(b) Starting anytime after OpenTP1 is started

To start the MHP anytime after OpenTP1 is started, specify the user server name of the MHP as the argument to the dcsvstart command.

The MHP is initiated from the main function. It becomes ready to receive messages when the MHP service starting function (dc_mcf_mainloop()[CBLDCMCF('MAINLOOP')]) is normally executed. If the MHP terminates abnormally before the service starting function is called, processing is determined by the values assigned to the hold operand and term_watch_time operand in the relevant user service definition (or user service default definition).

(3) During MHP operation

The started MHP works as a previously specified process so that memory can be used efficiently. The started MHP may be activated as a resident process or nonresident process. In the former case, the MHP starts processing upon receiving a service request. Even in the latter case, a service request activates the process, thereby starting MHP processing.

For details about setting up UAP processes, see 1.3.5 Application program environment setup.

(a) Starting a message handling MHP

After the MCF receives a message, the corresponding MHP process is started. The MHP is scheduled according to the application name in the first segment of the message. In the MCF application definition, correspond the application name to the service name for recognizing the UAP service in OpenTP1.

The message handling MHP can be started at either of the following times by using the function dc_mcf_execap()[CBLDCMCF('EXECAP')] by another UAP (MHP or SPP):

(b) Starting an MHP for an MCF event

If an MCF error or an MHP error occurs, a message is output for posting the error status from the MCF. This feature is called an MCF event. Create an MHP for an MCF event in case an MCF event is reported so that the MHP for an MCF event will perform error recovery processing specific to the MCF event. Create an MHP for an MCF event in correspondence to the event code of an MCF event which might report. If the MCF event reports, the corresponding MHP for an MCF event is started. For details on MCF events see 3.10 MCF events.

(4) MHP termination

The MHP is normally terminated when:

When one of the above events occurs, the function dc_mcf_mainloop() returns, thereby terminating the MHP.

Do not use the kill command to terminate the MHP process.

(5) Outline of MHP processing

Perform the following pre-processing for MHP main functions:

The figure below shows MHP processing.

(6) Note

You cannot call the MHP service functions using the RPC.

Figure 1-16 Outline of MHP processing (C language)

[Figure]