Page 1 of 2

How to trigger a jcl from a windows .bat file?

PostPosted: Fri Jun 29, 2012 9:48 am
by chandra 2185
Hi,

My case is to trigger a job on the mainframe when the user clicks a .bat file script to perform some activity. How can I do this. This is very urgent I have a user demo coming up. Please share asap and the help is highly appreciated.

Thanks.

Re: How to trigger a jcl from a windows .bat file?

PostPosted: Fri Jun 29, 2012 12:17 pm
by NicC
Do not ask for urgent requests on a forum. People here answer on their own time and if they feel inclined to. If you want urgent then pay someone to come in. Or ask the people who are likely to know - those in your own company like your network people and scheduling people.

Re: How to trigger a jcl from a windows .bat file?

PostPosted: Fri Jun 29, 2012 2:36 pm
by Robert Sample
What does "trigger a job" mean -- the term is usually used with a job scheduler such as Tivoli or CA-7, and you would have to find the manuals at your site for whichever product you have, review the API documentation, and determine whether or not what you want to do can even be done with the product, period.? A PC can submit a job on a mainframe by using FTP into JES, but that's about as much as can be done from a PC.

Re: How to trigger a jcl from a windows .bat file?

PostPosted: Fri Jun 29, 2012 7:34 pm
by dick scherrer
Hello,

Does the pc process also send a file to the mainframe?

If it does and there is scheduling software running on the mainframe, the schedule can submit a job when the file arrives on the mainframe.

If the pc process does NOT send a file, suggest you do as Robert said and use FTP to present the job to the mainframe.

Re: How to trigger a jcl from a windows .bat file?

PostPosted: Fri Jun 29, 2012 7:41 pm
by chandra 2185
Hi Robert,

I am looking to make pc to submit a job to the mainframe. Any sample scripts would help me. I think this would solve my purpose. Thanks in advance.

Re: How to trigger a jcl from a windows .bat file?

PostPosted: Fri Jun 29, 2012 8:31 pm
by Robert Sample
If your Windows FTP command file contains
QUOTE SITE FILETYPE=JES
then your transmitted data will be submitted to JES as a job rather than stored as a file.

Re: How to trigger a jcl from a windows .bat file?

PostPosted: Fri Jun 29, 2012 9:49 pm
by chandra 2185
Hi Robert,

Thank you. But then do I have to have a jcl in the script which again going to invoke the actual. I mena i have to use the intrdr iebedit to invoke my jcl. from the script.

Re: How to trigger a jcl from a windows .bat file?

PostPosted: Fri Jun 29, 2012 9:54 pm
by Robert Sample
When you FTP to JES, you are sending JCL to execute a job, which means that JCL has to be part of the Windows script that starts up the FTP. What program(s) that job executes once the JCL is submitted depends upon you and what you want the job to do.

Re: How to trigger a jcl from a windows .bat file?

PostPosted: Fri Jun 29, 2012 10:29 pm
by Ed Goodman
If you use the PUT command after switching to JES, then you need to have the full job on the PC. The Put command will take that text file and submit it to the INTRDR. You get back the name/number of the job which was submitted. The PUT command does NOT wait for the job to finish.

If you use the GET command after switching to JES, then it will find a file on the mainframe that is already there and submit THAT to the INTRDR. It will wait for the job to finish until the FTP time out is reached.

If you want to see the status of a running job, you can use the DIR command after switching to JES. The jobnum parm gives you some filtering.

I've used both ways, and I like the PUT option because if frees up the connection immediately. What I do is build the job on the PC, then send that job to a mainframe member, then switch to JES and submit it and grab the job num. Then I have my PC app do occasional DIRs on that job num to get the status. Then I do a GET on the Jobnum to read the job output into a file on the PC, then parse that file for the results.

It sounds worse than it is. I have a reusable Delphi unit with the steps in it and just plug it in as needed.

Re: How to trigger a jcl from a windows .bat file?

PostPosted: Sat Jun 30, 2012 12:16 am
by chandra 2185
Robert Sample wrote:When you FTP to JES, you are sending JCL to execute a job, which means that JCL has to be part of the Windows script that starts up the FTP. What program(s) that job executes once the JCL is submitted depends upon you and what you want the job to do.


Hi Robert,

This is the code i have in the .bat file but when i exceute it i dont see anything happening can you please guide me.
the code is:
ftp
ftp
open ip address
user
pwd
jcl the sample looks like this
//IEBEDITA JOB (XXXXXXXX,,,,,XXXX),' ',CLASS=T,
// MSGCLASS=Y,NOTIFY=&SYSUID
//*===========================================================
//* EXAMPLE FOR IEBEDIT UTILITY
//*===========================================================
//STEP001 EXEC PGM=IEBEDIT
//SYSUT1 DD DSN=USERID.ABC.JCLLIB(JOBNAM1),DISP=SHR
//SYSUT2 DD SYSOUT=(*,INTRDR)
//SYSPRINT DD SYSOUT=*
//*
//
close
quit
in the above the job - jobnam1 is the actual that can excute the pgm tat i wanted to but the jcl mentioned in the script is used to invoke that jcl from jes. Please help where I am going wrong.
Thanks.