Envoy ACP/XF Application Programming Manual

Asynchronous Balanced Mode (ABM) Protocols
EnvoyACP/XF Application Programming Manual132179
2-13
Pseudocode Examples
Pseudocode Examples
These examples show the recommended logic for basic data-communication tasks.
These are not actual code examples.
Initiating and Terminating an HDLC Link
The following example shows the configuration, initiation, and termination of an HDLC
link. The stations are connected to one another over a nonswitched, full-duplex line. In
this example, the line is called $HDLC. HDLC is configured full-duplex, with DTR up,
nowait I/O, and a nowait I/O depth of 15.
!Open the line "HDLC"
OPEN HDLC,fnum,%37
IF <> do error handling
!Get the current line setting.
SETMODE fnum,16,,,current_value !two words
IF <> do error handling
!Set the line to allow nowait I/O operations to complete in
!any order
SETMODE fnum,30,1
IF <> do error handling
The CONTROL 13 (send SABM) request initializes the link. Between the OPEN
request completion and CONTROL 13 request completion, HDLC is in disconnect mode
(that is, HDLC replies with DM to all commands received from the remote station). In
the following example, the local station initiates the link:
! Send SABM
CONTROL fnum,13,2
IF <> do error handling
AWAITIO fnum
IF <> do error handling
.
.
.
When either application wants to terminate the session, it calls CONTROL 18 and closes
the line, as follows:
!Disconnect the link
CONTROL fnum,18
AWAITIO fnum
!Drop DTR
CONTROL fnum,116
!Close the line. Conversation is complete
CLOSE fnum