© robertzenuk@newsgroup

The program forms a STEM consisting of Job Control which it passes on to the Internal Reader for execution. This example could be modified in order to read the Job Control from a HFS file.

/* REXX **************************************************************/
/* Purpose: Submit JCL created in a stem variable                    */
/*-------------------------------------------------------------------*/
/* Syntax: jclsub                                                    */
/*********************************************************************/
/* Create JCL records                                                */
/*********************************************************************/
jcl.0 = 2
jcl.1 = '//TESTJOB JOB (0000),TESTJOB,CLASS=A,MSGCLASS=X'
jcl.2 = '// EXEC PGM=IEFBR14'
/*********************************************************************/
/* Allocate a INTRDR DD                                              */
/*********************************************************************/
exitrc = bpxwdyn("alloc dd(sub) sysout writer(intrdr)")
if exitrc <> 0 then say 'Allocate error on INTRDR RC='exitrc
/*********************************************************************/
/* Write the stem to the INTRDR DD                                   */
/*********************************************************************/
address mvs "execio * diskw sub (fini stem jcl."
exitrc = rc
if exitrc <> 0 then say 'EXECIO error on INTRDR RC='exitrc
exitrc = bpxwdyn("free dd(sub)")
if exitrc <> 0 then say 'FREE error on INTRDR' jcl 'RC='exitrc
/*********************************************************************/
/* Shutdown                                                          */
/*********************************************************************/
shutdown: exit(exitrc)
back to REXX in batch