The user program issues the TERM request to terminate
this instance of interface use. A TERM request is accepted by the
interface at any time.
For the most orderly termination of the interface, the
client program should ensure that no SCMDs are in-progress and then
issue SCMD with the QUIT subcommand before using the TERM request.
To assist the caller with exceptional conditions, TERM performs the
following steps unless the client process is broken:
- If the TERM request detects that a prior SCMD is in-progress,
it generates up to three POLL requests at 16-second intervals in an
attempt to retrieve the results from the client. Any generated POLL
requests appear in the interface trace (if active) with (Generated
by TERM) appended to the request record along with any results
that are retrieved.
- If the TERM request detects that a QUIT has not yet been issued
to the client, it generates an SCMD QUIT request. The generated SCMD
QUIT request appears in the interface trace (if active) with (Generated by TERM) appended to the request record along
with any results that are retrieved.
If the client process is broken, or the interface fails
to complete a subcommand that was in-progress, or a generated QUIT
fails to complete successfully, then the interface issues BPX1KIL
with no signal to kill the client process. The reason for the failure
is reported on a prior request or in the interface trace.
When TERM completes, FCAI-Token is zeros and only an INIT
request is accepted by the interface using this FCAI.
Rule: Never update FCAI-Token
or attempt to reinstate it after TERM. If FCAI-Token is corrupted,
you must terminate your application to free acquired storage and stop
the client process.
Guidelines: - To ensure that complete results are returned, always check for
FCAI-Status-InProgress upon return from an SCMD request and POLL to
complete the request if it did not complete. Although TERM generates
POLLs to the client, this does not guarantee that the prior subcommand
will complete or that all results will be returned. The three POLL
requests can retrieve a maximum of 96 KB. The actual amount that is
retrieved depends upon the timing of the request and current buffer
utilization.
- Set FCAI-TraceIt to FCAI-TraceIt-Yes on TERM to see the results
from any generated POLLs or QUIT. The results are available only in
the trace because TERM frees the interface buffer.
- If an active FCAI is cleared and reused on an INIT request without
first issuing an SCMD QUIT or TERM, the FTP client process that was
associated with it is stranded. The client child process can persist
until the parent process terminates. Failure to issue TERM after SCMD
QUIT retains acquired storage until the parent task terminates. It
is especially important in long-running application processes to terminate
instances of the interface that are no longer in use.