OSI/AS Programming Manual
Example 2: Presentation Layer and ACSE
Sample Programs
056783 Tandem Computers Incorporated E–69
IF ( filenum <> cepi ) THEN
CALL DEBUG; -- shouldn't happen for this example
END; -- else...
END; -- proc wait_for_aps_completion
? PAGE
------------------------------------------------------------
--
-- Wait for an event and make certain it is the one that
-- is expected.
--
------------------------------------------------------------
PROC wait_for_event( expected_event_code );
INT expected_event_code; -- i : expected event
BEGIN
LITERAL time_limit = -1D; -- wait indefinitely
tag := $UDBL( error_event_proc );
status := APS_EVENT_RECEIVE_( cepi
, time_limit
, tag
);
CALL wait_for_aps_completion( error_event_proc );
IF ( status <> ZAPS^VAL^STATUS^EVENT ) THEN
CALL display_aps_status( error_event_proc );
--
-- Find out which event was received.
--
error := APS_STATUS_( cepi
, event_code
, device_name
, error_code
, error_subcode
, service_id
, diagnostic_buffer
, original_error_info
);
IF ( error <> ZAPS^ERR^OK ) THEN
CALL display_aps_error( error_status_proc );
--
-- Check for the expected event.
-- A real application would take appropriate action.
--
IF ( event_code <> expected_event_code ) THEN
CALL DEBUG;
END; -- proc wait_for_event
? PAGE
------------------------------------------------------------