REXX to find out if a job is completed



IBM's Command List programming language & Restructured Extended Executor

REXX to find out if a job is completed

Postby cvcv » Tue Sep 13, 2016 9:52 pm

Hi, I’ve created a little utility to generate and submit (using REXX QUEUE/submit) a bunch of DB2 Load jobs (each job loads a specific db table).

Right now, every job gets submitted one after the other without waiting for the previous job (submitted) to be completed.

I’m trying to think about creative ways, using REXX, to force the utility to wait for the previous job to finish before submitting the next one.

The only thing I could come up with is to check if a Load job’s input dataset is “locked” (by the job itself), if that’s even possible, and wait until it is “free” for the next job to be submitted. But the problem with this is that the second job could potentially start before the first one has the time to open the file. Might not work.

Any ideas?
Thanks
cvcv
 
Posts: 11
Joined: Fri Aug 28, 2015 6:05 pm
Has thanked: 2 times
Been thanked: 0 time

Re: REXX to find out if a job is completed

 

Re: REXX to find out if a job is completed

Postby enrico-sorichetti » Tue Sep 13, 2016 10:58 pm

since You build the jobs Yourself the easiest solution is
store all the jobs in a PDS
add to each job a step ( as the last step ) to submit the next job
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

These users thanked the author enrico-sorichetti for the post:
cvcv (Wed Sep 14, 2016 2:52 am)
enrico-sorichetti
Global moderator
 
Posts: 2519
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 120 times

Re: REXX to find out if a job is completed

Postby cvcv » Tue Sep 13, 2016 11:24 pm

ok thanks for the good idea. That was my goal though.. to not save the jobs generated. I guess I would have to do that if I want to submit the jobs one by one.

Thanks
cvcv
 
Posts: 11
Joined: Fri Aug 28, 2015 6:05 pm
Has thanked: 2 times
Been thanked: 0 time

Re: REXX to find out if a job is completed

Postby enrico-sorichetti » Wed Sep 14, 2016 1:17 am

and the last job might as well delete the PDS used for the whole shebang
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2519
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 120 times

Re: REXX to find out if a job is completed

Postby NicC » Wed Sep 14, 2016 3:06 am

Or put a TYPRUN=HOLD on all the jobs except the first and a final step of each job but the last to release the next job.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2531
Joined: Sun Jul 04, 2010 12:13 am
Location: Down on the pig farm
Has thanked: 4 times
Been thanked: 88 times

Re: REXX to find out if a job is completed

Postby willy jensen » Wed Sep 14, 2016 1:11 pm

You can use the SDSF REXX API in a loop to continuously check the jobs progress. More complicated by still an option.
If you go for the PDS option then your dynamically built job stream could have an IEBUPDTE ./ ADD statement in front of each separate job, so that the job stream would build the PDS.
willy jensen
 
Posts: 61
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 11 times

Re: REXX to find out if a job is completed

Postby enrico-sorichetti » Wed Sep 14, 2016 7:14 pm

You can use the SDSF REXX API in a loop to continuously check the jobs progress.

not the smartest approach IMO, having a tso session waiting for 100 jobs to finish :mrgreen:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2519
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 120 times

Re: REXX to find out if a job is completed

Postby cvcv » Wed Sep 14, 2016 9:48 pm

Thanks for your help guys, really appreciated
cvcv
 
Posts: 11
Joined: Fri Aug 28, 2015 6:05 pm
Has thanked: 2 times
Been thanked: 0 time

Re: REXX to find out if a job is completed

Postby willy jensen » Wed Sep 14, 2016 11:27 pm

@enrico
it depends. 100s of jobs, not a good idea.10 or so quick jobs it may be an option. just another tool in the toolbox.
willy jensen
 
Posts: 61
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 11 times

Re: REXX to find out if a job is completed

Postby steve-myers » Thu Sep 15, 2016 12:36 am

enrico-sorichetti wrote:
You can use the SDSF REXX API in a loop to continuously check the jobs progress.

not the smartest approach IMO, having a tso session waiting for 100 jobs to finish :mrgreen:

Agreed. However, this is a task any scheduling package can do quite well.
steve-myers
Global moderator
 
Posts: 1789
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 170 times

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post