Hi All, I have seen many places where CA/CF (Command attention and command function) functionality is mixed. So lets understand this with example.
CA -- Command Attention ( Function Key response will be accepted and returned back to RPG program)
CF -- Command function (Function key response will be accepted and returned back to RPG program)
The difference we can check only if there is an input field on screen. With function key indicator set as CA no value typed in input field is returned to RPG program, while if we define function key indicator as CF value typed in input field also returned to RPG program.
Consider the below example : I have a input field with name SCRFLD as name and two function key as CA12 and CF03.
Source code for display file ::
CA -- Command Attention ( Function Key response will be accepted and returned back to RPG program)
CF -- Command function (Function key response will be accepted and returned back to RPG program)
The difference we can check only if there is an input field on screen. With function key indicator set as CA no value typed in input field is returned to RPG program, while if we define function key indicator as CF value typed in input field also returned to RPG program.
Consider the below example : I have a input field with name SCRFLD as name and two function key as CA12 and CF03.
Source code for display file ::
*************** Beginning of data
*************************************
0000.30 A DSPSIZ(24
80 *DS3)
0000.40 A CF03(03
'Exit')
0000.50 A CA12(12
'Previous')
0000.60 A
R RECORD
0000.80 A 7
19'Name'
0000.90 A SCRFLD 6A
B 7 26
0001.00 A 16 20'F3 =
Exit'
0001.10 A 16
32'F12=Cancel'
****************** End of data ****************************************
When you type Name = Test on screen and press F3. Test will come back to Program. while pressing F12 alone will return the indicator as on and Name field will be blank.
RPG code will be like ::
RPG code will be like ::
FCACFTRY CF E workstn
Dname S 6
C
/free
EXFMT Record;
name = SCRFLD;
IF *IN03 = *on;
DSPLY name;
endif;
if *in12= *on;
dsply name;
endif;
*inlr = *on;
/end-free
I hope it is clear how to use CA/CF indicators.
Dname S 6
C
/free
EXFMT Record;
name = SCRFLD;
IF *IN03 = *on;
DSPLY name;
endif;
if *in12= *on;
dsply name;
endif;
*inlr = *on;
/end-free
I hope it is clear how to use CA/CF indicators.