EMS Manual

EMS Procedures
EMS Manual426909-005
15-7
Required Declarations and Standard Definitions
Required Declarations and Standard
Definitions
Whether you program in TAL, COBOL85, C, Pascal, FORTRAN, or HP Tandem
Advanced Command Language (TACL), consult the appropriate sections of the SPI
Programming Manual. These sections generally apply to token-based messages (that
is, to event messages as well as command and response messages).
This subsection is an overview. For more information, see the SPI Programming
Manual.
Standard Definitions in TAL Programs
Each TAL module of your application must contain ?SOURCE directives to include the
TAL versions of the SPI standard definition files for relevant subsystems. For example,
this directive defines the symbols used by SPI and by EMS:
?SOURCE $SYSTEM.ZSPIDEF.ZSPITAL
?SOURCE $SYSTEM.ZSPIDEF.ZEMSTAL
You need a ?SOURCE directive for each subsystem whose symbols you use in the
TAL module.
To make the standard definition files available to your COBOL85 program, use COPY
statements referencing the relevant COBOL standard definition files.
Declaring Buffers and Subsystem IDs in TAL
To send command messages to a distributor, you need a buffer for distributor
commands, such as GETEVENT. Use the template in the EMS standard definition file,
for example:
STRUCT .my^spi^buffer (ZEMS^DDL^MSG^BUFFER^DEF);
If you are writing a subsystem and need a buffer in which to create event messages:
1. Use the same template to declare an event-message buffer:
STRUCT .my^evt^msg^buffer (ZEMS^DDL^MSG^BUFFER^DEF);
The resulting buffer is slightly longer than required.
2. Declare each subsystem ID that you pass to an EMS procedure in a declaration
such as:
STRUCT .ZEMS^VAL^SSID (ZEMS^VAL^SSID^DEF);
3. Initialize the subsystem ID with a statement such as:
ZEMS^VAL^SSID ':=' [ZSPI^VAL^TANDEM, ! Z^OWNER
ZSPI^SSN^ZEMS, ! Z^NUMBER
ZEMS^VAL^VERSION ]; ! Z^VERSION
This initializes the subsystem ID for EMS itself.