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

How to check whether the previous jobs are complete


IBM Mainframe Forums -> JCL & VSAM
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Fri Feb 04, 2011 9:19 pm
Reply with quote

Hi All,

I encountered the following scenario while writing the JCL

My JCL is like
//Step1 --> Executes a PROC
//Step2 --> Submits 1st JCL
//Step3 --> Submits 2nd JCL
//Step4 --> Submits 3rd JCL
//Step5 --> Submits 4th JCL
//Step6 --> Submits 5th JCL
//Step7 --> Executes a proc that merges output files of above executes JCL.

Problem Step7 executes before completion of Step2,Step3,Step4,Step5 and Step6.

Is there any way I can hold step7 until all the above jobs have successfully completed.Merge is using old files which were created in previous run.
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: Fri Feb 04, 2011 9:25 pm
Reply with quote

There is no scheduling componnent to pure JCL -- so what you're wanting is not possible without using multiple jobs or the site job scheduler.

Use the job scheduler at your site and make STEP7 a separate job that depends upon the other 5 jobs being completed.

Or, change your jobs so this job only has steps 1 and 2. The job submitted by STEP2 submits the 2nd JCL as the last step of the job, and continue through the 5th job executing the PROC that merges output.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Feb 04, 2011 9:35 pm
Reply with quote

rgupta71 wrote:
Hi All,

I encountered the following scenario while writing the JCL

My JCL is like
//Step1 --> Executes a PROC
//Step2 --> Submits 1st JCL
//Step3 --> Submits 2nd JCL
//Step4 --> Submits 3rd JCL
//Step5 --> Submits 4th JCL
//Step6 --> Submits 5th JCL
//Step7 --> Executes a proc that merges output files of above executes JCL.

Problem Step7 executes before completion of Step2,Step3,Step4,Step5 and Step6.

Is there any way I can hold step7 until all the above jobs have successfully completed.Merge is using old files which were created in previous run.

If your shop runs JES3, you can use DJC networking; I believe that some sites using JES2 use a modified version giving it similar abilities. Otherwise, you should adopt one of Mr. Sample's suggestions.
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: Fri Feb 04, 2011 9:39 pm
Reply with quote

JES3 DJC networking would still require separate jobs. And DJC networking had issues the last time I used it -- unless you're 100% sure the jobs will (almost) never abend, you can run into sequencing issues after abends.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Feb 04, 2011 9:50 pm
Reply with quote

Robert Sample wrote:
JES3 DJC networking would still require separate jobs.

That is true. But, unless I misunderstand the OP, steps 2 through 6 are already submitting separate jobs; only step 7 needs to be made a new job.
Quote:
And DJC networking had issues the last time I used it -- unless you're 100% sure the jobs will (almost) never abend, you can run into sequencing issues after abends.

Possibly IBM has changed it since then; but we make very extensive use of it on our development sysplex, and it gives us no problems (unless somebody tries something that the documentation says not to do...but like with everything else, reading the fine manual should be the first resort, not the last icon_biggrin.gif).
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Feb 04, 2011 9:57 pm
Reply with quote

in this case the simpler solution to meditate on would be to restructure the whole thing in 7 jobs
where each job submits the next one
( the parallelism of jibs 2 to 6 would be lost, but ... You cannot have everything )

Quote:
I believe that some sites using JES2 use a modified version giving it similar abilities.


there are some JES2 mods that implement a <partial> solution
they are commonly knows as MELLON BANK JES mods
and are available from the CBT tape

On a very once upon a time there was an IFP
( International Field Program) Program number 5785-GAK
IBM System/370 Chained Jobs Scheduling
written IIRC by Alessio Cavallo
which would support on MVS and even on VS1 the same facilities as DJC

P.S
if somebody has a copy of it I would be glad to get my hands on it icon_biggrin.gif
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Fri Feb 04, 2011 10:11 pm
Reply with quote

Thanks everyone for your valuable inputs.
icon_biggrin.gif I will restructure my job or I will make a new job for merge.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Fri Feb 04, 2011 10:17 pm
Reply with quote

I tried introducing a HOLD file also but then also it didn't worked.
All the steps2 to step7 were having that file as DISP=SHR and last proc was having that as DISP=OLD but it also didn't worked.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Feb 05, 2011 12:33 am
Reply with quote

Hello,

Do not post "it didn't work". If something does not work, you must post what went wrong.

What is this HOLD file? Is there some reason this is not being done with the scheduling already available on the machine.

It may be time to implement this so that the processes run serially, not in parallel. . .
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Sat Feb 05, 2011 12:43 am
Reply with quote

Sorry,I used "it didn't worked" again icon_redface.gif
HOLD File is a common file.It just has one line that it is a dummy file.I am running a job in my test environment so scheduling the job is not a good option and also I don't know scheduling the job in scheduler. icon_sad.gif
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: Sat Feb 05, 2011 1:01 am
Reply with quote

Let's see if I've got this right ... your job with the 7 steps, you added the HOLD file with DISP=OLD and then ran the job? Which submitted 5 other jobs using the HOLD file with DISP=SHR?

Since your job is running when STEP2 executes the submit for the first job, you ARE aware that this means that the submitted jobs from steps 2 through 6 cannot start running until after STEP7 has completed? From the JCL Reference manual, chapter 12.19 on DISP:
Quote:
| DISP and ENQ: Before starting the first step of a job, the initiator
| requests control of all of the data sets in that job by issuing an ENQ for
| each of them, using the value specified for DISP to determine the kind of
| ENQ issued. The initiator issues the ENQ for each data set at the highest
| level required for that data set by any step of the job. For example, if
| all steps of the job request shared control of a specific data set
| (DISP=SHR) then the ENQ for that data set is requested as SHR. If, on the
| other hand, any step of the job requests exclusive control of a specific
| data set (DISP=NEW, DISP=MOD, or DISP=OLD), then the ENQ for that data set
| is requested EXCL.


| The ENQ for each dataset is released at the end of the last step of the
| job referencing it. Since ENQs cannot be downgraded from EXCL to SHR, if
| one step needs the ENQ EXCL and a following step only needs it SHR, the
| ENQ is still issued as EXCL and held until the end of the last step which
| references that data set, at which point the ENQ is released entirely.

You've been provided several solutions and you need to give up on the idea of running all this as a single job and implement one of the provided solutions.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Sat Feb 05, 2011 1:05 am
Reply with quote

Thanks Sample.
I just mentioned the way I try to did.Today I had one very importan learning
Quote:
Before starting the first step of a job, the initiator
| requests control of all of the data sets in that job by issuing an ENQ for
| each of them, using the value specified for DISP to determine the kind of
| ENQ issued.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Feb 05, 2011 1:10 am
Reply with quote

Hello,

Quote:
I am running a job in my test environment so scheduling the job is not a good option
Is this to eventually be promoted to Production? If so, it should run via the scheduler when it is in production. There is no good reason to test some kludge that needs to be re-done for promotion.

Suggest you talk with your manager and the scheduling people to schedule your process as a test job and then when the job is promoted, the scheduling work will already be done.

Otherwise, you should use one of the suggestions already provided.
Back to top
View user's profile Send private message
rgupta71

Active User


Joined: 21 Jun 2009
Posts: 160
Location: Indore

PostPosted: Sat Feb 05, 2011 1:19 am
Reply with quote

I already implemented it.I have made a new job and manually I will submit it icon_biggrin.gif .
Back to top
View user's profile Send private message
Jeffrey Ranney

New User


Joined: 23 Dec 2010
Posts: 20
Location: USA

PostPosted: Tue Feb 08, 2011 5:13 pm
Reply with quote

If all the jobs have the same job name, this will work like a charm !
Back to top
View user's profile Send private message
yurad

New User


Joined: 22 Apr 2006
Posts: 2

PostPosted: Fri Dec 14, 2012 3:49 am
Reply with quote

I also was looking for job synchronization. When I ran BAT (Business Acceptance Test) I had to run multiple jobs in parallel , up to 20 jobs running simultaneously , and after successful completion of all jobs I started next job. No scheduler was available. Than I created the following solution, based just on flag files.

Example: There are jobs that have to run at the same time. Let's say job names job1 - job5, 5 jobs. After successful completion a next job should start, let's say jobb

I created an extra job grpst1 ( start group) with two steps
1. Delete flag files:
&sysname..job1
&sysname..job2
&sysname..job3
&sysname..job4
&sysname..job5
&sysname..jobb

2. Submit all 5 jobs: job1 - job5

I created another job grpen1- group end (description below)

I appended to every parallel job (job1 - job5) two following steps :
If (rc < &cond1 ) then
1. create a flag file &sysname..flag.job#
2. Run group end job - as an example grpen1
endif
thus, after the job successfully finished a flag file &sysname..job# is created.

Job grpen1 does the following:
- Test existence of all 5 files:
&sysname..job1
&sysname..job2
&sysname..job3
&sysname..job4
&sysname..job5
- If all exist check existence of the flag file &sysname..jobb (to prevent double submission of jobb)
- If not exist create &sysname..jobb
and submit jobb.

Works fine for me so far.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts SCOPE PENDING option -check data DB2 2
No new posts How to create a list of SAR jobs with... CA Products 3
No new posts Check data with Exception Table DB2 0
No new posts Help in Automating Batch JCL jobs mon... JCL & VSAM 3
No new posts Submit multiple jobs from a library t... JCL & VSAM 14
Search our Forums:

Back to Top