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
Software/Hardware used:
ASKED:
May 10, 2010 2:45 PM
UPDATED:
May 17, 2010 8:49 PM
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
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
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
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
This got me curious enough to run a test. Make this change and review the results:
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
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
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