Problem solve Get help with specific problems with your technologies, process and projects.

Keep on top of users' changes

Use the CHANGE keyword to indicate when an input-capable field is changed.

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:
     00010A          R REC1 
     00020A                                      CHANGE(88 'A field was changed') 
     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:
     00010A            FLDX           5   B  8  2CHANGE(67 'FLDX was changed') 
     00020A            FLDY           3   I  8 30CHANGE(68 'FLDY was entered') 

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.


Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.