MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Run JCL stream from within another JCL stream

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 628
Topics: 176
Location: Stockholm, Sweden

PostPosted: Thu Sep 06, 2018 9:28 am    Post subject: Run JCL stream from within another JCL stream Reply with quote

I do realize that you would normally use something like OPC, but where I'm working, they only seem to use that in production.
So, this is what I would like to do.
I have some JCL that is generally imbedded in a long stream of jobs. This JCL stops all the online CICS databases so that a batch job can be run. The JCL starts by stopping all the databases like this
Quote:

//DBRDB EXEC PGM=ZCMDX
//SYSIN DD *
IMSADBR DB DAA01 NOFEOV.
IMSADBR DB DAA011 NOFEOV.
IMSADBR DB DAA012 NOFEOV.
IMSADBR DB DAA013 NOFEOV.
IMSADBR DB DAB11 NOFEOV.
etc etc
//* Wait 5 seconds
//WAIT EXEC PGM=WAIT,PARM='05'
//SYSOUT DD SYSOUT=*

Then the real program/JCL is run, after which the databases are started again using
Quote:

//STADB EXEC PGM=ZCMDX,COND=EVEN
//SYSIN DD *
IMSASTA DB DAA01.
IMSASTA DB DAA011.
IMSASTA DB DAA012.
etc etc


What I would like to do is run the start/stop of the databases as steps that are pointed to from within the JCL I actually want to run. Something like this
Quote:

//STODB EXEC PGM=myuser.my.library(STADB)
//*
//MYPROG EXEC PGM=MYPROG
etc etc
//*
//STADB EXEC PGM=myuser.my.library(STADB)
//*


Is this doable via include or similar?
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Thu Sep 06, 2018 2:33 pm    Post subject: Reply with quote

You want to imbed 3 steps into your existing jobstram? Or you want your jobstream to submit another job to execute those 3 steps? I am not quite following you. INCLUDE can be coditional in the ense that if you have one setting then you could include those 3 steps but with another setting you could include a simple IEFBR14. But I am not clear on the before and after.

You could also, as you mentioned OPC, write a simple scheduling system in rexx. I did that and it allows for mulitple predecessors and multiple successors. One control data set, one 'plan' data set and a simple rexx program executed at the end of each job.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12374
Topics: 75
Location: San Jose

PostPosted: Thu Sep 06, 2018 2:56 pm    Post subject: Reply with quote

misi01,

It is not clear as to what you want to do.

Do you plan to run your stop/start/ JCL from your private library every time that long stream job ran?

You can add a step to submit your JCL using IKJEFT01

Code:

//STEP0010 EXEC PGM=IKJEFT01         
//SYSTSPRT DD SYSOUT=*               
//SYSTSIN  DD *                     
SUB 'Your.Jcl.pds(STODBJCL)'         
/*       


Or if you are planning to run ONLY parts of the steps from a long stream job, then you can use IEBEDIT to create a data set containing a selection of jobs or job steps. These jobs or job steps can be entered into the job stream at a later time for processing.

Check this link which explains about IEBEDIT

https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.idau100/edit.htm
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 628
Topics: 176
Location: Stockholm, Sweden

PostPosted: Fri Sep 07, 2018 3:11 am    Post subject: Reply with quote

I want the three steps to run in sequence. I get the impression with your IKJEFT01 suggestion that I would simply be submitting a job to stop the databases. Would that mean that the step AFTER isn't started until the STODBJCL steps have completed, in which case that might well do the trick.

HOWEVER if it meant that the stop of the DB's was run as a separate job which gets started "whenever", but in the meantime the next step starts running immediately, it wouldn't. I want to be able to ensure the stop DB's is run, 5 seconds elapse, and then the second step starts running.
(I reread my first append, and obviously the first line should have read
Quote:

//STOPDB EXEC PGM=myuser.library(STOPDB)

otherwise the impression is that the stop/start jobs BOTH run STADB which is obviously incorrect.

In the meantime, I'll read up on the IEBEDIT - thanks for the pointer
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Sep 07, 2018 3:53 am    Post subject: Reply with quote

No, your job will execute the next step immediately after submitting your stop step as a separate job. That job may not even starft until the submitting job finishes if the resources are not available. This scenario would not be helped by a scheduler.

What you need to do is split your long job stream into at least two parts. The first would submit the stop and terminate. The stop job would submit the second part which would eventually submit the start job. If you are going to run the job stream without the stop/start then you can use separate include members or even simple have 2 procedures, one does the stop/start and the other simply runs the whole lot (sans stop/start).
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12374
Topics: 75
Location: San Jose

PostPosted: Fri Sep 07, 2018 12:10 pm    Post subject: Reply with quote

misi01,

Ideally I will have 1 JCL which does the following

1. Accepts parms to sysin ( Look up EXPORT feature in JCL ) so that you can have dynamic STOP/START databases that you are interested. ex https://www.mvsforums.com/helpboards/viewtopic.php?t=12874&highlight=export

2. STEP 1 will STOP the databases you are interested

3. Step 2 will have the WAIT step

3. Step 3 will have your program that modifies/load the database

4. Step 4 will START the databases that you stopped from step 1

It is that simple. I am not sure why you want to make it so complicated.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Sep 07, 2018 3:52 pm    Post subject: Reply with quote

I am thinking that he wants to insert it in the middle of some existing process - stuff that has to happen before the database work and stuff that has to happen after the database work, Also, perhaps sometimes the database work is not required, otherwise why the kerfuffle?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 628
Topics: 176
Location: Stockholm, Sweden

PostPosted: Mon Sep 10, 2018 3:59 am    Post subject: Reply with quote

Thanks for the comments/suggestions. Here's what I put together. First the generalized part that I needed
Code:

//*  POINT AT ANY INCLUDE LIBRARIES                             
//INCL    JCLLIB ORDER=SDST.DIALLIST.ILIB                       
//*                                                             
//E1     EXPORT SYMLIST=(IMSENV)                               
//*      SET IMSENV TO IMSA(ITEST), IMSF(STEST) AND IMST(ATEST)
//S1     SET IMSENV=IMST                                       

then the stop of the databases
Code:

//STOPDB   INCLUDE MEMBER=DBSTOPP

then the actual JCL I wanted to run after the databases had been stopped, and finally the restart of the databases
Code:

//STARTDB  INCLUDE MEMBER=DBSTART

and in SDST.DIALLIST.ILIB, the stop of the databases had
Code:

//DBRDB    EXEC PGM=ZCMDX         
//SYSIN    DD  *,SYMBOLS=JCLONLY 
&IMSENV.DBR DB DAA01 NOFEOV.     
&IMSENV.DBR DB DAA011 NOFEOV.     
etc etc

and the start at the end contained
Code:

//STADB    EXEC PGM=ZCMDX,COND=EVEN   
//SYSIN    DD  *,SYMBOLS=JCLONLY       
&IMSENV.STA DB DAA01.                 
&IMSENV.STA DB DAA011.                 
etc etc


Now, instead of having duplicated lines of code (as well as the risk of copy/pasting the stop/start commands and pointing at one system while intending it for another) you have the commands in one place and only have to get/set ONE parameter correctly with the export/set commands.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group