MainframeSupports
tip week 49/2007:

One of the real good things about MVS is the ability to submit batch jobs and continue to work online while the batch job executes something that would otherwise hang up your online session. Most of us use ISPF EDIT/VIEW to create the batch job and then we use the SUBMIT command to submit the batch job. If I need to execute the same batch job with small changes (for instance another dataset name) I will create some ISPF File Tailoring to build the JCL with. ISPF File Tailoring is a useful tool, but it is a little unhandy to use especially in the batch environment.

One day I could not see why I should make a lot of ISPF File Tailoring just to replace one dataset name with another. It would be much easier to have some simple JCL where I just made the replacement temporarily. This lead me to the idea of creating my own SUBMIT command:

/* REXX: MYSUB */
DROP MYJCL.
DROP NEWJCL.
JCLCOUNT = 0
ADDRESS TSO "EXECIO * DISKR MYJCL (STEM MYJCL. OPEN FINIS"
DO LINENO = 1 TO MYJCL.0
  /* START MANIPULATING THE JCL-INPUT LINE */
  MANIPULATEDLINE = TRANSLATE(MYJCL.LINENO)
  /* END OF MANIPULATING THE JCL-INPUT LINE */
  JCLCOUNT = JCLCOUNT + 1
  NEWJCL.JCLCOUNT = MANIPULATEDLINE
END
IF JCLCOUNT > 0
THEN DO
  NEWJCL.0 = JCLCOUNT
  ADDRESS TSO "ALLOC FI(NEWJCL) SYSOUT WRITER(INTRDR)"
  ADDRESS TSO "EXECIO * DISKW NEWJCL (STEM NEWJCL. OPEN FINIS"
  ADDRESS TSO "FREE FI(NEWJCL)"
END

This REXX reads the data allocated to DD name MYJCL, translates the data into capital letters and submits the job through internal reader also called INTRDR. INTRDR is the direct line to JES. The only interesting thing about the REXX is the allocation of a DD name to INTRDR. You can only write data to INTRDR and JES only uses the data appearing after a valid JOB card.

Now it is only your imagination that sets the limits of what you want to put into JES through internal reader. The above REXX may read JCL from many different sources, like the ISPF EDIT/VIEW session or from DB2 if you have access to a REXX/DB2 interface. It can scan for &variables and substitute them with real values like ISPF File Tailoring does it. Maybe you want to build your own ISPF file tailoring tool. By the way: if you want to allocate INTRDR in a job you must use the following DD name:

//NEWJCL   DD SYSOUT=(A,INTRDR)

Quite simle when you know how to do it.

Previous tip in english        Sidste danske tip        Tip list