The TFRJOB command has parameters beyond just naming the job queue that the job is transferred to. One of those parameters is the RQSDTA() parameter. For any job on a job queue, the RQSDTA() is what tells the command processor what to run when the job starts. This is no different from the SBMJOB command — the SBMJOB RQSDTA() is also what runs for submitted jobs.
You could, for example, have it this way:<pre>
When that transferred job starts, it will call MYPGM from library MYLIB. That program can set any library environment that you want before doing the work that you want it to do.
Another parameter is RTGDTA(). This is just like RTGDTA() anywhere else. The value determines which routing program will be called to start the job. If you use different routing data, you can cause a different routing program to run. You might have a set of routing programs that put different library environments in place for different sets of users. Your program would choose what routing data would be specified for each user.
Normally, I would expect the job description to set the library environment; but you don’t have to use that. I think it’s easier because it holds the library list in an external object that can be changed without affecting any programming.