Strictly speaking, this is not all JCL.
- Code: Select all
//A EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD *
/* REXX */
SAY 'HELLO WORLD'
//SYSUT2 DD DISP=(,PASS),
// UNIT=SYSDA,
// SPACE=(TRK,(1,1,1)),
// DCB=(RECFM=FB,LRECL=80,
// BLKSIZE=800),
// DSN=&&EXEC(HELLO)
//SYSIN DD DUMMY
//B EXEC PGM=IKJEFT01,PARM='%HELLO'
//SYSEXEC DD DISP=(OLD,DELETE),DSN=&&EXEC
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
The first job step creates a temporary PDS with our HELLO EXEC in it.
The second step runs TSO to execute the EXEC. The PARM='%HELLO' directs TSO to lcate an exec named HELLO. The output appears in the dataset specified by the SYSTSPRT DD statement. The SYSTSIN DD statement specifies a "dummy" dataset; when TSO tries t read the dataset it gets an end of dataset indication. The SYSEXEC DD statement specifies the temporary PDS from the first step.
You "execute" JCL by "submitting" the dataset or PDS member using the SUBMIT command in TSO. A batch job can submit a dataset or PDS member by using a copy utility and directing the output to a dataset specified as an "internal reader." Although there are some fancy, and often poorly understood bells and whistles in the TSO SUBMIT command, at it's heart it's just a copy program that copies the input dataset to a dataset defined as an "internal reader."