Reflection Pro 2014
Reflection for IBM 2014
Reflection for IBM 2011
Reflection Standard Suite 2011
This technical note includes suggestions for efficient programming practices in Reflection Desktop 16, Reflection 2014, and Reflection 2011.
Note: To improve VBA macro and .NET application performance in Reflection 2011, see KB 7021454.
Utilize the practices outlined below to improve programming performance in Reflection Desktop 16, Reflection 2014, or Reflection 2011:
Use early-bound references to automation objects
When working with other applications using their COM automation interfaces, do not declare variables representing these applications "As Object". Instead, add a "reference" to the application using the "Referencesā¦" dialog box (on the VBA "Tools" menu), and declare the variables using types defined by the referenced type-library.
For example, instead of this "late binding" syntax:
Dim xlapp As Object
Set xlapp = CreateObject("excel.application")
Dim wb As Object
Set wb = xlapp.Workbooks.Open("filename")
Use this type of "early binding" syntax:
(First, create a "reference" to "Microsoft Excel 14.0 Object Library.")
Dim xlapp As New Excel.Application
Dim wb As Excel.Workbook
Set wb = xlapp.Workbooks.Open("filename")
With variables declared this way, VBA is able to much more efficiently resolve the address of the functions making up the object's interface, and this can make a noticeable difference, especially for long-running tasks. For more information, see https://support.microsoft.com/en-us/help/245115/using-early-binding-and-late-binding-in-automation
Use the appropriate "WaitFor..." method
After sending each AID key (Enter, PF3, etc.) to an IBM 3270 or 5250 session, it is necessary to use some technique to wait adequately until the host system sends the next screen of data. Reflection provides several convenient methods for this in the IbmScreen interface: WaitForCursor, WaitForText, WaitForHostSettle, WaitForKeyboardEnabled, and others. If you know what screen should appear after sending the AID key, use WaitForText or WaitForCursor rather than other methods that work by monitoring the state of the keyboard being unlocked for a particular duration. WaitForText or WaitForCursor will always be faster than using a method that works by waiting for an arbitrary duration to elapse.
Use IbmScreen.PutText for filling in multiple fields on a screen
If your script needs to fill in multiple fields on a single screen, use the IbmScreen.PutText method for updating each field. PutText enables you to specify the row/column position where text should be put; it places text exactly where it needs to go and also provides precise control over the location compared to sending tabs.
Avoid these practices:
- Using the IbmScreen.SendKeys method, followed by IbmScreen.MoveCursor.
- Repositioning the cursor in the appropriate field by sending multiple tab keys.
- Repositioning the cursor by sending arrow keys (cursor up, cursor down, etc.).
Use one IbmScreen.GetText for the whole screen rather than twenty separate calls for individual pieces of information
Sometimes a script needs to collect information from multiple fields on a single screen and save the information in separate variables in the script. If there is a lot of different bits of information to be retrieved, it is more efficient to use one IbmScreen.GetText call to retrieve all the screen text at once, and use the VBA āMidā function to separate the bits of information into separate variables, rather than doing a separate IbmScreen.GetText call for each piece of information. It is tempting to use multiple GetText calls since it is easier to code, and the difference this makes might not be great, but it can add up over the course of lengthy scripted actions.
Avoid repetitive unnecessary scripted actions
Try to use efficient techniques in general for all programming:
- Donāt open and close a file every time you need to read/write something. Try to leave a file open as long as you are using it before closing it.
- Donāt create and destroy any resources more often than necessary. For example, if your script needs to update a remote database, donāt create and destroy the connection to the database on each iteration of a loop that updates it.
- Donāt make your script traverse more host screens than are necessary to complete the required actions. If your host system allows it, take a shortcut back to a starting point for iterations of a loop, rather than stepping backwards through layers of screens to get to the same point.
Turn off "Enable Usage Data" in Reflection Desktop (Telemetry)
For additional information on the configuration of the Usage Data dialog see https://www.attachmate.com/documentation/reflection-desktop-v16-1/rdesktop-guide/data/config_telemetry_cs.htm
Switch to a faster, new computer
Reflection Desktop 16, Reflection 2014, or Reflection 2011 perform best on newer Windows 7 and Windows 10
computers with multi-core processors and a lot of RAM. Windows XP is
still a supported platform for Reflection 2014 or Reflection 2011, but it is more
commonly found on older, slower computers. Note that beginning in
Reflection 2011, the User Guide does not list Windows XP as a
ārecommendedā platform: https://docs.attachmate.com/reflection/2011/r3/tshelp/en/user-html/install_requirements_ov.htm. Reflection Desktop 16 is only supported on Windows 7 and later.