IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Wait for job rc


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
RazVorox

New User


Joined: 19 Oct 2022
Posts: 32
Location: Israel

PostPosted: Mon Apr 03, 2023 8:38 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Mon Apr 03, 2023 9:09 pm
Reply with quote

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
View user's profile Send private message
RazVorox

New User


Joined: 19 Oct 2022
Posts: 32
Location: Israel

PostPosted: Mon Apr 03, 2023 9:57 pm
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Mon Apr 03, 2023 11:22 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Apr 03, 2023 11:56 pm
Reply with quote

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
View user's profile Send private message
RazVorox

New User


Joined: 19 Oct 2022
Posts: 32
Location: Israel

PostPosted: Tue Apr 04, 2023 12:07 am
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Tue Apr 04, 2023 12:20 am
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Tue Apr 04, 2023 1:19 am
Reply with quote

SDSF interface, not very elegant...

www.ibm.com/docs/en/zos/2.2.0?topic=customization-using-sdsf-rexx-programming-language
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Tue Apr 04, 2023 3:12 am
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Tue Apr 04, 2023 4:29 am
Reply with quote

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
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Tue Apr 04, 2023 5:03 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Started transaction enters "firs... CICS 3
No new posts VSAM RLS Wait time JCL & VSAM 3
This topic is locked: you cannot edit posts or make replies. Job to wait and continue based on reply COBOL Programming 5
No new posts OMEGAMON to see In-DB2 times and Wait... IBM Tools 4
No new posts MQ message to wait for processing Java & MQSeries 1
Search our Forums:

Back to Top