OSI/AS Programming Manual

Example 1: Session Layer
Sample Programs
E–12 056783 Tandem Computers Incorporated
-- APPLICATION 1
-- Inform the OSI/AS subsystem that the application is
-- willing to establish a connection if a remote user
-- requests one. The fourth parameter, service^id, is
-- not used here, because its default is session.
--
print_aps( "APPL1: attach" );
status := APS_ASSOC_ATTACH_( cepi_1
, api_environment
, local_appl_1
);
IF ( status <> ZAPS^VAL^STATUS^OK ) THEN
CALL display_aps_status( cepi_1, error_attach_proc );
--
-- Get OSI address information.
--
error :=
APS_ASSOC_GETPARAM_( cepi_1
, ! conid !
, local_appl
, ! remote-appl !
, ! connect-result !
, ! session-rqmnts !
, ! release-result !
, ! abort-reason !
);
IF ( error <> ZAPS^ERR^OK ) THEN
CALL display_aps_error( error_assoc_getparam_proc );
--
-- APPLICATION 2
-- Issue connect request.
--
-- Initialize the user data to a string of the character
-- "2." Because this is an application using the OSI/AS
-- Session Layer, we don't set the PCID field of the
-- user^data structure. This field is used only by
-- Presentation and ACSE and is ignored by the OSI/AS
-- Session Layer.
--
user_data_2.header.znum^elements := 1;
user_data_2.element.zlen := $UDBL( num_bytes_to_transfer );
user_data_2.element.ztype := ZAPS^VAL^DATA^TYPE^VALUE;
user_data_2.value ':=' [num_bytes_to_transfer * ["2"]];
--
-- Initialize functional units, sync, and tokens.
--
--
-- The ZL5^FU^ISPRESENT field informs OSI/AS that it
-- should look at the functional units specified.
-- During connection establishment, this field must be set
-- to ZAPS^VAL^TRUE.
--