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

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

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

    >