TFRJOB has to get executed along with library setup program

305 pts.
Tags:
AS/400 jobs
TFRJOB
Hi,

When I invoke TFRJOB command, along with that i need to call the program to change the library list.

Is it possible to attach any program along with TFRJOB command. And one more issue, when we are using TFRJOB command directly goes into sign on screen, where we can pass the parameter to Program/Procedure in sign on screen when we are transfering the job.

Is these two methods are possible means , let me know how to invoke?

 

thanks

 P.Amutha

Answer Wiki

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

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>
TFRJOB JOBQ(QINTER)
RQSDTA(‘CALL MYLIB/MYPGM’)</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.

Tom

Discuss This Question: 7  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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • As400pgmmer
    Hi TOM, when I invoke the TFRJOB in clle program say SSBSJBR . And I attach this program as (Initial Program to call) of particular user profile. So whenever the user is getting sign in to our system , our SSBSJBR program will be invoked and based on conditions it will do the TFRJOB. Eventhough I set the condition to TFRJOB , the loop is not getting exited. Instead the program loop is getting executed continuosly without coming out of the program and user cannot sign in. Same program when I debug it, it is getting executed properly. Please advice whether we can use TFRJOB in clle program without any cause. Thanks Amutha
    305 pointsBadges:
    report
  • TomLiotta
    Eventhough I set the condition to TFRJOB , the loop is not getting exited. Loop? What loop? TFRJOB would only be appropriate inside of a loop if you wanted to end the loop with that command. TFRJOB might not even be appropriate in an initial program -- it should work, but it will be the last command that can be run by the initial program. What are you trying to do? Once the job transfers, the program that has the TFRJOB command is finished. Instead the program loop is getting executed continuosly without coming out of the program and user cannot sign in. Show the commands that control the loop, and show where the TFRJOB command is in relation to the loop. Describe the conditions for the loop; describe what the condition test means. Tom
    125,585 pointsBadges:
    report
  • As400pgmmer
    Hi Tom, Please find the sample code, and let me know suggestions for TFRJOB. PGM DCL VAR(&#USER) TYPE(*CHAR) LEN(10) DCL VAR(&#SBSJBQ) TYPE(*CHAR) LEN(10) DCL VAR(&#SBSJBQL) TYPE(*CHAR) LEN(10) DCL VAR(&#AVLFLG) TYPE(*CHAR) LEN(1) DCL VAR(&FOUND) TYPE(*LGL) DCL VAR(&CNT) TYPE(*DEC) LEN(1) VALUE(1) RTVJOBA USER(&#USER) CALL PGM(SSBSJBR) PARM(&#USER &#SBSJBQ &#SBSJBQL + &#AVLFLG) IF COND(&#AVLFLG *EQ 'Y') THEN(DO) IF COND(&CNT = 1) THEN(DO) CRTDTAARA DTAARA(QTEMP/DTAARA1) TYPE(*LGL) LEN(1) + VALUE('0') TEXT('Data Area for TFRJOB - + Amutha') RTVDTAARA DTAARA(Qtemp/DTAARA1) RTNVAR(&FOUND) CHGVAR VAR(&CNT) VALUE(&CNT + 1) IF (&FOUND *EQ '0') DO CHGDTAARA DTAARA(QTEMP/DTAARA1) VALUE('1') TFRJOB JOBQ(&#SBSJBQL/&#SBSJBQ) GOTO END ENDDO ENDDO ELSE IF COND(&#AVLFLG *EQ 'N') THEN(DO) SNDPGMMSG MSG('System not available') ENDDO ENDDO END: ENDPGM I am using the above program for TFRJOB, When I do it in debug mode it is working fine. But same program when I attached to the Initial program of the user profile, the program does not come out of the loop, instead it displays the error message routing has been completed for the session and when we press enter again, it again displays the same message. The program does not come out of the loop. Please advice. Thanks, P.Amutha
    305 pointsBadges:
    report
  • TomLiotta
    I don't have any information saying that TFRJOB will work in an initial program. As I think about it, it doesn't surprise me that it isn't working. I've never seen it used in an initial program and I don't think it fits well in an initial program. An "initial program" has a couple of purposes and characteristics. It is supposed to run and finish. When it runs, it is intended to set the initial job environment beyond what a job description can do. When it ends, control is passed to the initial menu -- the INLMNU() attribute of the user profile. However, TFRJOB causes the current program to end by starting a new job routing step. So, it seems that as soon as TFRJOB executes, the initial program is ended and control passes to the initial menu. In your program, you are not specifying any RQSDTA(). Since you don't tell the system what program to run when the job transfers, I would expect it to come to the end of the initial program. What do you have for INLMNU() for this user? Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    This got me curious enough to run a test. Make this change and review the results:
    .
    .
    .
    DCL VAR(&CNT) TYPE(*DEC) LEN(1) VALUE(1)
    
    SNDPGMMSG MSG(’Initial program is starting’)
    
    RTVJOBA USER(&#USER)
    .
    .
    .
    Insert that SNDPGMMSG command into your program as the first executable statement. Then try it again as an initial program. The SNDPGMMSG command will run once when the program begins. When the error about routing message appears, press <Enter> to cause the program to loop a few times. Once you have caused the loop three or four times, look into the joblog messages. What you should see is that your initial program is getting called every time TFRJOB runs. You can tell because the ’Initial program is starting’ message will be repeated in the joblog for each time you press <Enter>. The program is called fresh each time. Of course, that means you can't save any variable values such as &CNT because they will be initialized each time in CL. Interesting behavior, but it doesn't surprise me. The basic result is that TFRJOB isn't very appropriate for an initial program. You might have better luck with a routing program, especially since that's the kind of thing that routing programs are intended for. Tom
    125,585 pointsBadges:
    report
  • As400pgmmer
    hi tom, You could, for example, have it this way: TFRJOB JOBQ(QINTER) RQSDTA('CALL MYLIB/MYPGM') As you said, I have executed the above command. But it does not change the library list. When I look into display job log, it displays like this 3 > TFRJOB JOBQ(QINTER) RTGDTA(NONE) RQSDTA('call qgpl/a2 PARM(''CTSPAMUTHA'') ') TFRJOB command ended the routing step. Routing step started in subsystem QINTER. Message queue CTSPAMUTHA is allocated to another job. 400 - RTVJOBA USER(&#USER) 700 - CALL PGM(SSBSJBR) /* The CALL command contains parameters */ DSPLY Y 706 - CHKOBJ OBJ(QTEMP/TEMP) OBJTYPE(*DTAARA) - RETURN /* RETURN due to end of CL program */ > /* */ 3 > EDTLIBL 3>> dspjoblog .. call qgpl/a2 PARM('CTSPAMUTHA') .. call qgpl/a2 PARM('CTSPAMUTHA') And the library list is based on the JOB description list. (QDFTJOBD- QCMDI). Atleast it should add the library which I am specifying in the TFRJOB command. But it doesnt, instead it set the QDFTJOBD library list. In this case my query is during TFRJOB, all the properties of the user profile will get executed or not. And why TFRJOB command is not executing the Command which we are giving in RQSDTA ? Please advice on this. Thanks P.Amutha
    305 pointsBadges:
    report
  • TomLiotta
    And why TFRJOB command is not executing the Command which we are giving in RQSDTA ? First, TFRJOB doesn't execute any commands. It simply places a *RQS (request) message on the job's external message queue in the new job queue. Request messages are processed by request-processors such as QCMD. Second, this is a question that needs to be answered by IBM Support. They are the only ones who can tell you why an IBM command works in the way it does. Third, I suspect that the request message isn't processed because you are running TFRJOB in an initial program. An initial program would be executed when a new interactive job starts. It would run before any request was processed. Therefore, the job never gets far enough to process the request. The initial program runs again and another TFRJOB command is run. This causes the initial program to run again. It doesn't work; it is not appropriate. As before, it looks like TFRJOB simply should not be executed in an initial program. Take it out. Create a routing program if you need to run TFRJOB. Tom
    125,585 pointsBadges:
    report

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following