The SCRIPTDS CLIST enables a user to run the SCRIPT program against
an input data set and have the output printed.
As shown in The SCRIPTDS CLIST, SCRIPTDS requires
a positional parameter, &DSN; The invoker supplies the name of
a PDS member to be printed. The CLIST includes the &DSN variable
as the member name of the memo.text data set on the invocation of
the SCRIPT program. The invoker does not have to supply input for &SYSPREF
because it is a control variable whose value is available to the CLIST.
The inclusion of &SYSPREF as the identification qualifier of
the input data set frees the invoker from having to enter a fully-qualified
data set name. The CLIST also substitutes &SYSPREF and &DSN
on the allocation of the output data set so that its name corresponds
to the name of the input data set.
The SCRIPTDS CLIST
PROC 1 DSN LIST
/**********************************************************************/
/* THIS CLIST (SCRIPTDS) SETS UP THE ENVIRONMENT FOR SCRIPTING A */
/* DATA SET, ISSUES THE SCRIPT COMMAND, AND PRINTS THE OUTPUT. */
/**********************************************************************/
CONTROL NOFLUSH NOMSG
IF &LIST=LIST THEN +
CONTROL LIST
/**********************************************************************/
/* DELETE THE OUTPUT DATA SET INTO WHICH THE SCRIPTED FILE WILL BE */
/* PLACED IN CASE IT IS STILL ALLOCATED FROM A PREVIOUS INVOCATION */
/* OF SCRIPTDS. */
/**********************************************************************/
delete '&SYSPREF.&DSN.list'
/**********************************************************************/
/* DEFINE A FILE NAME (DDNAME) FOR THE OUTPUT DATA SET SO THAT THE */
/* SCRIPT PROGRAM CAN REFERENCE IT. FREE THE FILE BECAUSE SCRIPT WILL*/
/* ALSO ALLOCATE THE DATA SET. */
/**********************************************************************/
alloc f(a) da('&SYSPREF.&DSN.list') dsorg(ps) recfm(v,b,m) +
blk(3156) sp(10,10) tr new release reu
free f(a)
CONTROL LIST
/**********************************************************************/
/* ISSUE THE SCRIPT COMMAND, SPECIFYING THE NAME OF THE DATA SET */
/* MEMBER TO BE SCRIPTED: MEMO.TEXT(&DSN). */
/**********************************************************************/
script '&SYSPREF.memo.text(&DSN)' +
message(delay id trace) device(3800n6) twopass +
profile('script.r3.maclib(ssprof)') +
lib('script.r3.maclib') +
sysvar(c 1 d yes) +
bind(8 8) chars(gt12 gb12) file('&SYSPREF.&DSN.list') continue
/**********************************************************************/
/* FREE THE FILES REQUIRED TO PRINT THE SCRIPTED DATA SET. */
/* THEN ALLOCATE THEM, REQUESTING TWO COPIES ON THE 3800 PRINTER. */
/**********************************************************************/
SET RC=&LASTCC /* Get SCRIPT return code */
IF RC<=4 THEN +
DO
CONTROL NOMSG
CONTROL MSG
alloc f(sysprint) dummy reuse
alloc f(sysut1) da('&SYSPREF.&DSN.list') shr reuse
alloc f(sysut2) sysout(n) fcb(std4) chars(gt12,gb12) +
copies(2) optcd(j) reuse
alloc f(sysin) dummy reuse
/**********************************************************************/
/* INVOKE THE UTILITY TO HAVE THE DATA SET PRINTED AND FREE THE */
/* FILES. */
/**********************************************************************/
call 'sys1.linklib(iebgener)'
free f(sysut1,sysut2,sysprint,sysin)
END