COBOL Control Statements | IF-ELSE, PERFORM, EVALUATE & GO TO | COBOL Tutorial
#COBOL #topictrick Master COBOL Control Statements in this complete tutorial — covering IF-ELSE, PERFORM, EVALUATE, and GO TO statements with practical examples. Essential viewing for any COBOL developer or mainframe professional. ► COBOL PERFORM — four variants: PERFORM UNTIL, PERFORM n Times, PERFORM VARYING, and PERFORM THRU, all explained with examples. ► COBOL EVALUATE — a cleaner alternative to nested IF-ELSE. Covers EVALUATE THRU, EVALUATE ALSO TRUE, and practical EVALUATE examples. ► COBOL IF-ELSE — compound and nested conditions explained. Best practice: use EVALUATE instead of deeply nested IF-ELSE for better performance and readability. ► COBOL GO TO — transfers control between sections and paragraphs in the Procedure Division. Covered for completeness though rarely used in modern COBOL. ► What you'll learn: 0:00 Welcome to COBOL Control Statements 0:06 Introduction 2:06 COBOL IF-ELSE Statements 5:46 COBOL PERFORM Statements 8:36 COBOL Evaluate Statements 11:10 COBOL GOTO Statement 12:21 Mainframe Tutorial Ends Perform statement in COBOL has four variants that are "COBOL PERFORM UNTIL", "COBOL PERFORM n Times", COBOL PERFORM VARYING and COBOL PERFORM THRU. All these variants are explained with COBOL Perform examples. COBOL EVALUATE Statement is better then IF-ELSE in performance. COBOL Variant has four variants such as COBOL EVALUATE THRU, COBOL EVALUATE ALSO TRUE, COBOL EVALUATE Example. COBOL IF-THEN-ELSE statement is used to the selection, in COBOL you have compound and nested conditions. It is always recommended that you should prefer COBOL Evaluate than nested if-else statements. COBOL GOTO statement is used to transfer control from one section or paragraph to another section or paragraph within procedure division. COBOL goto is not used very often these days. Now, let's look at a couple of example of COBOL EVALUATE Statement, COBOL PERFORM, COBOL IF-THEN-ELSE and COBOL GOTO statement. COBOL PERFORM SYNTAX. Following are an example of four different types of PERFORM STATEMENT In COBOL. 1. PERFORM A000-CAL-SALE 1 Times. 2. PERFORM UNTIL EOF READ EMP-FILE .... END-PERFORM. 3. PERFORM A000-CAL-TBL VARYING I FROM 1 BY 1 Until EOF 4. PERFORM A000-CAL-TAX THRU A000-EXIT COBOL EVALUATE STATEMENT SYNTAX. Following are a couple of example of EVALUATE Statement. EVALUATE TRUE WHEN WS-CAL = 'JAN' PERFORM A000-CALC WHEN OTHER CONTINUE END-EVALUATE. EVALUATE TRUE ALSO TRUE WHEN WS-A = WS-B and WS-C = WS-D PERFORM A000-CALC-TAX WHEN OTHER CONTINUE END-EVALUATE. COBOL IF-THEN-ELSE Syntax. IF WS-A = 10 THEN DISPLAY "NUMBER 10" END-IF. COBOL GOTO Syntax. 1. GO TO A00-CALC 2. GO TO A000-CALC DEPENDING on WS-TX-VAL ►Subscribe to Topictrick & Don't forget to press THE BELL ICON to never miss any updates. ◄ Also, Please visit below mention the link to stay connected with Topictrick on - ► Official Website : https://www.topictrick.com ► Youtube : topictrick ► Follow us on Twitter : https://twitter.com/topictrick ► Facebook : https://www.facebook.com/topictrick/ ► Linkedin : https://www.linkedin.com/showcase/topictrick ► Reddit : https://www.reddit.com/r/topictrick/ ► Mainframe Blog : https://mainframe-forum.blogspot.com ► Medium Blog : https://topictrick.medium.com/ Thank you for your support. Topictrick™
Download
0 formatsNo download links available.