LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-03-2013, 08:04 AM   #1
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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 ?

Last edited by schneidz; 09-03-2013 at 10:06 AM.
 
Old 09-03-2013, 10:02 PM   #2
padeen
Member
 
Registered: Sep 2009
Location: Perth, W.A.
Distribution: Slackware, Debian, Gentoo, FreeBSD, OpenBSD
Posts: 208

Rep: Reputation: 41
[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.
 
Old 09-04-2013, 05:38 PM   #3
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,334

Rep: Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547
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

Last edited by jailbait; 09-04-2013 at 05:40 PM.
 
1 members found this post helpful.
Old 09-05-2013, 07:50 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Original Poster
Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
^ thanks can you recommend a jcl site that can help me understand your suggestion a little better ?
 
Old 09-05-2013, 09:25 AM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,610
Blog Entries: 4

Rep: Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905
Code:
//ITS_ALL JOB (123,456),'COMING BACK TO ME NOW'


See also this page: http://docweb.cns.ufl.edu/docs/d0070/d0070.html about RELEASE.
 
1 members found this post helpful.
Old 09-05-2013, 09:52 AM   #6
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,334

Rep: Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547
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
 
1 members found this post helpful.
Old 09-05-2013, 10:56 AM   #7
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Original Poster
Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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.

Last edited by schneidz; 09-05-2013 at 11:03 AM.
 
Old 09-05-2013, 11:22 AM   #8
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 910

Rep: Reputation: 174Reputation: 174
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.
 
1 members found this post helpful.
Old 09-05-2013, 11:56 AM   #9
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 910

Rep: Reputation: 174Reputation: 174
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.
 
1 members found this post helpful.
Old 09-05-2013, 12:07 PM   #10
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 910

Rep: Reputation: 174Reputation: 174
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.
 
Old 09-05-2013, 01:32 PM   #11
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Original Poster
Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Quote:
Originally Posted by Z038 View Post
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 View Post
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

Last edited by schneidz; 09-05-2013 at 01:38 PM.
 
Old 09-06-2013, 12:15 AM   #12
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 910

Rep: Reputation: 174Reputation: 174
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.
 
Old 04-05-2014, 12:03 PM   #13
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Original Poster
Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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 ?
 
Old 04-05-2014, 11:58 PM   #14
Z038
Member
 
Registered: Jan 2006
Location: Dallas
Distribution: Slackware
Posts: 910

Rep: Reputation: 174Reputation: 174
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.
 
1 members found this post helpful.
Old 04-06-2014, 02:50 AM   #15
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,103

Rep: Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117
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.
 
1 members found this post helpful.
  


Reply

Tags
cron


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Cron jobs execution order chicken76 Linux - Newbie 2 04-20-2013 06:16 AM
commands to be executed in order for a batch jobs! faizlo Programming 11 01-26-2009 04:43 AM
Which version of Debian linux run over z9EC Mainframe server sivapoorna Linux - Newbie 2 04-17-2008 01:31 PM
Which version of Debian linux run over z9EC Mainframe server sivapoorna Debian 1 04-17-2008 06:57 AM
Which version of Debian linux run over z9EC Mainframe server sivapoorna Linux - Server 1 04-17-2008 04:41 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration