Wednesday, February 27, 2008

Secrets of CA and CF indicators:

The CF and CA keywords are used in display files to enable function keys. CF01 and CA01 both enable the F1 key on your keyboard. The difference is that a CF (command function) key updates the fields in your program, while a CA (command attention) key does not.

A CA key also bypasses any field editing. For example, if you enter a bad value into a field that has the VALUES keyword specified in the DDS and then press a CF key, you will get an error, and the screen will not be returned to the program because the field doesn't pass validation. If, on the other hand, you hit a CA key, the editing is bypassed, and the CA key is returned to the program (although the fields are not). The best use for CA keys is keys that exit a screen without updating data--typically, CA03 or CA12 in iSeries applications.

If you define CF01 or CA01 in your DDS, and the user hits the F1 key, then the *INKA indicator is turned on in your program. You can, however, specify an additional indicator to be used, by using a syntax such as CF01(01). With this keyword, F1 will turn on both *INKA and *IN01. There is no hard and fast relationship; if you specified CF01(22), F1 would turn on both *INKA an *IN22.

The indicators (*INKA through *INKY) are turned either off or on with each READ or EXFMT, depending on which function key the user pressed. Thus, there should never be more than one *INKx indicator on, and often none are on (if the user hits Enter or if one of the non-command keys is enabled, such as PageUp or Help).
Finally, any indicators specified in the DDS in the syntax CF01(nn) are set based on the setting of the associated command key.

No comments: