JCL Session 11
CLISTS (Command List)
-
CLISTs should be stored in PDS
-
CLIST code can be 80 to 255 bytes fixed length
( 80 character length is best for most editors).
Possible uses for a CLIST
User interface for entering program dependent
parameters
Can use whatever commands are listed under
TSO HELP
Don't have to remember a complex series of
command sequences
Can use commands to control system resources
Can establish foreground execution of what
JCL does for background
MYCLIST is a member of CCPR00.CCP.CLIST
Contents of MYCLIST: HELP
Four modes of starting a CLIST::
Mode |
TSO Command Syntax |
Example |
Explicit |
EXEC/EX
-
followed by 'complete name of dataset' within
single quote marks
|
EX
'CCPR00.CCP.CLIST(MYCLIST)' |
Modified explicit |
EXEC/EX
-
followed by middle names of dataset -- if any
-
use (member_name) at end
the system adds userid at beginning
& 'clist' at end
The example on the right refers to the same
dataset as the example for the Explicit command reference.
|
EX
CCP(MYCLIST) |
Implicit |
member_name
-
Allocate clist library to SYSPROC
-
Issue commands by stating the name of a member.
(Potential conflicts with actual TSO commands)
|
MYCLIST |
Modified implicit |
%member_name
|
%MYCLIST |
Some Useful TSO COMMANDS
TSO HELP: |
lists tso commands available |
TSO HELP LISTALC |
list more details about LISTALC command |
LISTALC STATUS |
list the datasets allocated to a user |
Setup for using CLIST in your TSO Environment
-
Use LISTALC STATUS to determine datasets allocated
to your TSO session.
-
Check for the presence of SYSPROC
Allocating a file with CLIST
ALLOCATE FILE(SYSUT2) DATASET('USERID.PDS.DATA')
NEW CATALOG +
RECFM(F B) LRECL(80) BLKSIZE(4000) TRACKS
SPACE(3 1) +
DIR(15) REUSE
ALLOCATE
PARAMETER |
PURPOSE |
REUSE |
Use a previously allocated file to be used
without first being FREED.
REUSE parameter avoids problems with
files that have already been allocated by previous commands.
|
NEW |
Does not exist, (Default for NEW is CATALOG)
|
OLD |
Exists and want exclusively
. |
MOD |
Data appended to end of dataset if it already
exists.
|
SHR |
Concurrent use of dataset allowed
|
CATALOG
|
Put dataset info into catalogue |
KEEP
|
Retain dataset info |
DELETE |
Remove from VTOC and system catalog
|
UNCATALOG |
Remove from system catalog but not the VTOC
|
Allocating Print resources
ALLOCATE FILE(SYSUT2) SYSOUT(D)
ALLOCATE FILE(SYSUT2) DUMMY
Abbreviate commands by truncation
Command still works as long as uniqueness
is preserved
Allocate command with completely spelled parameters
ALLOCATE FILE(SYSUT2)
DATASET('USERID.PDS.DATA')
NEW CATALOG
+
RECFM(F B) LRECL(80)
BLKSIZE(4000)
TRACKS SPACE(3
1) +
DIR(15) REUSE
Allocate command with abbreviated parameters
ALLOC F(SYSUT2)
DA('USERID.PDS.DATA')
NE CA
REC(F B) LR(80)
BLK(4000) +
TR SP(3 1) DI(15)
REU
CLIST's START PROGRAMS WITH A 'CALL'
STATEMENT
Use a fully qualified dataset name to start
program execution
CALL 'USERID.CSC.LOADLIB(MYPROG)' 'If
using parameters, enclose within single quotes'
RETURN CODES
Can be tested by &LASTCC – return-code
value from previous statement
executed.
&LASTCC can be tested after every
tso command issued
(test after ALLOC to be sure resources are
available)
&MAXCC contains the highest return code
issued but can also be set by commands to have a high value or a
zero.
FREE Resources because
allocated resources stay attached to your
logon session until you logoff.
FREE resources in order to
-
avoid dataset contention,
-
stay below installation limits,
-
or make data available for output processing.
FREE anything previously ALLOCATE
'ed
Example:
Example CLIST to execute IEBGENER
------------------------------------------------------------------------------------------------------------------
ALLOC FILE(SYSUT1) DATASET('JPETLIC.CSC.CNTL(GARBAGE)')
SHR REUSE
ALLOC FILE(SYSUT2) SYSOUT(X) REUSE
ALLOC FILE(SYSPRINT) SYSOUT(X) REUSE
ALLOC FILE(SYSIN) DUMMY REUSE
CALL 'SYS1.LINKLIB(IEBGENER)'
FREE FILE(SYSUT1 SYSUT2 SYSPRINT SYSIN)
CLIST to execute PARMPLUS
ALLOC FILE(SYSIN) DATASET('JPETLIC.CSC.CNTL(PARMJCL2)')
SHR REUSE
ALLOC FILE(SYSOUT) SYSOUT(X) REUSE
CALL 'JPETLIC.CSC.LOADLIB(PARMPLUS)' 'ABC'
WRITE THE CONDITION CODE OF PARMPLUS IS &LASTCC
FREE FILE(SYSIN SYSOUT)
CLIST VARIABLES
-
a named area of storage used to hold data
-
not predefined
-
no picture clause
-
can contain numeric and/or character data
-
are dynamic in the length of the data contained
-
can be used anywhere in the code without being
previous defined
-
1st character is A to Z, _, #, $, or @; subsequently
A to Z, 0 to 9, _
-
1 to 252 characters long
-
Preceded with a & when on the right side of
an equal sign
-
optionally preceded with a & when on the left
side of an equal sign
SET command assigns values to a CLIST variable
SET &TEST = &TEST + 1
or
SET TEST = &TEST + 1
ARITHMETIC Commands
Command |
Result |
+ |
Add |
- |
Subtract |
* |
Multiply |
/ |
Divide |
** |
Exponential |
// |
Remainder |
Logical operators
Operator |
Test |
EQ |
Equal |
NE |
Not Equal |
LT |
Less Than |
GT |
Greater Than |
LE |
Less Than or Equal To |
GE |
Greater Than or Equal To |
AND |
Connects conditions |
OR |
Disassociates conditions |
Sample Relational statement
IF (&A GE 10) OR ((&B LT 5) AND (&C
GT 9)) THEN etc.
CHARACTER OPERATIONS
Concatenation Example
SET &FIRST_NAME = JOHN
SET &LAST_NAME = PETLICKI
SET &FULL_NAME = &FIRST_NAME &LAST_NAME
/* FULL_NAME has a blank between first and
last name
SET &FULL_NAME = &FIRST_NAME&LAST_NAME
/* no blank between first and last name
&STR – tells tso to treat the subsequent
variables as character data
More String Commands
COMMAND |
ACTION |
&EVAL |
evaluate variables and do computations |
&SUBSTR(1st_char,last_char,string) |
extract a substring |
&LENGTH(string) |
returns length of a string |
&SYSCAPS(string) |
converts a string to caps |
&SYSLC(string) |
converts a string to lower case |
&SYSINDS(string_sought,string_searched,start_column) |
returns 0 if not found, position if found |
SELECTION STATEMENTS:
------------------------------------------------------------------------------------------------------------------
IF logical_expression THEN statement
|
IF logical_expression THEN statement
ELSE statement
|
IF logical_expression THEN +
ELSE +
|
SELECT
WHEN expression statement
WHEN expression +
OTHERWISE statement
END
|
BRANCHING STATEMENT: GOTO
GOTO label
-
1st char A to Z, subsequent A to Z, 0 to 9, @,
#, $
-
1 to 31 characters long
-
must end in a colon ":"
-
If coded on line by itself, continued with a "+"
Terminating a CLIST
EXIT TERMINATE
EXIT CODE(n) /* TERMINATE
and return n as a condition code.
EXIT CODE(12)
DO groups execute several statements instead
of one
Looping control
|
|
DO variable = FROM expression TO
to_expression BY adder
END
|
TERMINAL I/O
Command |
Function |
WRITE |
Writes a string of constants and variables
and then places cursor on next line |
WRITENR |
Writes string and leaves cursor at end of
line written at terminal |
READ &variable |
Retrieves input from the terminal until user
presses ENTER |
FILE I/O
ALLOCATE FILE(TESTIT) DATASET('USERID.CSC.DATUM')
OLD KEEP REUSE
OPENFILE TESTIT INPUT or OUTPUT or UPDATE
GETFILE TESTIT /*
puts variable information into TESTME
PUTFILE TESTIT /*
writes variable TESTIT to the file
CLOSEFILE TESTIT
FILE testing
%SYSDIN(dataset name)
returns the strings:
OK
PROTECTED DATASET
UNAVAILABLE DATASET
INVALID DATASET NAME – can't
find the dataset
CLIST SYSTEM Variables
Variable Name |
Contents |
&SYSUID |
Contains user id of the current TSO session |
&SYS4DATE |
Date as mm/dd/yyyy |
&SYS4SDATE |
Date as yyyy/mm/dd |
&SYSTIME |
Time as hh:mm:ss |
CLIST CODING RULES
-
One statement per line
-
Cap[italize everything except character literals
-
Continue statements by typing a + or – at the
end of a line.
+ ignore leading blanks
on the continuation
- preserve leading
blanks on the continuation
-
Comments begin with /* end comment with */ if
it doesn't go to end of line
Externally Halting CLIST execution:
-
PA1
-
ATTN
-
SYS REQ (Physically disconnect from TSO session)
CLIST PROC statement
is used to communicate variable information to a CLIST being invoked.
Required variables are defined as positional
parameters
Optional variables are defined as keyword
parameters
EX SAMPLE(HARDCOPY) '''USERID.CSC.CNTL(GARBAGE)''
D 2 AC'
%HARDCOPY 'USERID.CSC.CNTL(GARBAGE)' D 2 AC
If a PROC statement exists in a CLIST, then
the syntax is
PROC
#count_of_positional_parms positional-parameters(s) keyword-parm(s)
POSITIONAL PARAMETERS
-
Must be entered in order for the CLIST to run.
-
Accepts wide range of values including quotes
and parentheses.
-
Does not accept spaces or commas normally used
to delimit separate parms.
-
Positional parameter names can be up to 252 characters
long
If not supplied when the CLIST is called,
the system will prompt with
ENTER POSITIONAL PARAMETER xname
where xname
is the variable name.
KEYWORD PARAMETERS
-
Can have an assigned default within parentheses(
)
-
Can handle spaces, commas and special characters,
including parentheses, when they are enclosed in quotes (Quotes are stripped
away when passed to the CLIST).
-
Defaults are a good idea when there is a value
that will be appropriate the majority of the time.
KEYWORD PARAMETERS EXAMPLE:
MODIFIED KEYWORD PARAMETERS
Keywords on the PROC without a value will
pass the name of the variable itself or a value of spaces.
CLIST EXERCISE (VALUE 30 points)
-
Modify PGMWPARM so that the word ALL is a legitimate
input parameter and is used to print the entire file
-
Modify PGMWPARM so that it also accepts a number
(1 through 15) that limits the amount of output produced. (1 means to print
the first 1 and stop, 3 means print the first 3, 10 – print the first 10,
etc)
-
Code a CLIST (named PGMWPARM) that it prompts
the user for a valid school and a number limit of output which will only
execute the PGMWPARM program if the user enters one of the following legitimate
values:
-
BUS, LAS, LAW, SPE, ALL
-
and a number value from 1 through 15
-
Send the output of PGMWPARM to the hold queue.
-
Input to PGMWPARM is JPETLIC.CSC.CNTL(GRADES).
INSTRUCTIONS FOR EMAILING
MAINFRAME ASSIGNMENTS TO INSTRUCTOR:
1) Logon to SHRIKE.
2) At the prompt type ftp
moses
3) When asked for a name, type
your mainframe login id ccp#%%
4) When asked for a Password,
type your mainframe login password
5) At the ftp> prompt, type
cd clist
6) type get PGMWPARM
7) At the next ftp> prompt,
type quit
8) $ mail jpetlick@condor.depaul.edu
< PGMWPARM