Function Key Indicators – *INK CMD KEYS in AS400 RPG

  • Home
  • /
  • Blog
  • /
  • Function Key Indicators – *INK CMD KEYS in AS400 RPG

March 9, 2022

Function Key Indicators – *INK CMD KEYS in AS400 RPG

By NickLitten

March 9, 2022

Function, Indicator, RPG

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 IndicatorCorresponding Function KeyFunction Key IndicatorCorresponding Function Key
KA1KM13
KB2KN14
KC3KP15
KD4KQ16
KE5KR17
KF6KS18
KG7KT19
KH8KU20
KI9KV21
KJ10KW22
KK11KX23
KL12KY24

For example – here I added a call to a program when PfKEY(10) was pressed:

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
    • 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 😉

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Join the IBM i Community for FREE Presentations, Lessons, Hints and Tips

    >