View previous topic :: View next topic
|
Author |
Message |
RazVorox
New User
Joined: 19 Oct 2022 Posts: 32 Location: Israel
|
|
|
|
I must be missing something.
Would appreciate a pointer in the right direction.
(From rexx) I'm addressing tso, calling a job.
I want the rexx to wait, until RC, and then
if the RC is [value] then do [something]
Thing is, I didn't mng to find any "jobwait" routine,
or command, or.. anything of that sort.
there are plenty of work arounds (like - create a file,
and keep a do-while loop checking if it exists - ) but
that just.. doesn't seem right. It sounds.. wrong.
I also don't want to write an entire scheduler,
just for a one-time specific case/issue..
So.. its either really, really simple, and I've missed something,
or really complex, and then.. well.. yeah. fun.
Pointers? documentation? key-words? help?
Highly appreciated,
Me. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2133 Location: USA
|
|
|
|
1. You cannot "call" a (batch) job. You can only "submit" the JCL to be executed as a batch job.
2. Since you plan "to wait for the job to end", what is the reason to run it in batch? You can call the same PGM from your JCL right from your REXX code, and either use ALLOCATE command to simulate every DD statement from your JCL, and/or just use the same or a part of DD statements in your TSO procedure, whatever is easier.
3. Generally speaking, there are ways to communicate between REXX code under TSO, and independently running batch jobs. But I believe that your major goal is not worth using those tools. You don't need a musket to shoot a butterfly. I guess so. |
|
Back to top |
|
|
RazVorox
New User
Joined: 19 Oct 2022 Posts: 32 Location: Israel
|
|
|
|
First - thanks for the reply..
Second - The short answer is because that's what I was told to do.
I have to patch an already existing rexx, with a SupC,
And I have to use a job to call it.
Address isdf is not an option, and i cannot make major changes
In the main pgm. (If it ain't broken, etc..)
Inject, wait for rc, parse the outdd, continue.
So I'm stuck.
Much frustration, very nope, many bums.
But thats the task I've got.
So I'm trying to find the best solution for it.
And running a do-while loop to check if the outdd was
Created is just.. I don't know. Dirty.
:-/ |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
re: "I have to use a job to call it"
If I were doing this exercise, I would do it all from the rexx program instead of running a batch job (which runs asynchronously).
Any batch utility can be called from rexx. Use TSO ALLOCATE statements to replicate the batch DD statements and then use the TSO CALL command (or Address LINKMVS statement) to execute the program. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Submitting a batch job and waiting for it to complete is never a good idea without a job scheduler. Why? Because it can take anywhere from seconds to days for that job to complete. At a previous employer, month-end processing drove the CPU to 100% utilization for 5 days. Most of the month, a COBOL compile would typically run 15 to 30 seconds. During those 5 days, COBOL compiles took 5 hours or more. |
|
Back to top |
|
|
RazVorox
New User
Joined: 19 Oct 2022 Posts: 32 Location: Israel
|
|
|
|
Again. I agree, and appreciate the advice,
But its a given.
I need to address tso, and submit a job.
Than I need to wait for it to finish,
Than I need to continue with the rexx.
I don't say that its smart, right, or the best thing to do,
I just say that for a variety of reasons, ppl above me,
Decided this is how its gonna be.
(I asume the main reason is - we have a rexx that works,
We have job that works, we don't want to (re-)built an entire.. thing.
So patch them up, and make it work.)
We all know for a fact that there is a notify. So the mechanism,
Somewhere, some how, exists.
My only question is if there's an elegant solution to hook it,
Or some other "jobwait", to rexx..
I didn't write the rules, just expected to play by them. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Submit the job, then drop into a loop that waits a few minutes then checks the job status.
Use the SDSF rexx interface to check the status of a job. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2133 Location: USA
|
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
That is a bad design, but it can be done. Search this forum for REXX SLEEP, this has been discussed many times before. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
You can use the TSO STATUS command to determine if the job completed. But I think it will only work if the job name begins with the userid. |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 730 Location: Denmark
|
|
|
|
Since you say that you want to check the rc for the job, then I can only advise you to use the REXX SDSF API, combined with a SLEEP .
When you said 'addrss isdf is not an option', did you mean SDSF? And why would SDSF not be an option? |
|
Back to top |
|
|
|