LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   mainframe jcl -- control order of when jobs run (https://www.linuxquestions.org/questions/programming-9/mainframe-jcl-control-order-of-when-jobs-run-4175475704/)

schneidz 09-03-2013 08:04 AM

mainframe jcl -- control order of when jobs run
 
hi, we have been using zeke to schedule 108 jobs but it is starting to be a pain in my ass (it is far more complicated and far less capable than cron).

so i did a few google/duckduckgo searches and i took the initiative to modify the ends of the jobs to look like this:
Code:

// IF RC=0 THEN
//STEP1  EXEC PGM=IKJEFT01
//SYSTSPRT  DD SYSOUT=*
//SYSPRINT  DD SYSOUT=*
//SYSTSIN  DD *
  SUB R15UXB.X390.BANKCODE.JCLLIB.NEW(X390T123)
//ENDIF

the problem i have now is that i want 2 jobs to run at the same time and i want the next job to run when both jobs finish.

kinda' like using & and the wait command in bash ?

padeen 09-03-2013 10:02 PM

[OT] Dillon's cron
 
[Off Topic] No help for the OP, but for others reading this, Dillon's cron, which is Slackware's default cron daemon, can do this. It is a light-weight cron daemon with some surprisingly smart and useful tricks.

jailbait 09-04-2013 05:38 PM

It has been decades since I used in-line TSO commands. If IKJEFT01 supports the OPER command and OPER supports a reasonable set of console commands then you can do what you want this way:

You have jobs A, B, C, and D

Job A submits jobs B, C, and D. B and C are submitted to be immediately runnable. D is submitted at priority 0 and also held.

The last step in job B runs OPER under IKJEFT01 to release job D.

The last step in job C runs OPER under IKJEFT01 to set job D to normal priority.

Back in the day I used have my JCL clerks do this sort of thing using a home grown program which entered operator commands. It is not that difficult to write. If the set of allowable OPER subcommands is not rich enough to do what you want I suggest you roll your own version of a job stream OPER.

-------------------------
Steve Stites

schneidz 09-05-2013 07:50 AM

^ thanks can you recommend a jcl site that can help me understand your suggestion a little better ?

sundialsvcs 09-05-2013 09:25 AM

Code:

//ITS_ALL JOB (123,456),'COMING BACK TO ME NOW'
:hattip:

See also this page: http://docweb.cns.ufl.edu/docs/d0070/d0070.html about RELEASE.

jailbait 09-05-2013 09:52 AM

The statement PRTY=0 on the JOB card has the same effect as a hold. When you change the priority to a positive number the job becomes runnable.

http://publib.boulder.ibm.com/infoce...00/xjbprty.htm

The TYPRUN=HOLD parameter on the JOB card will hold the job until it is released.

http://www.isc.ucsb.edu/tsg/jcl.html#typrunparameter

------------------------
Steve Stites

schneidz 09-05-2013 10:56 AM

thanks, seems like i will need to read up to gain some jcl skills. i think my original post is understandable but here is a practical example in bash:
Code:

[schneidz@hyper mf]$ head *
==> mainframe.test <==
does whatever
spider-pig...
a spider-pig does.
spider-pig...

==> test1.ksh <==
#!/bin/bash

echo `date` - test1 :  start multi-threaded job sequence

==> test2a.ksh <==
#!/bin/bash

s1=`sed -n 2p mainframe.test`
sleep 5
s2=`sed -n 4p mainframe.test`
echo `date` - test2a:  $s1 $s2

==> test2b.ksh <==
#!/bin/bash

s1=`sed -n 1p mainframe.test`
sleep 10
s2=`sed -n 3p mainframe.test`
echo `date` - test2b:  $s1 $s2

==> test3.ksh <==
#!/bin/bash

echo `date` - test3 :  continueing on with downstream jobs

==> test-run.ksh <==
#!/bin/bash

./test1.ksh
./test2a.ksh &
./test2b.ksh &
wait
./test3.ksh
[schneidz@hyper mf]$ ./test-run.ksh
Thu Sep 5 12:02:45 EDT 2013 - test1 : start multi-threaded job sequence
Thu Sep 5 12:02:50 EDT 2013 - test2a: spider-pig... spider-pig...
Thu Sep 5 12:02:55 EDT 2013 - test2b: does whatever a spider-pig does.
Thu Sep 5 12:02:55 EDT 2013 - test3 : continueing on with downstream jobs

now i got to learn how to translate this bash into something the mainframe can understand.

Z038 09-05-2013 11:22 AM

For anything more complex than serial chaining of jobs, your best bet is to use the scheduling software provided on the mainframe. The scheduling software does more than just submit jobs to the system. It also allows you to define the dependencies between jobs and define the success criteria that allows a dependent job to be triggered. You have a job that has a dependency on the successful completion of two other jobs that you want to run concurrently. That is what the scheduling system is there for. I don't have any experience with Zeke, but you should be able to get help from someone who works with batch job scheduling on the mainframe.

If your job log has IAT messages in it, the system is using JES3. If you see $HASPnnn messages, it's JES2. JES2 is far more common than JES3. If the job entry subsystem is JES3, you can try defining a dependent job control (DJC) net. JES2 doesn't support DJC. Even on a JES3 system, DJC may not be enabled. Google it and refer to the IBM manuals if you have JES3.

To serially chain jobs so that one runs immediately after another, your technique using TSO SUBMIT from a batch terminal monitor program (IKJEFT01, IKJEFT1A, IKJEFT1B) might work, but SUBMIT is often subject to installation defined controls imposed via an installation exit. A slightly more generic method is to use IEBGENER and output the next job in the chain directly to an internal reader.

Code:

//  IF RC=0 THEN
//STEP1    EXEC PGM=IEBGENER
//SYSPRINT  DD DUMMY
//SYSIN    DD DUMMY
//SYSUT2    DD SYSOUT=(A,INTRDR)
//SYSUT1    DD DISP=SHR,DSN=R15UXB.X390.BANKCODE.JCLLIB.NEW(X390T123)
//  ENDIF

It can include a step to submit the next job in the chain, and so on.

There are games you can play with enqueued data sets to help serialize jobs, but the systems programmers won't like it if you have jobs tying up initiators waiting for a data set to become available.

If you have SDSF, and if you have the requisite authority, you could submit all your dependent jobs on hold as jailbait said, and then use SDSF in batch to find and release them as needed.

But honestly, I'd suggest you make friends with someone in the batch scheduling group and learn how to use your scheduling system.

Z038 09-05-2013 11:56 AM

By the way, cron is available on the mainframe under Unix Systems Services. USS is ignored or minimally configured on very many z/OS systems, so cron may not be set up. Even if it is, you may not have authority to use it. But it's worth checking. If you can login to a TSO account on the mainframe, the OMVS command will get you to a command line prompt, provided you've been given a Unix uid and gid on the mainframe. Telnet or ssh may be enabled, so you could try those to get to a native Unix command line.

Z038 09-05-2013 12:07 PM

One other "by the way"...

If the mainframe system is z/OS 1.9 or later, SDSF supports a Rexx interface that you could use to write your own job scheduler. Rexx is an interpreted high-level programming language. It's very powerful, but like any language, you'll have to invest some effort into learning it.

schneidz 09-05-2013 01:32 PM

Quote:

Originally Posted by Z038 (Post 5022393)
For anything more complex than serial chaining of jobs, your best bet is to use the scheduling software provided on the mainframe. The scheduling software does more than just submit jobs to the system. It also allows you to define the dependencies between jobs and define the success criteria that allows a dependent job to be triggered. You have a job that has a dependency on the successful completion of two other jobs that you want to run concurrently. That is what the scheduling system is there for. I don't have any experience with Zeke, but you should be able to get help from someone who works with batch job scheduling on the mainframe
...
But honestly, I'd suggest you make friends with someone in the batch scheduling group and learn how to use your scheduling system.

good point. not to bore you with the corperate politics but the person ive been working with is now billable. i know that posix is different from z/os-mvs but i find it frustrating that a 4 letter bash command requires billable hours to be done on the mainframe.
Quote:

Originally Posted by Z038 (Post 5022425)
By the way, cron is available on the mainframe under Unix Systems Services. USS is ignored or minimally configured on very many z/OS systems, so cron may not be set up. Even if it is, you may not have authority to use it. But it's worth checking. If you can login to a TSO account on the mainframe, the OMVS command will get you to a command line prompt, provided you've been given a Unix uid and gid on the mainframe. Telnet or ssh may be enabled, so you could try those to get to a native Unix command line.

i tried running omvs from the ispf command shell and it shows me copyright/trademark notices from ibm then the last line says -- the session has ended. press enter to end omvs.

seems like i'm getting somewhere

Z038 09-06-2013 12:15 AM

When you say "ispf command shell", you don't mean ish or ishell, the ISPF shell panel do you? That's a weird interface. I wouldn't suggest using it. Normally you enter OMVS from a TSO line mode READY prompt, from ISPF option 6, or by entering TSO OMVS from a command line on just about any ISPF screen.

But based on your results, I suspect the problem is that there is no Unix uid/gid defined for your userid. If your security system is RACF, you need to have the security folks define an OMVS segment for you. (Billable, no doubt.) That is where your uid, gid, shell, and home directory get defined.

schneidz 04-05-2014 12:03 PM

i am now submitting jobs via bash from the unix system using ftp(messy hack -- i hate having passwords written in a script. wish there were ssh keys for mainframe).

after issuing quote site FILE=JES i can upload the jcl and it automatically runs. now the script sleeps for 3600 seconds (1 hour) between jobs. but some jobs finish in a few minutes (1 of them takes longer than an hour sometimes).

is there a way to know when a job completes via ftp ?

Z038 04-05-2014 11:58 PM

There are a couple of SSH options available for the z/OS mainframe, but they may not be set up at your shop. IBM has a port of openssh available that can run under Unix Systems Services on z/OS. It's not installed or configured by default. Tectia has a mainframe ssh server product, and there are a couple of others out there. But none of that helps you if it's not available on your mainframe.

FTP can't initiate a shell script on the Unix/Linux side, but z/OS does have a native rexec client that can initiate a script via your rexecd server, if you are running one. rsh is also available.

You could add a final job step to your mainframe batch job to invoke rexec, if you are running the rexec server on the *nix side. If you don't, then your final step could ftp a file to your Linux system, and you could watch for it via the inotify interface.

syg00 04-06-2014 02:50 AM

This is about as bizarre a thread as I would expect to see here. You can submit JCL and get the output back automatically; see here.
I might expect this from a (z)linux instance - but I guess you could do it from OMVS.


All times are GMT -5. The time now is 04:00 PM.