OSI/MHS P7 Application Programmatic Interface (P7 API) Manual

Planning and Writing Your Application
OSI/MHS P7 Application Programmatic Interface (P7 API) Manual424825-001
2-6
Managing the P7 API Environment
Initializing the Environment
The first P7 API procedure that you call from the client application must be
LOS_INITIALIZE_ . This procedure initializes the P7 API environment by setting up
an internal workspace that enables the other P7 API procedures to operate correctly.
LOS_INITIALIZE_ has no parameters.
The workspace is an area of extended memory dedicated to the P7 API procedures. The
segment holds session-related data such as the control blocks and I/O buffers used by the
P7 API procedures. If you call any other procedure before initializing the environment,
the procedure fails.
The extended memory segment exists as long as your client application process exists.
Call the LOS_INITIALIZE_ procedure once for each instance of your application
process.
Opening a Session
You call the LOS_OPEN_ procedure to open a session with an LO group in the local
OSI/MHS subsystem. When a client application calls LOS_OPEN_ , the following
steps occur:
1. The client application sends an open request to the P7 API service.
2. The P7 API sends a request for the status of all the LO groups in the subsystem to
the MHS manager.
3. The MHS manager gathers status information for the LO groups in the local
subsystem.
4. The MHS manager then returns the status information to the P7 API.
5. The P7 API determines which LO group has the fewest associations, and it returns
this information to the open request.
6. The open request associates a send file number and a result file number with the LO
group with the fewest associations.
7. The send file number and result file number are returned as output parameters.
Using the send and result file numbers in subsequent calls to other P7 API procedures
associates the current session with a given LO group.
Figure 2-2 illustrates this process.