EMS Manual
Retrieving Event Messages Programmatically
EMS Manual—426909-005
4-3
Getting Started
2. Use the OPEN procedure to open the process. You can also use the FILE_OPEN_
procedure, which is mandatory if the process is started at a high PIN.
3. Use the WRITE procedure to send the process a start-up message.
When you send a start-up message, the only parameter you must specify is the
distributor type (“TYPE C” for consumer). The other parameters then use their
default values, and later you can use a distributor CONTROL command-message
to change any values you want to change. Or, as shown in this code, you can
specify other parameters in the start-up message, using the same syntax as for the
RUN EMSDIST command.
In this example, the parameter string is set to “TYPE C, BACKUP 8” to specify that
this is a consumer distributor whose back-up process is to run in processor 8:
! Open distributor process to send start-up message
process^name ':=' ["$MYDST ", 8*[" "]];
CALL OPEN(process^name, fnum, , 1);
IF <> THEN ...
startup^message.id := -1;
startup^message.infile ':=' [12*[" "]];
startup^message.outfile ':=' [12*[" "]];
startup^message.defaults ':=' my^file^defaults for 8 words;
startup^message.params ':=' ["TYPE C, BACKUP 8",0,0];
CALL WRITE(fnum,
startup^message,
$offset(startup^message.params) + 18);
CALL FILEINFO(fnum, error);
IF NOT (error = 0 OR error = 70) THEN ... !error
CALL CLOSE(fnum);
! Open distributor process for SPI communication
process^name[4] ':=' "#ZSPI ";
CALL OPEN(process^name, fnum, , 1);
IF <> THEN ...
Note. You can use FILE_GETINFO_ instead of FILEINFO.