如果条件为真,则执行IF块; 如果条件为假,则执行ELSE块。 END-IF用于结束IF块。 要结束IF块,可以使用句点代替END-IF。 但总是最好将END-IF用于多个IF块。 Nested-IFIF块出现在另一个IF块内。 嵌套IF语句的深度没有限制。 语法(Syntax) 以下是IF条件语句的语法 - IF [condition] THEN [COBOL statements] ...
Nested-IF:IF块出现在另⼀个IF块中。嵌套IF语句的深度没有限制。句法以下是IF条件语句的语法:IF[condition]THEN[COBOLstatements]ELSE[COBOLstatements]END-IF.例IDENTIFICATIONDIVISION.PROGRAM-ID.HELLO.DATADIVISION.WORKING-STORAGESECTION.01WS-NUM1PIC9(9).01WS-NUM2PIC9(9).01WS-NUM3PIC9(5).01WS-NUM...
A64) EVALUATE can be used in place of the nested IF THEN ELSE statements. Q:COBOL II中的EVALUATE相当于取代了COBOL中的什么结构 A:EVALUATE相当于取代了COBOL中的IF THEN ELSE的嵌套语句 Q65)What is the significance of ‘above the line' and ‘below the line’? A65)Before IBM introduced MVS/XA...
Nested IF: Syntax: IF Condition-1 THEN IF Condition-2 THEN Statements-block-1 [ELSE Statements-block-2 END-IF] [ELSE IF Condition-3 THEN Statements-block-3 [ELSE Statements-block-4 END-IF] END-IF.] Example 1: IDENTIFICATION DIVISION. PROGRAM-ID. TSTHELLO. DATA DIVISION. WORKING-STORAGE...
By using nested PERFORM statements, you could achieve the same processing results as in OS/VS COBOL, as follows: MOVE 1 TO X, Y, Z PERFORM EX-1 VARYING X FROM 1 BY 1 UNTIL X > 3 . . . EX-1. PERFORM ABC VARYING Y FROM Z BY 1 UNTIL Y > 3. MOVE X TO Z. ABC. ...
END-IF:⽤于结束IF块。也可以使⽤⼀个句号替代END-IF结束IF块。但是对于多个IF块,最好使⽤END-IF。***Nested-IF(嵌套)***:IF块出现在另⼀个IF块中。嵌套IF语句的深度没有限制。语法 以下是IF条件语句的语法:IF[condition]THEN [COBOL statements]ELSE [COBOL statements]END-IF.例 ...
There are four types of conditions that could be tested either in a PERFORM, IF..THEN, or EVALUATE. Cobol Evaluate If there are a large number of conditional alternatives, then using a large number of nested IF statements can be messy. ...
EVALUATEWe can use EVALUATE instead of set of nested IF statements to test several conditions. We can use EVALUATE to implement case structure or decision table. Example1 : EVALUATE WS-INDICATOR WHEN �A� DISPLAY �This is Alphabetic filed� WHEN �N� DISPLAY �This is Numeric fi...
COBOL programs are often difficult and time-consuming to debug and/or maintan due to the lack of readability. This is especially true when there are nested if-else statements without good indentation or when there are several different styles of record descriptions. This can happen for several ...