z/OS CLIST tutorial (DRAFT)

CLIST

  1. Language definition:

1.0 Comments

  /* THIS IS A COMMENT */

1.1 Header

      PROC 0          /* PROC [NUM PARAMETERS]            */
      PROC 1 XXXXXXXX /* New rutine PARAMETER1 = XXXXXXXX */

1.2 Variables

  PROC 1 INPUT
  SET VARIABLE = &INPUT
  SET STRING = HELLO WORLD

1.3 Conditional

  IF &VARIALBE = TEST THEN +
      WRITE TEST
  ELSE IF &VARIABLE = PROD THEN +
      WRITE PROD
  ELSE IF &VARIABLE ¬= NEGA THEN +
      WRITE OTHR
  ELSE DO +
      WRITE ERR1
      EXIT
  END

1.4 While

  SET WHILE = &STR(ABC)
  DO UNTIL &WHILE = &STR(ABC) WHILE (&COUNT<5)
      SET &COUNT = &COUNT + 1
  END

1.5 Strings

  IF &SUBSTR(1:4,&SYSUID) ¬= TEST AND +
     &SUBSTR(1:3,&SYSUID) ¬= DEV  AND THEN DO
      WRITE "NOT ALLOWED"
     END

1.6 Execute commands

  LISTUSER
  SELECT PGM(ISRUDL) PARM(ISRUDLP) SCRNAME(DSLIST)

1.7 ISPF panels

      ISPEXEC SELECT PANEL(XXX)
  1. Execute a CLIST

2.0 TSO EXEC

      TSO EXEC 'DATASET.CLIST(PROGRAM)'

2.1 Alloc to SYSPROC

      TSO ALLOC FILE(SYSPROC) DATASET('DATASET.CLIST') SHR REUSE
              TSO %PROGRAM