Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

6.2.19 IF Statement

The IF statement evaluates a condition and provides for alternative actions in the object program, depending on the evaluation.

    ___ Format _____________________________________________________________ 
   |                                                                        |
   |                                  <_____________                        |
   | >>__IF__condition-1__ ______ __ ___statement-1_|_ ___________________> |
   |                      |_THEN_|  |_NEXT SENTENCE___|                     |
   |                                                                        |
   | >__ ___________________________ __ ___________ _____________________>< |
   |    |         <_____________    |  |        (1)|                        |
   |    |_ELSE__ ___statement-2_|_ _|  |_END-IF____|                        |
   |            |_NEXT SENTENCE___|                                         |
   |                                                                        |
   | Note:                                                                  |
 X | (1)  END-IF can be specified with NEXT SENTENCE as an IBM extension.   |
   |                                                                        |

Can be any simple or complex condition, as described in "Conditional Expressions" in topic 6.1.6.

statement-1, statement-2
Can be any one of the following:

  • An imperative statement
  • A conditional statement
  • An imperative statement followed by a conditional statement
If the NEXT SENTENCE phrase is specified, then the END-IF phrase must not be specified.

X END-IF can be specified with NEXT SENTENCE. However, if the NEXT
X SENTENCE phrase is executed, control will not pass to the next
X statement following the END-IF but instead will pass to the statement
X after the closest following period.


Previous Topic Next Topic Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.

Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS

Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.