You're probably familiar with creating traditional "Work With" style panels. You may add several fields that act as filters to assist the user in selecting his records. Many times you place a function key on the screen so the user can refresh the subfile.
In DDS there is a keyword of "CHANGE." That keyword applies to the record level and field level. When used, if the contents of an input-capable field are changed, the indictor you selected comes on. Below is the sample code from the IBM Web site.
Record level: |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00010A R REC1 00020A CHANGE(88 'A field was changed') 00030A* 00040A FIELD1 10 B 3 2 00050A FIELD2 5 B 5 2 00060A FIELD3 6 B 7 2 00070A FIELD4 3 I 9 2DFT('ABC') Field level: |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00010A FLDX 5 B 8 2CHANGE(67 'FLDX was changed') A 00020A FLDY 3 I 8 30CHANGE(68 'FLDY was entered') A
Since I use "F5" (CA05) to refresh the screen and I use indictor "05" on the change keyword, my program reloads the subfile when the user enters new search criteria or if he hits the "F5" key.
The change keyword is very handy if you want to refresh or reload a screen, but beware of how it reacts. If the user re-enters the exact same information into the field, the change indictor still comes on. It does not keep track of what was displayed, only that the user performed an edit in the field.
Also, the CHANGE response indicator is not set on when a command attention key (CAnn, Help, Print, Home or Clear) is pressed. When the OS/400 program detects validity checking errors and displays the record again with an error message, any CHANGE keyword response indicators that have been set on by typing into fields remain on until all validity checks succeed and the record is passed to your program.
The optional text is included on the list created at program compilation time. The text has no function but to explain the intended use of the indicator.
This is a simple way to automatically refresh your "Work With" screens and save the user a keystroke in the process.
About the author: John Kohan is a senior programmer analyst at CT Codeworks. He is also an adjunct instructor teaching AS/400 classes at his local state collage. As one of search400's site expert John also participates in our Ask the Expert feature. If you have a question for him, you may submit it.
- The Best Web Links on Development: Tips, tutorials and more.
- Ask your programmer questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our programmer gurus are waiting to answer your technical questions.
- What do you think of this tip? Send us your comments -- good or bad -- at firstname.lastname@example.org