Example 3

A program running as an activation of an activity needs to find whether a named event has been defined to any of its children; that is, whether the event exists in any of the children of the event pool. If the event exists, the program needs to retrieve its fire status.

Because the program starts an activity browse on which no activity identifier or process name is specified, BTS browses the current activity. The program retrieves the identifier of each child activity, and uses the identifier to browse the events child.

Activity identifiers remain valid after the browse that obtained them has ended, they are valid for the life of the activity itself. To illustrate this , the program uses the identifier of the activity whose event pool contains the named event, on an INQUIRE EVENT command, after it has ended the browse .
Figure 1. Browsing example 3
 EXEC CICS STARTBROWSE ACTIVITY BROWSETOKEN(parent_token)
loop until the event is found or there are no more child activities
EXEC CICS GETNEXT ACTIVITY(child_activity_name)
BROWSETOKEN(parent_token)
ACTIVITYID(child_activity_id)
EXEC CICS STARTBROWSE EVENT ACTIVITYID(child_activity_id)
BROWSETOKEN(event_token)
loop until event found or there are no more events
EXEC CICS GETNEXT EVENT(event_name)
BROWSETOKEN(event_token)
end event browse loop

EXEC CICS ENDBROWSE EVENT BROWSETOKEN(event_token)

end child activity browse loop
EXEC CICS ENDBROWSE ACTIVITY BROWSETOKEN(parent_token)
EXEC CICS INQUIRE EVENT(event_name)
ACTIVITYID(child_activity_id)
FIRESTATUS(fstatus)