Control Flow

The following figure shows a typical control flow for an API application.

The API environment is initialized by the EDAINIT or EDAPINIT call. An EDACONNECT call is issued to establish a connection to a server and the return code is tested to ensure a successful connection. The application can then accept a query, either from user-typed input or a list selection. This query is sent to the server using the EDASQL method call. Any EDAFETCH, EDANEXT, or EDAINFO call causes the application to wait until a response is received. The EDATEST call checks to see if the response is available for this specific SCB. If a response is available, it can be processed. An EDAINFO call will provide information on the result set columns. The EDAFETCH call will retrieve the data, one row at a time, and the application will process or display it in an appropriate fashion. This method call will be issued repeatedly until the end-of-set is reached. At the end of processing, an EDAXCONNECT call is issued to release the server connection, and an EDATERM call is issued to terminate the session and release resources.

Note: This simple control flow diagram does not include error processing. Ideally, the SCB return code should be checked after every method call, and the SCB Message Type field should be checked for available messages before processing data retrieved from the server.


iWay Software