View previous topic :: View next topic
|
Author |
Message |
jzhardy
Active User
Joined: 31 Oct 2006 Posts: 139 Location: brisbane
|
|
|
|
I have a specific requirement to submit JCL within a Job, using the internal reader. So, Job X invokes Job Y.
This can be done easily using IEBGENER. But what I need to do is hold the submitting job (X) until the called job (Y) has finished.
The proper solution is to use a job scheduler like OPC. However, for various reasons, I need to use an alternative approach for the time being.
My solution was:
Job X :
Step1 : submit job Y
Step2 : wait 10 seconds, to give time for Y to enqueue file resource
Step3 : take MOD lock on that file resource
Step3 has the effect of holding Job X until Job Y finishes and releases file resource.
Worked perfectly under Z/OS 2.2.
Fails under Z/OS 2.3 for reason/s unknown.
So ... can someone provide possible explanation .. OR provide a more elegant solution.
as I said, at this stage using OPC or Control-M is not possible.
Job Y runs under different LPAR to Job X.
Any help appreciated |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
split job X in two parts ...
last step of X part ONE submits Y
last step of Y submits X part TWO
remember
the topic belongs to the category of 'topics not eligible for discussion'
at the section ... write Your own scheduler
and as such should be locked |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
Consider using JOBGROUP (available since z/OS 2.2) to build your own scheduling logic w/ z/OS and JES2 means. |
|
Back to top |
|
|
WilliamDownie
New User
Joined: 01 Jul 2020 Posts: 21 Location: UK
|
|
|
|
Could you give job x and job y the same job name ? Job y can then not start until job x has completed.
You say that "Job Y runs under different LPAR to Job X.", so I don't know if my suggestion will work for you. |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
Code: |
//JOBX JOB ...
//A EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD -- Data set containing JOBY --
//SYSUT2 DD SYSOUT=(A,INTRDR)
//SYSIN DD DUMMY
....
//LAST EXEC PGM=IEFBR14
//LOCKDS DD DISP=OLD,VOL=REF=SYS1.SVCLIB,
// DSN=a-data-set-name
//JOBY JOB ...
....
//LOCK EXEC PGM=IEFBR14
//LOCKDS DD DISP=OLD,VOL=REF=SYS1.SVCLIB,
// DSN=a-data-set-name |
The data set in the LOCKDS DD statement does not have to actually exist; the VOL=REF parameter just ensures there is a volume to allocate.
I did this solution something like 25 years ago. It worked like a charm. Obviously it will work on one system. For two systems, both systems must share data set ENQs. If they are not doing this, it will not work, which is probably why it did not work in the z/OS 2.2 and z/OS 2.3 environment.
z/OS gets the data set resources for all data sets specified in the JCL in a job before the first step executes, and releases data sets when the last step in the job that specifies the data set completes. The weakness in this solution is JOBY will appear to be running until JOBX actually completes.
The one job name Mr. Downie proposed will work with one system, but not multiple systems. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Hope you are doing this in test only environment, are you ?
How many times are you planning to have this loop on ? What’s the break for the loop ?
If it’s test and you know it takes say 1 min then why not just wait such time and resubmit instead of coding any fancy ? |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
Sample with JOBGROUP (JES2 z/OS 2.2+):
Code: |
//SCHEDULE EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DATA,DLM=##
//MYGROUP JOBGROUP
//JOBX GJOB
// AFTER NAME=JOBY
//JOBY GJOB
//MYGROUP ENDGROUP
//
//JOBX JOB ..
// SCHEDULE JOBGROUP=MYGROUP
/*JOBPARM S=ANY
//NICEGUY EXEC PGM=IEFBR14
//
//JOBY JOB ..
// SCHEDULE JOBGROUP=MYGROUP
/*JOBPARM S=ANY
//LADY1ST EXEC PGM=BPXBATCH,PARM='SH sleep 1m'
//STDOUT DD PATH='/dev/null'
//STDOUT DD PATH='/dev/null'
//STDERR DD PATH='/dev/null'
##
//SYSUT2 DD SYSOUT=(A,INTRDR)
//SYSIN DD DUMMY |
Seems to work as desired:
Code: |
$HASP890 JOB(MYGROUP)
$HASP890 JOB(MYGROUP) JOB GROUP JOB LIST
$HASP890 JOB NAME JOBID JOB STAT COMP STAT
$HASP890 -------- -------- -------- ---------
$HASP890 JOBY JOB65366 ACTIVE ACTIVE
$HASP890 JOBX JOB65365 PEND DEP PENDING |
and
Code: |
$HASP1300 JOBX registered to job group MYGROUP
$HASP1300 JOBY registered to job group MYGROUP
$HASP1301 JOBY in job group MYGROUP queued for execution
$HASP373 JOBY STARTED - WLM INIT - SRVCLASS BATCH
$HASP395 JOBY ENDED - RC=0000
$HASP1301 JOBX in job group MYGROUP queued for execution
$HASP373 JOBX STARTED - WLM INIT - SRVCLASS BATCH
$HASP395 JOBX ENDED - RC=0000
$HASP1304 job group MYGROUP is complete |
|
|
Back to top |
|
|
|