Design overview
The data interchange program is designed as a function manager
for Systems Network Architecture (SNA) devices. It is invoked via
DFHEDI for command-level requests, or internally by the basic mapping
support (BMS) routines using the DFHDI macro. DFHDIP performs the
following actions:
- Determines whether a new output destination has been specified (it retains information about the previous destinations in the data interchange control block) and, if so, builds appropriate FMHs to select the new destination, and outputs these FMHs to the SNA device via terminal control.
- Invokes the appropriate subroutine to perform the intended function:
- ADD
- Builds ADD FMH, transmits it and the user data
- REPLACE
- Builds REPLACE FMH, transmits it and the user data
- ERASE
- Builds ERASE FMH and RECID FMH and transmits them
- NOTE
- Builds NOTE FMH, transmits it, and returns the reply to the user
- QUERY
- Builds QUERY FMH, transmits it, and outputs END FMH
- SEND
- Outputs user data
- WAIT
- Waits for completion of the I/O
- END
- Builds END FMH and transmits it
- ABORT
- Builds ABORT FMH and transmits it
- ATTACH
- Removes FMH from initial input
- DETACH
- Frees the storage used by DFHDIP
- RECEIVE
- Reads a complete record from the logical device.
- Sets the appropriate return code.
Figure 1 shows the data interchange
program interfaces.
Figure 1. Data interchange program interfaces

Note:
- The application program invokes DFHEDI (via DFHEIP) which then communicates with DFHDIP by setting fields in the TCA.
- DFHDIP receives control.
- If no storage has been obtained for the data interchange block (DIB), storage control is invoked. The storage is chained to the TCTTE. Significant status information, such as the currently selected destination, is remembered in the data interchange block, which is freed at the end of task processing.
- A trace entry is made.
- If logging is present (protected task and message integrity) and if a destination change or function change occurs on output, temporary-storage control is invoked to write the DIB to recoverable temporary storage.
- Terminal control is invoked to output any built FMH and also to output the user data. (DFHTC TYPE=WRITE is issued.) For input requests, DFHTC TYPE=READ requests are issued to obtain a non-null input record.
- Any errors obtained from the device are decoded and placed in the TCA return code slot. If no errors were detected, a return code of ‘0’ (zero) is returned.