EMS FastStart Manual
Building Your Application for Event Generation
EMS FastStart Manual–133701
6-10
An Example Using Mode 2
Example 6-6 opens the collector at the beginning of the program and stores the file-
number in a variable (section 205-open-collector in the example). In Example 6-6 the 
variable is called file-number. In section 210-atm-up, the egen-record is initialized in 
section 300-initialize-egen-record and the informative event message “atm is up” is 
moved into the event buffer along with the appropriate variable data (ATM name, 
location, and event type). EGEN is called next to generate event messages with two 
parameters (egen-record and file-number). 
The collector is closed in the section 365-close-collector.
Example 6-6. Sample Code for EGEN in Mode 2
 205-open-collector.
 MOVE ZERO TO file-number.
 ENTER TAL "Open^egen^collector" USING file-number, omitted, error-detail
       GIVING return-code.
 IF return-code IS NOT EQUAL TO ZERO
  PERFORM 400-validate-return-code.
*-----------------------------------------------------------------------
* EVENT # 1: ATM IS UP:
*
* Fields within the egen-record which are used for event # 1:
*
*  event-type  PIC S9(4).
*  event-number  NATIVE-2.
*  atm-name   PIC X(8).
*  atm-location  PIC X(24).
*-----------------------------------------------------------------------
 210-atm-up.
 PERFORM 300-initialize-egen-record.
 MOVE INFORMATIVE-EVENT   TO event-type OF egen-record.
 MOVE ATM-EVT-UP    TO event-number OF egen-record.
 MOVE "SFMAIN01"    TO atm-name OF egen-record.
 MOVE "atm-name"    TO subject-field-name OF egen-record.
 MOVE "245 A St., San Francisco" TO atm-location OF egen-record.
 ENTER TAL "Egen" USING egen-record, file-number
    GIVING return-code.
 IF return-code NOT = ZERO
  PERFORM 400-validate-return-code.
 300-initialize-egen-record.
 ENTER TAL "Initialize^egen^record" USING egen-record 
       GIVING return-code.
 IF return-code IS NOT EQUAL TO ZERO
  PERFORM 400-validate-return-code.
 MOVE ZERO   TO return-code.
 MOVE ATM-VAL-OWNER  TO ssid-owner   OF egen-record.
 MOVE ATM-SSN-NUMBER  TO ssid-subsystem-number OF egen-record.
 MOVE ATM-VAL-VERSION TO ssid-version   OF egen-record.
 365-close-collector.
 ENTER TAL "Close^egen^collector" USING file-number
       GIVING return-code.
 IF return-code NOT = ZERO
  PERFORM 400-validate-return-code.










