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 |
---|---|---|---|
KA | 1 | KM | 13 |
KB | 2 | KN | 14 |
KC | 3 | KP | 15 |
KD | 4 | KQ | 16 |
KE | 5 | KR | 17 |
KF | 6 | KS | 18 |
KG | 7 | KT | 19 |
KH | 8 | KU | 20 |
KI | 9 | KV | 21 |
KJ | 10 | KW | 22 |
KK | 11 | KX | 23 |
KL | 12 | KY | 24 |
For example – here I added a call to a program when PfKEY(10) was pressed:
YUCK. Numbered/Lettered indicators? Please tell me you only still use those with old JBA crap.
LOL. I know, right… but the customer wants to maintain the code as it is. I am but their humble servant 😉
I don’t think you should be sharing this content. If anyone is maintaining old programs like this, they already have their own chart.
If you don’t share the dirty side of legacy code maintenance, the dodgy old RPG2, RPG3 and RPG400 programs, the even dodgier IT professionals who deliberately use the wrong name for their IBM i system (an “iSeries” or arguably worse “The 400”) then the RPG noobs won’t know what a weird world of software they are stepping into 😉