ENFORM User's Guide
Using an ENFORM Server
ENFORM Servers
7–18 058058 Tandem Computers Incorporated
ENFORM Server Context
ENFORM servers can be written as context-free or context-sensitive servers. The
optional control block in the message format can be used to store context information.
A data record received by the query processor in a request is returned in the next
request and is available to the ENFORM server, as is the optional control block data.
A control block contains all zeros the first time it is passed in a message to an
ENFORM server.
Variable-Length Data
The maximum size of the data is given to ENFORM by the dictionary. At initialization
the query processor sends the maximum size (in bytes, rounded up to an even
number) of the data buffer to the ENFORM server. This size remains fixed throughout
the ENFORM server session.
The query processor is aware of records shorter than the length of the data buffer
because the actual data size (in bytes) is returned from the ENFORM server with the
data. A good practice is to have the ENFORM server blank or zero out unused space
in the data buffer so the server does not confuse unused space with data.
If data records returned to the query processor are an odd byte length, the actual size
of the data is smaller than the data buffer by at least one byte.
Server Location
Query performance might be enhanced if the server resides on the same system as the
data files the server reads.
ENFORM Server Example The following example illustrates the general programming concepts associated with a
simple ENFORM server program written in COBOL.
This ENFORM server accesses a file that contains information about parts and parts
suppliers. The records are structured such that the part number is the primary key
and each part can have up to 5 suppliers. This data is not in first normal form. The
server returns records to the query processor one at a time in first normal form. Each
record returned to the query processor contains the part number, one and ONLY one
supplier number, and the cost of the part from that supplier.
Specific characteristics of the example ENFORM server include the following:
The server is context free—the context information (the last part number and
supplier number that was sent to the query processor) is returned in RECORD-
DATA by the query processor. The optional control block area is used to save the
occurrence number of the last supplier sent to the query processor.
The server accepts up to 5 requesters—each of which should be checked for the
sequence of its messages.