z/OS TSO/E CLISTs
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Including options - the TESTDYN CLIST

z/OS TSO/E CLISTs
SA32-0978-00

You can code options in a CLIST so that the CLIST performs different functions depending on what the invoker specifies.

The TESTDYN CLIST, shown in The TESTDYN CLIST, sets up the environment needed to execute a program called PARMTEST, which tests dynamic allocation input parameters entered from the terminal. In TESTDYN, conditional IF-THEN-ELSE sequences and optional keywords on the PROC statement enable the invoker to select a number of options when invoking the CLIST. For example, one option is whether the invoker wants the system messages that PARMTEST produces sent to a data set rather than to the terminal. TESTDYN includes a keyword parameter, SYSPRINT, on its PROC statement and assigns it a default value of *, which sends system messages to the terminal. The invoker can override that default value and have system messages sent to a system output data set.

Note that special considerations are taken in the processing that determines whether SYSOUT has been coded for SYSPRINT. On the IF statement, the variable &SYSPRINT is enclosed in a &STR built-in function because &SYSPRINT defaults to an asterisk, which the CLIST views as a multiplication operator. The &STR built-in function defines the asterisk as character data and prevents the CLIST from using it arithmetically.

The TESTDYN CLIST

 PROC 0 MBR(PARMTEST) SYSPRINT(*) SYSLIB(LOAD) OUTFILE(VLDPARMS) LISTDSETS

 /**********************************************************************/
 /*   THIS CLIST SETS UP THE ENVIRONMENT NEEDED FOR EXECUTION OF       */
 /*   A PROGRAM NAMED 'PARMTEST' WHICH TESTS DYNAMIC ALLOCATION        */
 /*   INPUT PARAMETERS ENTERED FROM THE TERMINAL.                      */
 /**********************************************************************/

 /**********************************************************************/
 /*    IF THE USER REQUESTED THAT DATA SETS BE LISTED, LIST THEM.      */
 /**********************************************************************/

 IF &LISTDSETS = LISTDSETS THEN + 
  DO
   WRITE PROGRAM:   &MBR
   WRITE SYSPRINT:  &SYSPRINT
   WRITE SYSLIB:    &SYSLIB
   WRITE OUTFILE:   &OUTFILE
 END
 /**********************************************************************/
 /*    IF THE USER REQUESTED THAT SYSTEM MESSAGES BE SENT TO A SYSTEM  */
 /*    OUTPUT DATA SET, ALLOCATE SYSPRINT TO SYSOUT.  OTHERWISE,       */
 /*    ALLOCATE SYSPRINT TO THE DATA SET NAME (OR TERMINAL) AS         */
 /*    INDICATED BY THE USER.                                          */
 /**********************************************************************/

 IF &STR(&SYSPRINT) = SYSOUT THEN +
  alloc f(sysprint) sysout reu
 ELSE alloc f(sysprint) da(&SYSPRINT) reu
 
 /**********************************************************************/
 /*    ALLOCATE THE SYSTEM LIBRARY, WHETHER IT BE THE DEFAULT (LOAD)   */
 /*    OR ANOTHER LIBRARY.                                             */
 /**********************************************************************/

 alloc f(syslib) da(&SYSLIB) reu shr
 
 /**********************************************************************/
 /*   ALLOCATE THE OUTPUT DATA SET FOR THE PROGRAM.  ALLOCATE THE      */
 /*   INPUT DATA SET TO THE TERMINAL.                                  */
 /**********************************************************************/

 alloc f(outfile) da(&OUTFILE) lrecl(121) blksize(1210) recfm(f,b) reu
 alloc f(sysin) da(*) reu
 /**********************************************************************/
 /*   CALL PARMTEST AND NOTIFY THE USER THAT THE INVOCATION WAS        */
 /*   SUCCESSFUL OR UNSUCCESSFUL.                                      */
 /**********************************************************************/

 CONTROL NOFLUSH
 call 'steve.lib.load(&MBR)'
 IF &LASTCC = 0 THEN +
  WRITE &MBR invoked successfully at &SYSTIME on &SYSDATE
 ELSE +
  WRITE &MBR invoked unsuccessfully at &SYSTIME on &SYSDATE

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014