Server usage

The connection is created by an address space that provides a service that can be called by other programs. When the service is called, it needs to access notes in the note pad while running under the caller's work unit. Since the home address space of the work unit that calls the service will not normally be the server address space, the work unit is not deemed to be the connector and so would not qualify as a valid user of the connection. However, with a connection created for server usage, the work unit is permitted to access notes in the note pad when it is running authorized and the primary address space is the connector address space. In practice, the service might receive control via a space switch PC.

Only an authorized program can create a connection for server usage. Furthermore, the work unit that uses the connection in this manner must be running authorized. When the connection is created, the home address space and primary address space of the requesting work unit must be the same space (the server address space). When the connection is used, the primary address space of the work unit must be the server address space (the connector address space).

Figure 1. Note pad connection with USAGE=SERVER
Note pad connection with USAGE=SERVER

In this style of use, the note pad is created by the server for its own purposes. It is intended for use by the server when running authorized in the server address space under a client work unit. The server should not normally give the caller direct access to the notes in the note pad. If it does so, the server is responsible for ensuring that the caller has the appropriate SAF authorization for such access. In cases where SAF authorization would be needed or the service routine needs to run unauthorized, it might be more appropriate for the server to create a connection for connector usage on behalf of the client (as described under Connector usage).

As an alternative, you could create a connection with connector usage and still provide a service as described above. For example, the service might receive control via a space switch PC. In cases where the calling work unit was not deemed to be the connector, the service routine would not be permitted to access notes in the note pad. To access the note pad, your program could queue work to a task in the server address space that is deemed to be the connector. That task would be permitted to use the connection to access the note pad. The requesting work unit might be suspended until the task completed its work. A connection created for server usage allows for synchronous access to the server note pad under the calling work unit, avoiding the complexity and overhead of an asynchronous protocol.

Note that the USAGE=SERVER connection can also be used by the server itself in any context where USAGE=CONNECTOR type accesses would be permitted. That is, had the connection been created with USAGE=CONNECTOR, work units originating from the server address space would have been permitted to use the connection. Any work unit that would have qualified for such usage qualifies as a valid user of the USAGE=SERVER connection. The work unit does not need to run authorized.