Programmer in a Box
Programmer in a Box ®
Home of your AS400, iSeries and System i experts!
Instant Selection Window         Home

The Instant Selection windows allow you to choose file data from a list rather than relying on memory, paper lists, or separate prompting programs. The selected record data is returned in whole or in part to the calling program. Use the Instant Selection Window as a tool for field level prompting which is achieved by placing the cursor in a input field and pressing a function key or by using a prompting character such as "?". A subroutine executes invoking a predefined window group. Use the 'position to' field and scroll through the list of formatted file data to locate a particular record. When you make a selection from the window, the record is passed back to the calling program for internal usage. You can also define a window to return only specific fields from the selected record.

Another use of the Instant Selection Window tool is record verification and retrieval. You would traditionally use a direct record access from within the program to edit a specific field for a field validation. This can create excessive overhead especially if there are many files open. With the window in verification mode, you can key in the name of the record you wish to verify. If the record exists, it is then passed back to your program. You can also load this data into an externally defined data structure to access the fields without ever opening the file in your program. When using verification mode you can make the window appear even when invalid keys are sent to it. This allows you to select valid data without interrupting program flow. Confirmation mode is similar but it does not pop up a selection window if the keys passed are invalid.

This tool requires some coding, just as you would have to so if you were using a different program for each prompt. The difference is you will use a standard call every time you access the Instant Selection Window System. Standardized parameters are passed from the calling program and interrogated upon return. These parameters can be manipulated by the programmer to produce different results.

For example, the title displayed in the window can be sent with the parameters allowing you to change it instantly. Use this feature when you want to step through a selection process from high level data toward more detailed data.

Imagine locating detailed billing information about a customer. The first window called displays the customer file. Set the entry parms to use the predefined customer file window group with a Search by Name window first. As this call takes place a selection window is presented. If you need to locate the customer by customer number rather than name, press a key to display a list of alternate sorts available for the customer file. After you have made a selection from one of the sorts, the data is returned to the program. Then extract the data passed back and use it to locate data in the detail billing file. Call the standard window display subroutine. Set the entry parms to call a Detail Billing File window group by customer number. You can format the title to the window by concatenating the customer's name and number into the title text and sending it to the window. This gives your windows a customized look with very little additional coding on your part.

High quality results can be achieved by using the Instant Selection Window to standardize the way in which you program. Predefined subroutines are used throughout the system and once the code is in place in the calling program, the system takes over until you make a selection or exit. From here you define all aspects of a window from what file is accessed to what data is returned. You can use the window information as soon as you enter it. The definitions are used by the Instant Selection Window System to display the data. You can create individual windows or groups of related windows.

As you can see, the Instant Selection Window System is a powerful programming tool that will save you time and allow you to be more creative.


All content copyright ©1995, 2008, Davis Software Services, Inc. All rights reserved.
AS/400 is a registered trademark of IBM.