The relevant language in the z/OS MVS JCL Reference is
 
<begin snippet>
The  IF  statement  is  always  followed  by  a  relational-expression  and  a  
THEN  clause. 
Optionally,  an  ELSE  clause  can  follow  the  THEN  clause.  An  ENDIF  
statement 
always  follows  the  ELSE  clause,  if  present,  or  the  THEN  clause. 
v      The  THEN  clause  specifies  the  job  steps  that  the  system  
processes  when  the 
evaluation  of  the  relational-expression  for  the  IF  statement  is  a  
true  condition. 
The  system  evaluates  the  relational-expression  at  execution  time. 
v      The  ELSE  clause  specifies  the  job  steps  that  the  system  
processes  when  the 
evaluation  of  the  relational-expression  for  the  IF  statement  is  a  
false  condition. 
v      The  ENDIF  statement  indicates  the  end  of  the  IF/THEN/ELSE/ENDIF  
statement 
construct,  and  must  be  coded  for  each  construct.
You  can  nest  IF/THEN/ELSE/ENDIF  statement  constructs  up  to  a  maximum  
of  15 
levels.  The  steps  that  execute  in  a  THEN  clause  and  an  ELSE  clause  
can  be 
another  IF/THEN/ELSE/ENDIF  statement  construct. 
</end snippet>
 
Worth emphasizing and important when nesting is used is that  either of THEN 
and ELSE can be vacuous or empty.
 
The constructs
 
|//       IF      <relational expression> THEN
|//       ELSE
|//       . . . 
|//       ENDIF     

and 
 
|//       IF      <relational expression> THEN
|//       . . . 
|//       ELSE
|//       ENDIF
 
are both usable.
 
Moreover, FORTRAN and C programmers who have an emotional need to put 
parentheses around <relational expression> may do so [without, however, 
omitting the following THEN]. 
 
The construct
 
|//       IF      RC ¬= 0  THEN
|//     ELSE
|//     . . .
|//     . . .
|//     ENDIF
 
thus flushes whatever is bracketed by ELSE and ENDIF when a non-zero return 
code obtains.  

John Gilmore Ashland, MA 01721-1817 USA


                                          
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to