24
Sun, Nov
1 New Articles

WRKACTJOB: The AS/400's Information Center

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

To me, the single most important command on the AS/400 is the Work with Active Jobs (WRKACT-JOB) command. Why? By using this command, you can observe just about anything that you need to know about what goes on inside your AS/400. One of the first things I do every morning (after I get my cup of coffee) is to take a look at what is running (or not running) on my AS/400. Did anything get hung up the night before? Are all the servers, such as email and HTTP, active? Do any jobs have messages that need a reply? All of these questions can be answered by using the WRKACTJOB command.

Eight Parameters to Choose From

Before I jump into the WRKACT-JOB display, let me tell you about the parameters for the command. To see the parameters, enter WRKACTJOB on the command line and press the F4 key. Then, press F10 to display all the parameters. There are eight parameters available that control how data is displayed.

The first option available, PRINT, determines whether output should be directed to the screen (*) or to a print file (*PRINT).

RESET determines whether or not the job statistics are reset. If you are watching performance information, it is a good idea to reset the statistics from time to time because the numbers are calculated over long time spans.

Next is the Subsystem (SBS) parameter. I like to use this parameter when I am interested only in jobs on one subsystem. For example, WRKACTJOB SBS(QSYSWRK) displays only the active jobs in the QSYSWRK subsystem. This parameter saves me the hassle of paging through hundreds of jobs that I am not interested in.

The CPU percent limit (CPU-PCTLMT) parameter filters out all active jobs with a CPU percentage less than the value specified. This parameter is useful if you are trying to find a job that is hogging CPU resources.

Response time limit (RSPLMT) is used to eliminate jobs below a certain response level. The response level is simply the average amount of time it takes to complete an interactive request. This parameter is good for finding jobs experiencing long wait times.

The Sequence (SEQ) parameter determines the order in which jobs are listed. The default is to list jobs by subsystem.

JOB is used to select active jobs by job name. Wild cards such as QPADEV* can be used on this parameter.

Finally, there is Automatic refresh interval (INTERVAL). This parameter is used in conjunction with a command key on the WRKACTJOB display and is discussed later.

Let’s See the Jobs, Already!

Now that you know how to choose what you want to see, it’s time to look at the display. As you can see in Figure 1, the WRKACTJOB display is divided into four sections. The first section, at the top of the screen, displays information about the state of the system as a whole. This information gives you a snapshot of what goes on under the hood by providing statistics such as CPU usage and the number of jobs running.

So Many Options, So Little Time

The second section displays the options available for working with jobs. (Press F23 to toggle between the options.) There are 13 options that cover almost everything you need for managing work on your AS/400.

The most widely used option is probably number 5. This option executes the Work with Job (WRKJOB) command and provides a substantial amount of information about what goes on behind the scenes. Once option 5 is selected, a screen appears that offers even more options. There are too many of these additional options to highlight them all, so I am going to talk about the ones that I think are most important:

• Option 1: Display job status attributes. This option displays a screen that shows when a particular job entered the system and how long it has been running. I use this screen to help in determining whether or not a job has been running an abnormally long period of time.

• Option 2: Display job definition attributes. The job definition describes how a particular job was submitted. Is it batch or interactive? What job queue did it come from? What priority level is the job running at? All of these questions can be answered by looking at option 2.

• Option 4: Work with spooled files. I use this option to spy on certain jobs that produce multiple spooled files. If I’m familiar enough with the job running, I can usually tell how far along the job is by looking at what spooled file is being created.

• Option 10: Display job log. Job logs are invaluable on the AS/400. Many times, if a job has a problem, the only way to uncover what went wrong is via the job log. Reading job logs takes practice, but it is well worth the effort because the detail they provide is second to none.

• Option 11: Display call stack. Displaying the call stack is a good way to figure out whether or not you can recover from a program failure. My favorite trick is to call all RPG programs from CL programs because RPG doesn’t allow the retry option but CL does. If the RPG program has an error, I simply cancel it to jump back a level in the call stack. I then fix the RPG code and do a retry from the CL. Although this technique won’t work in every situation, it has saved me on more than one occasion. Another thing the call stack is good for is indicating what program is producing the error when a user can’t explain an error situation.

• Option 13: Display library list. This option shows the library list that the job is currently using. Many times, it’s not clear why a job is not executing properly or why files are not getting updated correctly. Sometimes it’s as simple as not having the library list set up properly. By using this option, you can see exactly what library list the job is using in order to determine if that is the problem.

• Option 14: Display open files. All jobs’ open files are displayed when this option is selected. A neat trick here is using the F11 key to display all the I/O statistics for a file. What good is this? Simple. If a job is stuck in a loop, chances are that when you press F5, the relative record numbers do not change because the job is either reading the same record

over and over or reading nothing at all. If this is the case, you can generally confirm your suspicions by displaying the call stack and refreshing the screen several times. If the job is looping, you will see the same statements being executed over and over again.

Another widely used option on the WRKACTJOB display is option 7 (Display messages). When a job encounters an error, it generally sends a message to the system operator and waits for a reply. Option 7 allows you to display the message and respond to it as desired. I find this more convenient to do from the WRKACTJOB screen because I can get all the information I need on fixing, analyzing, and responding to the problem in the same place.

If the runtime attributes of a job (priority, time slice, etc.) need to be changed, option 2 is used. This option runs the Change Job (CHGJOB) command on the selected job.

Option 8 allows you to work with a job’s spooled file. As mentioned earlier, this is a good way to spy on the progress of a job.

Finally, option 4 allows you to end an active job.

Jobs on Display

In the third section of the WRKACTJOB display, there are three views that you can toggle between by using the F11 key. The default view shows job status data, such as the name, the user who submitted the job, and the job’s CPU percentage. The two most important pieces of data are the status and the CPU percentage. A status of MSGW (message wait) means that the job has a message that needs a response. (If you place your cursor on the status column and press F1, an online help screen will show all the statuses and their meanings.) The CPU percentage shows the amount of CPU resources the job is using. This can be valuable information for discovering “runaway” jobs that do nothing but drain your machine’s resources. When relying on the WRKACTJOB display for CPU percentage, it is important to use F10 throughout the day to restart the statistics. The reason I say this is that the stats are cumulative, and if you check them early in the morning and then late in the day, you will be looking at many hours of data.

The next view available shows the elapsed data. This display is useful for hunting down system killers such as power query users and programmers who, like me, compile programs interactively. Generally, these users show high response times and large amounts of auxiliary I/O operations. This view gives you the power to put them out of business!

The final view shows thread data but is really useful only if you are using multithreaded languages such as C or Java.

Just What Is Your Function, Anyway?

The last section of the screen displays the available function keys. (Use F24 to toggle among them.)

Personally, the one I use most is F5, which refreshes the screen. This key updates the display so you can tell whether or not a batch job has finished, a user has signed off, or a subsystem has ended.

The F7 (find) key adds another powerful function to your arsenal. When F7 is pressed, a window appears that allows you to enter a search string and the type of attribute to be searched. You can search by job name, user name, job number, etc. Once the search is completed, the screen is repositioned to show the job you were searching for. (The F8 key is used to repeat the search.) This is an extremely useful feature on large systems because it saves you the trouble of having to page through thousands of jobs to find what you’re looking for.

The final command key that I want to discuss is the F19 (start automatic refresh) key. Way back at the beginning of this article, I mentioned that one of the parameters for the WRKACTJOB command is an interval. If a time interval is specified and F19 is pressed, the screen automatically refreshes at the time interval selected. Using this feature

eliminates the need to keep pressing the F5 key. (Pressing F19 again will turn off the automatic refresh.)

You’ve Just Scratched the Surface

As you can see, the WRKACTJOB command is packed with features. It also uses a lot of AS/400 resources, so if you have response concerns, use the command sparingly. There are so many features that I can’t fit them in the space provided. If you haven’t done so already, take a few minutes to play with the command’s options. There is a wealth of data that can be uncovered by this command, and that is why it is truly the AS/400’s information center.

Reference

OS/400 Work Management V4R4 (SC41-5306-03, CD-ROM QB3ALG03)


Figure 1:The WRKACTJOB display is divided into four sections.





WRKACTJOB-_The_AS-_400s_Information_Center04-00.png 597x335
DAVID MAYLE
Dave Mayle is a senior developer for Eaton Corporation, a global leader in electrical systems and components for power quality, distribution, and control. Dave has worked on the iSeries/System i since 1993 and is currently focused on developing Java, Web, and ILE applications. Dave has written numerous technical articles on the iSeries and is a three-time Speaker of Merit award winner at COMMON. Dave is a graduate of Bucknell University and can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it.
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: