NDC comm CompuFax User Manual

Page 103

Advertising
background image

7 9

routines. The format and use of the lookup key is left entirely up to the database application. It is passed from
the source (command processor or document file) directly to the database. A concept used in the CompuFax
system for database lookup is a database lookup request stream.

The general idea is that the user issues a fax request specifying a database lookup key. It is possible that this
key may match many records in the database (which is one way in which bulk mail type operations may be
achieved).

A request is made to the database which specifies a lookup key. The database returns a matching record. This
process continues until there are no more matches at which point the database informs the requestor of this
fact.

This request-response mechanism is called a database lookup request stream. Note that it is not strictly
necessary for the database application to support multiple matches for a single key but it adds a new level of
functionality that will in most cases be desirable.

Since multiple fax machines may be active at the same time and multiple users may be using the command
processor, it is necessary that the database application support multiple lookup streams active simultaneously.
The supplied library routines take care of keeping track of open streams and the user context associated with
each. While there may be several streams active at the same time, each stream will have a maximum of one
request pending.

The following describes the flow of a database lookup.
1.

The command processor issues a Send which specifies a data base lookup. Note: This could also be the
print symbiont, VMS Mail interface or a user application using the FAX_CMD routines.

2.

When the request comes to the top of the queue and the FAX is to be sent, the server issues a lookup
request to the data base application specifying a unique stream identifier.

3.

The FDB routines forward this request to the database application. This application fetches the record
and sends it via the FBD routines back to the server.

4.

The server sends the FAX.

5.

When the request is again at the queue, the server sends a new request to the database specifying the
same stream ID.

6.

When the database application has no matches for the key, the stream is closed by the database via the
FDB routines.

Note: If the request is deleted from the queue (FAX STOP/ ENTRY command) the server issues a close
stream to the database. The FDB routines forward this to the application.

10.1.2 Using The FDB Rout ines

A database application is implemented using the series of FDB routines provided. Considerable flexibility is
allowed in how the program is structured. It is possible to handle requests one at a time or to use
asynchronous processing to process multiple requests simultaneously.

The general sequence of processing is:
1.

Initialize with FDB_INIT

2.

Get a request using FDB_GET - this involves an implied wait if no request is currently pending.

3.

If this is a new stream, do whatever is necessary to start the lookup sequence. If it is not a new stream,
retrieve the context with FDB_GET_CONTEXT.

4.

Go get the data from wherever it is.

5.

Use FDB_START_MSG, FDB_SET_NUMBER, FDB_SET_STATUS, FDB_SET_MATCH and
FDB_SET_FIELD to build the return message to the requestor.

6.

Return the data using FDB_SEND_DATA.

7.

Save the context for this stream using FDB_SAVE_CONTEXT.

Advertising