DSPF Indicator Command Keys in AS400 RPG (… and iSeries and IBM i obviously)
Ever since my days at JBA, I’ve used the old-fashioned function key indicators to handle internal Function Keys selections, or Command Keys as they were known in the System/3x days. These PFKEY ranges from keys 1 through 24.
Most programmers used to denote a very sensible indicator range of 01-24 to match the function keys, but as the programs grew to gargantuan proportions all 99 indicators were frequently used in the programs.
CA03(03 'Indicator 3 is assigned to Function Key 3')
CA05(__ 'no indicator assigned, so use internal INK* value')
Function key indicator KA corresponds to function key 1, KB to function key 2 … KY to function key 24.
So, when modifying a huge old beast of a JBA program, written 20_ years ago I always have to ask myself if (a) the benefits of code modernization, fully refactoring the code to modern standards outweigh the ease of maintaining the code in the same style. And of course (b) if the client wants to use that old style for code continuity!
Yes that does happen. Some people actually like this old-fashioned stuff 😉
(I’m not saying a thing because the customer is always right)
So, when I am using this coding technique when modifying old JBA programs and always forget which keys match which KX letter… so here is a table for my own reference:
|Function Key Indicator||Corresponding Function Key||Function Key Indicator||Corresponding Function Key|
For example – here I added a call to a program when PfKEY(10) was pressed: