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
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.
IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.
What is AS400 modernization?
IBM i ACS 5250 EMULATOR FONT – and other ridiculous mumbo jumbo
IBM i SQL statement to convert or compare hundred year date format
How to compare ‘100 Year Date’ to a Timestamp – aka – Weird AS400 iSeries Date formats
Modernize AS400 iSeries Queries – Convert to IBM i SQL
Use IBM i SQL to validate email addresses in Customer Master File
Set off all RPG Indicators in a program
Better performance for re-entrant programs aka reduce static storage
Free RPG Editor – ILEDITOR could be called RDi Lite ;)