Eliminate Unwanted Printer Writer Job Logs
If you would like to reduce the amount of job logs generated on your system and see no need for logging printer writers, use the following command to eliminate the logging of all printer writers:
CHGJOBD JOBD(QSPLPRTW) LOG(0 99 *NOLIST)
- Fred Skinner
Routing Workstation Printkeys
You can route the printed output of screen prints created at a terminal to go to a specific printer regardless of the print device defined in the user profile. First create a print file using CRTDUPOBJ. Then change the printkey printer file for the display in the device description, as follows:
CRTDUPOBJ OBJ(QSYSPRT) FROMLIB(QSYS) OBJTYPE(*FILE) + TOLIB(xxx) NEWOBJ(PRTFNAME) CHGPRTF FILE(xxx/PRTFNAME) DEV(PRTR_DEV_NAME) CHGDEVDSP DEVD(DEVNAME) PRTFILE(xxx/PRTFNAME)
- Fred Skinner
Changing Interactive Job Time Slice
The default class description used for interactive jobs is QINTER and its time slice value is 2000 (2 seconds). For almost all interactive workloads, 2 seconds is acceptable, because interactive transactions should not last longer than 2 seconds. However, there are cases (e.g., during heavy interactive workload) where lowering the time slice to 500 (.5 seconds) may improve performance. Consider setting interactive job time slice to .5 seconds or less on AS/400s with faster processors, such as the B60 and up.
- Fred Skinner
Activating an Attention Key Program
A quick and dirty Attention key program useful for programmers is QSYS/QCMD. Or if you prefer the windowed variety, try QSYS/QUSCMDLN available with V2R1. While obviously not suited for end users, for programmers it sure beats not having any Attention key program defined.
To activate an Attention key program, specify the qualified program name in the ATNPGM parameter of the CHGUSRPRF command.
- Douglas Handy
Job Queue Gridlock
To find out what active jobs are keeping jobs in a job queue from beginning execution, use the following command:
WRKUSRJOB USER(*ALL) STATUS(*ACTIVE) ASTLVL(*BASIC)
You can limit the jobs you see by user and status. Specifying the assistance level *BASIC lists the job queues and the jobs that started from them.
- Bryan Leaman
Turn Your Job into a Group Job
It is possible to harness the power of group jobs with the use of the Attention key in one simple CL program. This program lets a user profile start a new group job or transfer to an existing group job by just pressing the Attention key. Specify this program as the Attention key handling program on your user profile.
When the Attention key is pressed the first time, the current job is made into a group job. The TFRGRPJOB command can then be used (F6) to create another group job by using a new group job name. Defining QCMD as the initial group routing program means that the user profile options are used and any initial program is called. (There is no need to use the SETATNPGM command.) On subsequent use of the Attention key, the user can start another group job or transfer to an existing one.
PGM DCL VAR(&GRPJOB) TYPE(*CHAR) LEN(10) RTVGRPA GRPJOB(&GRPJOB) IF COND(&GRPJOB = *NONE) THEN(DO) CHGGRPA GRPJOB(GRPJOB1) TEXT('1st Group Job') ENDDO TRFRGRPJOB GRPJOB(*SELECT) INLGRPPGM(QSYS/QCMD) + TEXT('Another Group Job') ENDPGM
- Ray Weekes
Quick Job Log Display
When testing CL programs, if the job attribute LOGCLPGM is set to *YES, then CL commands are visible from Command Entry. If you press F10 for low level messages, these can be displayed and retrieved. This is very useful when debugging an OPNQRY string that builds at run-time. The actual substituted string is shown, and by placing the cursor on the displayed string and pressing F9 to retrieve, the command can be tested with different variables in place.
- Kevin Heiman
What Job Queue Did This Come From?
Sometimes two job queues submit jobs to one subsystem and WRKACTJOB shows both jobs. When this happens, you might want to know which job queue they were submitted from. You can find out from the WRKSBSJOB screen by performing the following sequence: option 5 (Display Job); option 10 (Display Job Log); F10 (Display Detailed Messages); F17 (Top). Then press the Help key on the line that has "Job 999999/xxxxxx/zzzzzz submitted" (999999 = job number, xxxxxx = user profile, zzzzzz = job name) and the job queue will be shown.
- Tom Lucht
Monitoring Job Completion Messages
If you would like to access your completed job messages without having to look for them with a DSPMSG command, and you do not want the annoyance of break messages interrupting your current work, try this message handling program.
MONMSG CL Program PGM PARM(&MSGQ &MSGQLIB &MSGK) DCL VAR(&MSGQ) TYPE(*CHAR) LEN(10) DCL VAR(&MSGQLIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSGK) TYPE(*CHAR) LEN(4) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(132) RCVMSG MSGQ(&MSGQLIB/&MSGQ) MSGKEY(&MSGK) RMV(*NO) + MSG(&MSGDTA) SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&MSGDTA) + TOPGMQ(*EXT) MSGTYPE(*STATUS) ENDPGM
After compiling program MONMSG, execute the following command to cause your completion messages to appear unobtrusively as status messages at the bottom of your screen. You might add this command to your initial program or setup routine.
CHGMSGQ MSGQ (current completion message queue) + DLVRY(*BREAK) PGM(MONMSG)
It works by changing a message queue to *BREAK delivery mode and specifying a message handling program. This will cause OS/400 to call the MONMSG program each time a message arrives at the message queue. MONMSG will then send the message to the external program message queue.
- Bill O'Toole
Flush Clean Your Program Stack
All AS/400 users that have access to a command entry line can execute a command that has a command line, execute another command from that command line, execute another command, ad infinitum.
In my shop we have seen the system operator use WRKACTJOB, WRKSPLF, WRKSBMJOB over and over without pressing F3 to exit. The operator just keeps keying in the command he wants on the command line. We finally noticed this when canceling a job at the console and we saw that it ended at level 65!
This nesting of invocations has a deleterious effect on AS/400 performance, especially when it occurs at the system console. The reasons for this are simple:
More main storage is consumed.
More disk activity occurs when the job is paged in or out.
OS/400 does more work to maintain the integrity of the program stack as it increases.
At the console, this extra work occurs at a higher run priority (10).
The Reroute Job (RRTJOB) command entered at a command line with no parameters brings the interactive job back to its original level. Put another way, the job returns to the level it was at just after sign-on.
Note: Be aware that if your user profile has an initial program assigned to it, the program will be called when RRTJOB is executed. You may need to modify the initial program to allow it to be called repetitively.
- Steve Kontos