0

We have a lot of jobs(jcl) running on the mainframe. I was asked to try and start a restore job. I have to do this with a C# application.

What i got now is i am able to connect to the mainframe with an ftp library and I can call raw FTP commands that the mainframe understands.

I kind of know how to submit a .jcl file, which will be processed as a job if I use the command "quote site filetype=jes".

My questions are: - Is there a way to start an existing job? - Does it matter what "directory"/partition(?) I have navigated to before submitting a job?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
  • 1
    What do you mean, exactly, by "start an existing job?". What is the context of you being asked to do this? For Production? Testing? Development? Whose jobs are you running? How is the information of what job accurately presented to you? And more. In short, you need to give a full explanation, including why you want to do what would perhaps be done by a Scheduler or the Operations/Production Control/Support department. – Bill Woodger Jul 09 '15 at 12:42

3 Answers3

0

You could submit the below JCL through FTP and it would run the JCL in JOB.LIBRARY(JOB)

//JS010    EXEC  PGM=IEBGENER
//SYSUT1   DD  DSN=JOB.LIBRARY(JOB),DISP=SHR
//SYSUT2   DD  SYSOUT=(,INTRDR)
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
Deuian
  • 831
  • 1
  • 6
  • 12
  • This could be an answer, if we knew what was meant by "start an existing job". But we don't. Do we? I guess you give an implicit answer to the second part, but this will stumble anyway if use of the INTRDR is not permitted. I think we should wait for clarification of the question before proceeding. – Bill Woodger Jul 10 '15 at 16:33
0

Expanding on Bills comments, is this a Production, Development, Test, QA etc job. In production on mainframe's, jobs are normally run using a Scheduler (e.g. Ca7 or Workload Scheduler for z/OS (formerly OPC) + several others). Some sites also use Schedulers in QA / Development as well, but this is rare.

Submitting a job via a scheduler

To submit via a scheduler you MUST talk to the Operations / Production Control / Mainframe Support department. They should know what is possible and have preferred ways of doing something like this. They should also know what access is required !!!

Possible options would include:

  • Most schedulers have the option of submitting a job / schedule when a Dataset (File for non-mainframer's) is created. If available this will probably be the easiest to implement.
  • All schedulers provide programs that can submit schedules.
    • You may be able to run a job that submits the appropriate job
    • Run a program in the foreground to submit the appropriate job
  • These days most of the schedulers would have a Web interface, they may also have interfaces on other platform. This option is probably not going to be available though.

Submitting a job

If you are just going submit the job, options include:

  • Copying the job to the INTRDR as @Deuian has done (either foreground or background).
  • Running TSO background

Submitting via job (from Deuian's answer):

//JOBNAME JOB ...
//JS010   EXEC PGM=IEBGENER
//SYSUT1   DD  DSN=JOB.LIBRARY(JOB),DISP=SHR
//SYSUT2   DD  SYSOUT=(,INTRDR)
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY

Finally to do anything on the Mainframe, you will need the appropriate security access !!!


I have tried to provide a background information + a basic guide of the option available. Basically you need to talk to Mainframe-Operation / Mainframe-programmers !!!.

Bruce Martin
  • 10,358
  • 1
  • 27
  • 38
0

Yes, you can - just execute the RETR 'DATASET.NAME' FTP command. Remember that the quotes here are important - without quotes the command would be interpreted as "read spool files by JOBID". And with quotes it would be interpreted as "submit an existing JCL data set, wait for job to complete and retrieve it's spool". And it doesn't matter what directory you have navigated to before submitting a job.
You can refer to my Java implementation of JES client which works through FTP - https://github.com/vadimshchukin/jesclient. It has code which does exactly what you want: public JESJob execute(String datasetName) throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); retrieveFile(String.format("'%s'", datasetName), outputStream); JESJob job = new JESJob(this); job.setSpool(outputStream.toString()); return job; }