You can write CLISTs that invoke programs in either the foreground
or the background. By creating a background job, the CLIST can have
the job invoke any program, including itself, in the background. You
can use this type of a CLIST to enable users who are unfamiliar with
JCL to submit programs. By placing the JCL in a CLIST, you simplify
the user's work, while adding greater range to the tasks the user
can perform. The RUNPRICE CLIST, shown in Figure 1,
illustrates this type of a CLIST.
RUNPRICE either executes a COBOL program called APRICE in the foreground
or submits a job that executes APRICE in the background. The CLIST
determines which type of invocation to perform based on whether the
invoker includes the BATCH keyword on the invocation of RUNPRICE.
Figure 1. The RUNPRICE
CLIST PROC 0 M(R) BATCH
/**********************************************************************/
/* THIS CLIST (RUNPRICE) SUBMITS A JOB FOR EXECUTION EITHER IN THE */
/* FOREGROUND OR BACKGROUND, BASED ON WHETHER THE INVOKER INDICATES */
/* 'BATCH' ON THE INVOCATION. THE MESSAGE CLASS DEFAULTS TO 'R', */
/* THOUGH THE INVOKER MAY CHANGE IT. */
/**********************************************************************/
CONTROL END(ENDO)
/**********************************************************************/
/* IF &BATCH DOES NOT EQUAL A NULL, THIS INDICATES THAT THE INVOKER */
/* INCLUDED THE KEYWORD ON THE INVOCATION. IN THIS CASE, THE INVOKER*/
/* WANTS THE JOB SUBMITTED IN THE BACKGROUND, SO CREATE A JOB THAT */
/* EXECUTES THE TMP AND THEN INVOKES RUNPRICE WITHOUT THE 'BATCH' */
/* KEYWORD. ON THIS SECOND INVOCATION OF RUNPRICE, ONLY THE */
/* APRICE PROGRAM IS EXECUTED. */
/* IF &BATCH EQUALS A NULL, THIS INDICATES THAT THE INVOKER WANTS */
/* TO START THE PROGRAM IN THE FOREGROUND. IN THIS CASE, SIMPLY */
/* INVOKE THE APRICE PROGRAM DIRECTLY. */
/**********************************************************************/
SET SLSHASK=&STR(/*) /* Set the /* for JOBPARM to a variable */
IF &BATCH=BATCH THEN +
DO
CONTROL NOMSG
SUBMIT * END(NN)
//STEVE1 JOB 'accounting info','STEVE',
// MSGLEVEL=(1,1),CLASS=T,NOTIFY=&SYSUID,MSGCLASS=&M,
// USER=????????,PASSWORD=????????
&SLSHASK JOBPARM COPIES=1
//BACKTMP EXEC PGM=IKJEFT01,REGION=4096K,DYNAMNBR=10
//SYSPRINT DD DUMMY
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
ex 'd84rlh1.tsoer2.pubs.clist(runprice)'
NN
ENDO
ELSE call 'd60fot1.allot.cobol(aprice)'