Coding variable event names with the DATASAVE statement

In addition to coding event names directly on the EVENT and ON statement, you can generate or change event names dynamically during the simulation. To generate event names dynamically, you retrieve an event name from a save area or user area. In this way, the device can store or change the name in the save area or user area at any time, and any device in the network can change names in the network save and user areas.

For all message generation statements that specify an event name, you can code a save or user area with one of the following operand values. value is an integer 0 - 32766 or the name of a valid counter.
value
Specifies an event name referenced at an offset from the start (+value) or back from the end (-value) of the network user area.
Ns+value
Specifies an event name referenced at an offset from the start of a network save area. s is an integer from 1 to 4095.
s+value
Specifies an event name referenced at an offset from the start of the device save area. s is an integer from 1 to 4095.
value
Specifies an event name referenced at an offset from the start (+value) or back from the end (-value) of a device user area.
When you define an event name in this manner, WSim takes the first 8 bytes of data beginning at the specified offset as the event name. If the area contains less than 8 bytes of data, WSim pads the name on the right with blanks. If the area does not exist or contains no data, WSim uses a name consisting of 8 blanks. WSim does not check the validity of the event name, which means you can generate a name that cannot be expressed as EBCDIC characters.
The following example shows how you can save and access a variable event name:
SAVE1  DATASAVE  AREA=N+0,       Saves name in network user area.
                 TEXT=(EVENT1)
        .
        .                        Message generation statements.
        .
WAIT1  WAIT      EVENT=N+0       Waits until EVENT1 is posted.
In the preceding example, WSim places the name EVENT1 into the network user area. When WSim processes the WAIT statement, the terminal waits until EVENT1 is posted.
In the following example, WSim places the text EVENT2 into the device save area 3. When WSim processes ON1, it retrieves EVENT2 from the device save area 3 and uses it as the event name.
SAVE1  DATASAVE  AREA=3,         Saves event name.
                 TEXT=(EVENT2)
        .
        .                        Message generation statements.
        .
ON1    ON        EVENT=3+0,      Specifies event name from device save
                 THEN=B-LABEL    area 3 and an action to be taken when
*                                the event is signaled.
For more information about the DATASAVE statement, see DATASAVE.