6100 MPS-B Programming Manual
6100 MPS-B PROGRAMMING EXAMPLE
The overall program consists of the following:
• Declarations of global literals, variables, and data
structures.
• A main procedure (DO^MAIN) that executes the basic
programming loop.
• A procedure (INITIALIZE) that opens all pertinent files, reads
the start-up message, defines the poll/select list (by calling
DEFINE^POLL^LIST), and connects the modem.
• A procedure (DEFINE^POLL^LISTS) that defines the poll/select
and slow poll lists to allow continuous polling of three
terminals.
• A procedure (CONFIGURE^LINE) that configures the communica-
tions line according to user-supplied parameters.
• A procedure (REPLY^LINE) that initializes the "text" field
of the WRITEREAD buffer with the desired response message.
• A procedure (REQUEST) that initializes the "function",
"modifier", "text out", and "text in" header fields of the
WRITEREAD buffer with passed parameters.
• A procedure (SEND^REQUEST) that increments the request ID,
initializes the "request ID" header field of the WRITEREAD
buffer with the new value, and issues the proper WRITEREAD
call to send a message to a terminal.
• A procedure (LOG^ERROR) that logs error information on the
home terminal.
• A procedure (ERROR^EXIT) that closes the line, $RECEIVE, and
the home terminal and then calls ABEND.
The code is liberally sprinkled with comments. If you are
familiar with the TAL programming language and with the message
formats and WRITEREAD functions described earlier in this manual,
then the operations performed by the individual procedures (and
the interaction between them) should be relatively self-evident.
Figures B-1 and B-2 present flow diagrams for the DO^MAIN and
INITIALIZE procedures, respectively.
B-2