mainframezosdb2-zosdbms-job

DB2 Z/OS V10 Mainframe : How to create jobs


Which language can I use in z/OS to create a job in DB2 Z/OS V10?

In Z/OS Mainframe, please provide example script to create or SUBMIT a JOB which executes stored procedures.


Solution

  • Though I agree with Bill W. (above), I thought I'd provide a bit of detail here in case someone genuinely wants to write an app that can submit a mainframe job.

    At the core, a "job" in z/OS is just a series of JCL statements that define a unit of work. The good news is that there are lots of ways jobs can flow into z/OS:

    The various "SUBMIT" commands can usually be scripted without too much trouble if you're looking to do something simple.

    If you need to submit a job in a script or other software, the cool thing to remember is that jobs can be submitted just by opening a special file called the internal reader. All you need to do is allocate and open the internal reader, then write your JCL (typically fixed, 80 byte records), then close the internal reader - viola, your job is submitted.

    You can allocate the internal reader a number of different ways. In JCL, it's as easy as //ddname DD SYSOUT=(,INTRDR). You can also use the TSO ALLOC command, and so forth - there's even good support in the LE runtime, making the internal reader accessible to C, Java, COBOL and so forth. And for the bit-level (assembler) folks, SVC 99 provides everything you need to allocate an internal reader.

    Once you have an internal reader file allocated, you just open and write to it as though it was any other file. Under the covers, the internal reader is just a "pipe" to JES, the "job entry subsystem"...as you might guess, JES handles (among other things) handling job submissions. With that pipe to JES open, what you write should be JCL representing the job you want to submit.

    If you're running on some other platform and want to submit work to z/OS, then FTP can be the simplest path. Connect as normal and enter the SITE command above, then you can "PUT" a file containing a set of JCL records. One cool thing about the FTP interface is that it gives you back a job identifier that you can use to track the job and fetch its output.

    Keep in mind that there are various options and security controls to restrict who can do what on z/OS, so you might have other hurdles to overcome if your site has protected the privilege of submitting jobs.

    There's my two-cents worth on submitting jobs on z/OS... :)