AS/400 Group Jobs

1150 pts.
AS/400 jobs
Hi, Can anybody tell me what a group job is, with a good example ?



Software/Hardware used:
AS/400 V5R4

Answer Wiki

Thanks. We'll let you know when a new response is added.

You may want to run a totally different job, lets say some kind of an update or fix it kind function, but the current job has files opened (for input only) that may not be compatible with that update function you want to run. You can then start up a group job, which begins a totally seperate job. The *GDA (Group job *DTAARA) can be used to pass parms to the group job. You can leave the group job and continue in the original job right where you exited.

But I think you could also call a job and have it start a new activation group and basically do the same thing…. So my question is … what are the differences between starting up a group job and starting a new activation group.


Quick “Group Job” lab exercise:

<li>Sign on to two separate, fresh sessions. In the first, make sure you’re at the system MAIN menu. In the second, run WRKSBS and enter option 8 against your interactive subsystem so that you can see your first session job. (The following steps are for job #1 unless otherwise noted.)</li><li>Enter TFRGRPJOB. Review the error that should appear. (If no error appears, then this isn’t a truly “fresh” session. It’s already been set up as a group environment.)</li><li>Enter CHGGRPA MAIN. (Nothing visible should happen.)</li><li>Enter TFRGRPJOB. Review the error that should appear. (It should be different from the first error.)</li><li>Enter TFRGRPJOB CMDLN INLGRPPGM(QSYS/QUSCMDLN). (You should see the system command window.)</li><li>In job #2, press <F5=Refresh>. (You should see a secondary ACTIVE process under your original session job. The first process should have status GROUP.)</li><li>Enter TFRGRPJOB USER INLGRPPGM(QSYS/QUSCMDLN). (It should appear as if nothing changed.)</li><li>In job #2, press <F5=Refresh>. (You should see a third process has become ACTIVE. Both of the other processes are status GROUP.)</li><li>Enter GO USER. (The User Tasks menu should appear.)</li><li>Enter TFRGRPJOB. (You should see the earlier system command window display reappear.)</li><li>In job #2, press <F5=Refresh>. (You should see that the second process has gone ACTIVE while the others are GROUP.)</li><li>Enter TFRGRPJOB. (You should see the User Tasks menu reappear.)</li><li>Enter TFRGRPJOB MAIN. (You should see your original MAIN menu reappear.)</li><li>Enter TFRGRPJOB *SELECT. (You should see a list appear. You can choose to transfer to CMDLN or USER.)</li><li>Select CMDLN. (Your command window should reappear.)</li><li>Press <Enter> or <F3> or <F12> to drop out of the QUSCMDLN program. (You should see the MAIN menu reappear.)</li><li>Enter TFRGRPJOB *SELECT. (You should see the previous list reappear, but CMDLN has been removed.)</li><li>In job #2, press <F5=Refresh>. (You should see that the second process has disappeared.)</li><li>Press <F6=Start a new group job>. Enter OASSIST for Group Job, and QEZMAIN for Initial group program. (You should see the Operational Assistant menu appear.)</li>

The idea is that each workstation “session” can manage up to 16 separate sub-jobs — these are called “group jobs” since they exist as a related group.

You enable group jobs with CHGGRPA. You create (or transfer between) group jobs with TFRGRPJOB. You end group jobs by ending the initial group job program or with ENDGRPJOB.

The TFRGRPJOB command is slightly related to the TFRSECJOB command, which switches between primary and secondary jobs in a workstation session. Since those two sides of a workstation session can each handle 16 group jobs, you can have up to 32 ‘jobs’ going within a single ‘session’. You can’t directly transfer between group jobs that are not in the same primary or secondary job.

“Attention” programs are sometimes used to present menus that control which group jobs may be created by individual users. (A group job initial program perhaps would start by retrieving and saving any current attention program and assigning the attention program for group jobs.)

There are plenty of functional details. It takes practice to code programs that work well within group jobs without stepping on each other. Object locks can cause trouble for example.

But you can also present some handy utilities for users (or yourself.)

If I messed up anything in the series above, feel free to update it or post a comment and I’ll do it.


Discuss This Question: 4  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ten2008
    Hi Tom, thanks a lot.Very good example. I understood the concept here but if you come up with one realtime example i will be glad. I remember i was working with some group jobs a long time back, but don't know the importance of them. regards
    1,150 pointsBadges:
  • Vatchy
    Group jobs were great when programmers had only a green-screen terminal to work on. The terminal limited you to, at most, three sessions and usually only one or two. Having group jobs allowed you to have multiple sessions within one terminal session. You could, for instance, debug a program in one group job and then switch to another group job in order to make changes to your source. I wrote a program to allow me to use the attention key to switch between two group jobs and then enhanced it to be a menu to allow me to start and switch to multiple group jobs. I created a group job whose initial command was to WrkMbrPdm for RPG, another one for DDS and a third one for CL which allowed me to switch between them without having to end editing one in order to start editing another.
    1,415 pointsBadges:
  • TomLiotta
    @Ten2008: I don't really have any "good" examples. These usually are very individualized and useful only to the system where they're created. For example, I might create an attention program that lists a menu of utilities or mini-apps. The menu will either jump to the group job of the selected option or simply transfer to an existing one if it already exists. A 'mini-app' might be a basic CustomerInquiry function. Another might be a Admin function of a main application. The general point might be that each function needs a slightly different library list or a different current-user. The initial program of each group job could set that job environment according to need. Group jobs started fading when it became easy to start whole new sessions for each new function. Group jobs worked very well with dumb terminals where starting additional sessions was hard or impossible to do. With quick emulators, you can just click a desktop icon and get a new job started. But there are still a couple potential advantages to group jobs. First, they share a name and a couple resources. The RTVGRPA command can retrieve most of what's needed to track and manage a group. The Group Data Area (*GDA) and group message queue are shared between the jobs, even though they are separate jobs. Your own programming can initiate jumps between the jobs. This might be done with activation groups, but the separation of job attributes is a little more tricky and separation of overrides, open files, etc., works differently. IMO, it's not as important to know examples as it is to have the knowledge available that they can be used. A situation might arise at any time when you can say "I know just how I can handle this problem -- group jobs." Tom
    125,585 pointsBadges:
  • Vatchy
    Here is a very simple example - it allows you to have two group jobs and to switch between them with the attention key which is set in your user profile.
                 DCL        &GRPJOB *CHAR LEN(10)
                 RTVGRPA    GRPJOB(&GRPJOB)
                 IF         (&GRPJOB *EQ '*NONE') DO /* No grp job */
                      CHGGRPA    GRPJOB(GRPJOB1) TEXT('1st Group job')
                      CHGVAR     &GRPJOB 'GRPJOB1' /* Change CL variable */
                 IF         (&GRPJOB *EQ 'GRPJOB1') DO
                                   TEXT('2nd Group job')
                 IF         (&GRPJOB *EQ 'GRPJOB2') DO
                      TFRGRPJOB  GRPJOB(GRPJOB1)
                              MSGDTA('Group jobs are already active. +
                              The Attention key handling pgm ATNPGM +
                              assumes group jobs are not active')
    1,415 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: