AKA Command Line Access from System Request 3
If you are an IBM I software developer or power user – then that headline will make sense. In fact, I can guarantee that’s the only reason you discovered and are reading this page. System Request 3 makes every RPG programmer twitch 3 fingers ready to reach those buttons on the keyboard.
If the phrase “sys req 3” means nothing to you then *cough* don’t read any further. #NothingToSeeHere #MoveAlongMoveAlong
Invoke WRKJOB from SYSRQ/3
By default IBM i shows you DSPJOB when you do a System Request 3 – sometimes its useful to get command line access from this (especially when debugging programs) and its simple to do by changing the system default from DSPJOB to a WRKJOB. Of course, limited capability users wont know the difference but users with command line access can now party.
The value that is invoked when you press the System Request function key (ie: SHIFT ESC) is stored in QCPFMSG
WRKMSGD MSGID(CPX2313) MSGF(QCPFMSG)
You COULD change this message description – not a good idea since it’s a system wide change and you need hefty authority to change a system supplied object – and it would immediately invoke the command defined at that position from the SysRq Menu.
But – much preferred solution is to create a new Message file in your library and use OVRMSGF during your login routine.
So try this:
CRTMSGF MSGF(YOURLIB/OVRMSGF) TEXT('Message file with changed CPF messages')
Now we need to add a duplicate of the message that we want to change. For this message (CPX2313) we could add it using the EDTMSGD tool from Projex4i like this:
PROJEX4I/EDTMSGD MSGID(CPX2313) FILE(QCPFMSG) COPY(*YES) COPYFILE(OVRMSGF)
Or if you dont have Projex4i installed (and why not?) then you can try it manually like this:
ADDMSGD MSGID(CPX2313) MSGF(YOURLIB/OVRMSGF) MSG('ENDRQS WRKJOB DSPMSG SNDMSG SIGNOFF DSPMSG DSCJOB DSPWSUSR ENDRDBRQS') SEV(0) ALROPT('*NO')
NOTE: the second command option is sysrq/3 – changed from DSPJOB to WRKJOB
Next add a line to your signon program saying
OVRMSGF MSGF(QCPFMSG) TOMSGF(YOURLIB/OVRMSGF) SECURE(*YES)
Here is a super simple example of a signon program
/* - SIMPLE SIGNON PROGRAM ---------------------------------- */ /* Super Simple - Proof of Concept to show how easy it is to */ /* change system messages per user */ /* ---------------------------------------------------------- */ PGM MONMSG MSGID(CPF0000) /* Global monitor because we + dont like to see error messages during signon */ OVRMSGF MSGF(QCPFMSG) TOMSGF(LITTENN/OVRMSGF) SECURE(*YES) CALL PGM(QCMD) RETURN ENDPGM
Obviously you will need to change your signon for your user to point at that:
Then when you signon you can edit your message file and see the result immediately. If you have it set to DSPJOB you will see a DSPJOB when you press SysRq/3, if you change it to WRKJOB you will that. Be careful to keep the equal distant spacing in the message.
Obviously – you could make these system request options call any other command if you wish.