|
|
|
|
To process host transactions, an application program can automate manual operations in the following ways:
Use the Search Presentation Space function to find any host messages or prompts in the presentation space.
Use the Copy String to Field, Copy String to Presentation Space, and Send Key functions to send information to the host. For more information, see Sending Data to the Host Program.
Use the Wait function to give the host time to respond. For more information, see Waiting for Host Responses.
Use the Search Presentation Space function to determine how the host has responded.
Use the Copy Presentation Space or Copy Presentation Space to String function to retrieve the host response.
In each of these steps, it is important that the application program always check the function's return code to see if subsequent steps should be avoided.
Also, it is important to note that some host applications do not keep a presentation space locked, so the program may need to loop on the Wait function while waiting for a response from the host.
Your HLLAPI program should check the return code for all function calls before continuing.
In general, if the return code indicates that the function completed successfully, the program should continue. If the return code indicates that a system error occurred, your HLLAPI program should call a subroutine that requests the Query System function to examine your program logic. You should have the information generated by Query System available when contacting support personnel.
The Copy String to Field and Copy String to Presentation Space functions can be used to copy data to the 3270 screen buffer. These functions transfer data to the screen buffer more efficiently than the Send Key function.
However, these functions simply write data into the screen buffer without requiring the 3270 emulation program to take any action. In order to tell the 3270 emulation program to process the information in the screen buffer, your application program must use the Send Key function to send an AID key (ENTER, PA1, PF1, and so on).
When a terminal operator or application program sends a command to the
host computer, the terminal assumes a waiting state until the command completes.
While the host computer is processing the command, the Wait
symbol
This section explains one way to wait for the host to respond, by using the Wait function in an idle loop; other methods may be used, such as using the Query Host Update function to notify the program of updates to the status line. Information is also provided on timing and synchronizing commands between the host and application program.
The traditional method of waiting for the host response is to loop until the Wait symbol has been removed from the status line. The program can use a function in the idle loop to check whether the session is still busy; if so, the program returns to the idle loop.
The following steps are used:
Use the or options on the Set Session Parameters function to specify either a timed wait of up to a minute or immediate return from the Wait function. For more information, see HLLAPI Function Requests.
Send the transaction to the host.
Enter the idle loop, which calls Wait until a return code other than HARC_BUSY (host response not yet received) is obtained.
When a return code other than HARC_BUSY is obtained, break out of idle loop and continue according to the value of the return code.
Many things can affect the time the host computer takes to execute a command. The amount of time taken to clear the Wait condition can vary between a few hundredths of a second to several seconds depending on the configuration, line speed, system load, and so on. For this reason, it is advisable for your program to ensure that the host has responded (using a method such as the one outlined above) before attempting any further host transactions.
If the host or controller is extremely busy, the Wait symbol may not appear for some time after your program issues the command. To ensure that the host has responded, your application program could monitor a specific region of the screen buffer for a certain mainframe application message that would be expected following the command from your program. When the message has appeared and the keyboard is unlocked (the order in which these occur is dependent on the host system), your application can then continue with the next host transaction.
If this is impossible and no other synchronization method can be found, the only automatic way to check for completion of the command may be to increase the period your application program waits for the host to respond, even though this will degrade performance.
|
|
|
|
|