You are here: Home > Knowledge Refreshers

KR editions 73 to 74


KR-73: EXCLUDE Command

Sometimes we might want to exclude certain lines from our dataset or simplify the dataset by deleting particular lines alone. You may find the EX command handy. 


EXCLUDE: can exclude specific lines from the dataset currently being edited/viewed. 

Syntax: EXCLUDE (or X or EX) criteria 

1.) For example on the command line (after opening a file), just type: 
    EX ALL " " 3 
This will exclude all lines that have a space in the 3rd column of the dataset. This is useful to filter out main JCL statements and also useful in option 3.13 (while searching for a string you can get the display of members where the string is found rather than a display of all the instances within each member). 

2.) EX ALL //* 
will exclude all lines containing //* in them. 

3.) You can combine EX with other commands; for example the sequence: 
      EX ALL //* 
will exclude all lines with //* (in a JCL it is the comments). 
Then typing: 
      DELETE ALL EX 
will end up deleting all the excluded lines (which means that all comments would be deleted from the file). 
Or: DELETE ALL NX 
would lead to deletion of all the non-excluded lines (NX=non-excluded and EX=excluded) 


KR-74: IF-THEN-ELSE-ENDIF statements 

We had a short KR on the IF condition in JCLs. A little extension to that one follows. 

IF-THEN-ELSE-ENDIF statements: 

  • Syntax : 

// IF(condition) THEN 
//JCL statements 
// ELSE 
//JCL statements 
// ENDIF 
Upto 15 levels can be coded. 

  • You can check for the return code of the previous step

          Like : // IF ( step01.RC=0) THEN

  • The operators which can be used are: 

& , AND : Logical AND 
OR : Logical OR 
GT, > : Greater than 
LT, < : Less than 
GE >= : Greater than equal to 
LE <= : Less than equal to 
NOT : Logical NOT 
NE : Not equal to 
NL : Not less than 
NG : Not greater than

  • Other keywords used for condition-checking are ABEND and RUN

Ex: // IF (step1.ABEND) 
or // IF (step1.RUN) 
This is same as // IF (step1.ABEND=TRUE) and // IF (step1.RUN=TRUE). 
We can also check the reverse condition as // IF (step1.ABEND=FALSE) and // IF (step1.RUN=FALSE).  

  • We can also check for system & user completion codes: // IF (step1.ABENDCC=U4039) or // IF (step1.ABENDCC=SB37) 


Go back to the main contents page