RAMP-TSAD03 Step 4. Generic Handler Association
In the initial step of this tutorial you created a specific association between your 5250 field and the special field handler DF_PRM04 like this:
This means that on any 5250 screen containing a field with this name the handler DF_PRM04 is called.
So by using a naming convention you can instantly add prompting to any 5250 screens that have a field with this name on them.
This type of specific association is most useful on key fields (like CustomerNumber, ProductNumber, etc) and code fields (like StateCode, CurrencyCode, etc). For key fields you can often associate a handler that allows the user to search in many different ways to locate a customer or product. For code fields you can often display the code/decode table allowing the user to select the code they want to use.
You can also create generic associations:
Here:
- Fields starting with the name DATE_ will cause HANDLER1 to be invoked when F4 is used.
- Fields starting with the name CODE_ will cause HANDLER2 to be invoked when F4 is used.
- Fields starting with the name CUST_ will cause HANDLER3 to be invoked when F4 is used.
If HANDLER1 was a date picker, then you can see how by using a naming standard for your fields you can instantly associate HANDLER1 with any date fields on your 5250 screen.
(Note that you can also create date handlers, drop-downs etc. using aXes eXtensions. For an introduction to aXes, see RAMP-TSAD04: Redesigning the Screen Using aXes ).
Likewise, HANDLER2 might substring off the rest of the prompted field name (eg: CODE_STATE, CODE_CURRENCY or CODE_AIRPORT) and be able to work out which code table (States, Currencies or Airports) it should display for selection. This type of "super-prompter" is commonly used because, while the data source changes (ie: which code table is displayed) the method of displaying and selecting the code is usually identical.
In the final example, CUST_* demonstrates a generic type of special field handler that does something special, presumably with a "CUST" (customer).
The things it does could range from name searching, to printing details, to pasting screen values to the clipboard, to mapping customer into a MS-Excel document, to preparing an e-mail to the customer. This is why special field handling is a lot more than simple F4 prompting.
Special field handling is about attaching new behaviors to existing 5250 screens. By combining the special field handling table with a judicious naming standard you can attach new behaviors to many 5250 screens with no coding.
In these examples the naming standard chosen is used to communicate intention and information to the handler. There are also more precise ways of communicating intention and information to handlers. These are discussed in the later steps of this tutorial.