24
Sun, Nov
1 New Articles

Getting Started with Group Jobs

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

Most businesses have to find ways to improve, or they don't stay in business. Many places have suggestion boxes so that employees can recommend ways of increasing productivity or improving the working environment.

I'd like to put a suggestion into your suggestion box: use group jobs to increase the productivity of users and data processing staff!

What Are Group Jobs?

By default, an interactive job is not a group job. You can run only one job in the session. To run additional jobs, you must start other sessions. You can use the system request key to get an alternate sign-on screen, but that limits you to two jobs. You can use the jump key to get two more sessions if your terminal has a jump key, but most models don't. With PC Support and Client Access, you can use the hot key. Under OS/2 or Microsoft Windows, you can run multiple emulation sessions in separate windows, or you can just go find another available terminal. All of these methods, however, require you to sign on to the system again.

Group jobs allow you to run up to 16 distinct interactive jobs in one session; you sign on only once. (You can use the previously mentioned methods, such as the system request or jump key, to start other groups of up to 16 jobs. I reserve these for when I need to use a different user profile from my usual programmer profile.)

Each of the 16 group jobs has its own QTEMP library, library list, call stack, job log, and so forth. Issuing a Change Job (CHGJOB) command does not affect the other group jobs. The only common resource (besides the workstation, of course) is the group data area (*GDA), which you can read and modify from any group job.

Only one group job is active at a time. The rest are suspended. The Transfer to Group Job (TFRGRPJOB) command allows you to switch from one group job to another and to add new jobs to the group. It is customary to put the TFRGRPJOB command in the Attn key program so you can use the Attn key to switch jobs. Using this technique is not a requirement, but it simplifies handling group jobs.

How Are Group Jobs Created?

To change a nongroup job into a group job, use the Change Group Attributes (CHGGRPA) command.

 CHGGRPA GRPJOB(MAIN) + TEXT('Main group job') 

The current interactive job is now a group job called MAIN. The text description is not required, but it is helpful.

Now that you've changed your interactive job to a group job, up to 15 more jobs can be added to the group. You add jobs to the group with the TFRGRPJOB command. In the Group job (GRPJOB) parameter, specify a unique name (a name not already used by one of the other group jobs) for the job. In the Initial group program (INLGRPPGM) parameter, specify the name of the program you want the system to run when the group job is created.

 TFRGRPJOB GRPJOB(APENTRY) + INLGRPPGM(APC100) 

This creates a new group job called APENTRY, running program APC100 (found by searching the library list). Now, two jobs are in the group.

Besides starting the APENTRY job, APC100 sets the attention key program with the Set Attention Program (SETATNPGM) command. The attention key program runs the TFRGRPJOB command to return the user to the first group job (MAIN), when the Attn key is pressed.

Group Jobs for Programmers

Interruptions are a way of life for programmers; I often have three or more projects going on at once. Group jobs help programmers juggle the workload.

Here's an easy, yet effective, way for a programmer to use group jobs. Create CL program ATN002CL from the source code in 1.

Here's an easy, yet effective, way for a programmer to use group jobs. Create CL program ATN002CL from the source code in Figure 1.

Change your user profile to run this program when you press the Attn key.

 CHGUSRPRF USRPRF(user_profile) + ATNPGM(ATN002CL) 

Add the following code to your user profile's initial program and compile. (If you have no initial program, create a program from the following code and change your user profile's initial program to the name of the program you create.)

 RTVGRPA MONMSG MSGID(CPF1311) + EXEC(CHGGRPA GRPJOB(MAIN)) 

The above code checks to see if your interactive job is a group job, and, if it isn't, makes it a group job called MAIN.

Sign off, and then sign back on for these changes to take effect.

Now, imagine that you're working on a billing program. You have the library list set to include a test library so you won't mess up production files. You're in debug mode. You've issued some overrides and CHGJOB commands for testing purposes. Suddenly, the telephone rings. It's your boss telling you to alter a payroll program immediately.

You press the Attn key, press F6 to start a new group job, and type PAYROLL for the name and QCMD for the initial program. The system retrieves your user profile, runs your initial program, and calls up your initial menu. You set the library list for payroll, edit the payroll program, and recompile. When you're finished, you press the Attn key again, type 1 next to MAIN, press Enter, and you're back to the billing program, where everything is just as you left it.

You can add more group jobs as necessary. If you want to remove a job from the group, type the End Group Job (ENDGRP-JOB) command at a command line while that group job is active.

Group Jobs for Users

Just as you dislike interruptions, users dislike having to completely dismantle what they're doing to handle a higher-priority task. Imagine how you would feel if someone interrupted you with a request for information while you were keying vendor invoices into your accounts payable system. You'd have to suspend the batch you're keying into, navigate a few menus, start an inquiry program, look up some information, answer the request, hang up the telephone, end the inquiry program, renavigate the menus, restart the data entry job, reopen the batch, find the point where you left off, rekey any fields you had keyed on the screen when you were interrupted, and, finally, finish the transaction. This method is inefficient and causes needless frustration.

Imagine the same situation with group jobs. You are keying a transaction. The boss interrupts you with a request for information. You press the Attn key and select the group job that runs the inquiry program. After looking up the information and answering the request, you press the Attn key again, select the data entry job, and continue where you left off.

Setting Up Group Jobs

There's no one correct way to set up group jobs. 2 contains CL program INT002CL that shows one approach. Here, to keep things simple, I start five different group jobs: four display a different OS/400 menu and one signs you off. Assume that this program is your initial program, that your initial menu is *SIGNOFF, and that your profile specifies ATN002CL (see 1) as the Attn key handling program.

There's no one correct way to set up group jobs. Figure 2 contains CL program INT002CL that shows one approach. Here, to keep things simple, I start five different group jobs: four display a different OS/400 menu and one signs you off. Assume that this program is your initial program, that your initial menu is *SIGNOFF, and that your profile specifies ATN002CL (see Figure 1) as the Attn key handling program.

When you sign on, the system runs INT002CL. The first thing INT002CL does is retrieve the group job name of the job. Since the job is not a group job, the first IF statement (labeled A) proves true (&GRPJOBNAME is equal to '*NONE'). The nongroup job becomes a group job named SIGNOFF. The next command is a transfer to group job MAIN. Since there is no MAIN job in the group, this adds a new job to the group. Job SIGNOFF is suspended. If the operator transfers back (normally through the "Transfer to Group Job" panel presented when the Attn key is pressed) to SIGNOFF, the program will continue running at the next command (at label JOB_01).

The new job starts running, executing program QCMD. QCMD reads the user profile, finds that INT002CL is the initial program, and starts running it. At this point, two copies of INT002CL are running from the terminal. The first copy is in job SIGNOFF, and it is suspended just before label JOB_01. The second copy is in job MAIN. The first IF proves false, but the second one (labeled B) is true because &GRPJOBNAME is now equal to 'MAIN'. The system changes the text description of this group job, MAIN, to 'AS/400 Main Menu' and transfers to group job ASSIST. As before, this is a new group job, so the system creates job ASSIST, suspends MAIN, transfers to ASSIST, and begins to run QCMD. If you return to MAIN, execution will continue at label JOB_02.

This process continues, each group job creating the next and each running different parts of INT002CL. The last group job created should transfer to the group job you want to begin working with when you sign on. That's when you finally get a screen that allows you to do something. In this case, the last group job, DATA, transfers to job MAIN, and you begin working. You can press the Attn key at any time to see the name of the active group job, plus a list of the suspended group jobs.

When you finish working, type SIGN-OFF at a command line (if you have access to one), choose a menu option to sign off (if there is one), or press the Attn key and select the SIGNOFF group job, which will prompt the SIGNOFF command. Signing off ends all group jobs.

This program could easily be modified to become more useful. For example, instead of displaying menus, you could call application programs. The main group job might display an Accounts Payable main menu, another group job might call a vendor inquiry program, and another might call a Customer inquiry program. Whatever menus you decide to display or applications you decide to run, the important thing is that this method allows you to set up a group of jobs that you can easily transfer between.

It's Easy and It's Free

I've given you an easy way to increase productivity without buying hardware or software. Check out the OS/400 Work Management V3R1 guide for more ideas than the few I can cover here. It has a whole chapter devoted to group jobs.

The older I get, the more convinced I am that life is what you make of it. Group jobs can greatly improve the quality of office life for you and the people who depend on the computer you oversee.

Ted Holt is an associate technical editor for Midrange Computing.

Reference

OS/400 Work Management V3R1 (SC41-3306, CD-ROM QBKALG00).


Getting Started with Group Jobs

Figure 1: Attention Key Program ATN002CL

 /*==================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/ATN002CL) SRCFILE(XXX/QCLSRC) */ /* */ /*==================================================================*/ PGM TFRGRPJOB GRPJOB(*SELECT) MONMSG MSGID(CPF1310) ENDPGM 
Getting Started with Group Jobs

Figure 2: Initial Program INT002CL

 /*==================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/INT002CL) SRCFILE(XXX/QCLSRC) */ /* */ /*==================================================================*/ PGM DCL VAR(&GRPJOBNAME) TYPE(*CHAR) LEN(10) MONMSG MSGID(CPF1310) EXEC(GOTO CMDLBL(SIGNOFF)) MONMSG MSGID(CPF9999) RTVGRPA GRPJOB(&GRPJOBNAME) IF COND(&GRPJOBNAME *EQ '*NONE') THEN(DO) CHGGRPA GRPJOB(SIGNOFF) TEXT('Sign off') TFRGRPJOB GRPJOB(MAIN) INLGRPPGM(QCMD) JOB_01: ? SIGNOFF LOG(*NOLIST) MONMSG MSGID(CPF6801) /* F3 or F12 */ TFRGRPJOB GRPJOB(*PRV) GOTO CMDLBL(JOB_01) ENDDO IF COND(&GRPJOBNAME *EQ 'MAIN') THEN(DO) CHGGRPA TEXT('AS/400 Main Menu') TFRGRPJOB GRPJOB(ASSIST) INLGRPPGM(QCMD) JOB_02: GO MENU(MAIN) MONMSG MSGID(CPF9999) TFRGRPJOB GRPJOB(*PRV) GOTO CMDLBL(JOB_02) ENDDO IF COND(&GRPJOBNAME *EQ 'ASSIST') THEN(DO) CHGGRPA TEXT('Operational Assistant') TFRGRPJOB GRPJOB(USER) INLGRPPGM(QCMD) JOB_03: GO MENU(ASSIST) MONMSG MSGID(CPF9999) TFRGRPJOB GRPJOB(*PRV) GOTO CMDLBL(JOB_03) ENDDO IF COND(&GRPJOBNAME *EQ 'USER') THEN(DO) CHGGRPA TEXT('User Tasks') TFRGRPJOB GRPJOB(DATA) INLGRPPGM(QCMD) JOB_04: GO MENU(USER) MONMSG MSGID(CPF9999) TFRGRPJOB GRPJOB(*PRV) GOTO CMDLBL(JOB_04) ENDDO IF COND(&GRPJOBNAME *EQ 'DATA') THEN(DO) CHGGRPA TEXT('Files, Libraries, and Folders') TFRGRPJOB GRPJOB(MAIN) INLGRPPGM(QCMD) JOB_05: GO MENU(DATA) MONMSG MSGID(CPF9999) TFRGRPJOB GRPJOB(*PRV) GOTO CMDLBL(JOB_05) ENDDO /* If you want to let the user start new jobs, + activate the following RETURN command, + otherwise new jobs will be signed off immediately */ /* RETURN /* Go to initial menu specified in user profile */ SIGNOFF: SIGNOFF LOG(*LIST) ENDPGM 
TED HOLT

Ted Holt is IT manager of Manufacturing Systems Development for Day-Brite Capri Omega, a manufacturer of lighting fixtures in Tupelo, Mississippi. He has worked in the information processing industry since 1981 and is the author or co-author of seven books. 


MC Press books written by Ted Holt available now on the MC Press Bookstore.

Complete CL: Fifth Edition Complete CL: Fifth Edition
Become a CL guru and fully leverage the abilities of your system.
List Price $79.95

Now On Sale

Complete CL: Sixth Edition Complete CL: Sixth Edition
Now fully updated! Get the master guide to Control Language programming.
List Price $79.95

Now On Sale

IBM i5/iSeries Primer IBM i5/iSeries Primer
Check out the ultimate resource and “must-have” guide for every professional working with the i5/iSeries.
List Price $99.95

Now On Sale

Qshell for iSeries Qshell for iSeries
Check out this Unix-style shell and utilities command interface for OS/400.
List Price $79.95

Now On Sale

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: