1 / 19

COBOL

COBOL. By: Joshua Thomas Ignatius Towers. Overview. What is COBOL History Design Implementations What did it do Program structure Data types Syntax Sample Evaluation. What is COBOL. CO mmon B usiness O riented L anguage. History. Progenitor FLOW-MATIC primary

grace
Download Presentation

COBOL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COBOL By: Joshua Thomas Ignatius Towers

  2. Overview What is COBOL History Design Implementations What did it do Program structure Data types Syntax Sample Evaluation

  3. What is COBOL COmmonBusiness Oriented Language

  4. History • Progenitor • FLOW-MATIC primary • Implemented in 1957 • For use in UNIVAC • AIMACO • U.S. Air Force • COMTRAN • IBM

  5. History Grace Hopper 1953 “Mathematical programs should be written in mathematical notation, data processing programs should be written in English statements” (Sebesta) First Prototype used English, French, and the German

  6. Design Designed in a Committee Committee The Department of Defense sponsored

  7. Design Use as much English as possible Easy to use even at the expense of power Easy to read even for non programmers Should not be restricted by implementation

  8. Implementations COBOL 60 COBOL 74 COBOL 85 COBOL 2002

  9. What Did It Do • DEFINE • First high level construct for macros • Records • First implemented in COBOL • Long names with connector characters • Data Description section

  10. Program structure • Hierarchy • Divisions, Sections, Paragraphs, Sentences, and Statements • Divisions • Identification, Environment, Data, and Procedure

  11. Data Types • Numeric • ‘S’, ‘V’, ‘9’ • Alphabetic • ‘A’ • AlphaNumeric • ‘X’, ‘S’, ‘V’, ‘9’, ‘A’ • Figurative Constants • SPACE, ZERO

  12. Syntax • If • Arithmetic • ADD, SUBTRACT, MULTIPLY, DIVIDE, COMPUTE

  13. Syntax Evaluate

  14. Syntax PREFORM

  15. Sample $ SET SOURCEFORMAT"FREE" IDENTIFICATION DIVISION. PROGRAM-ID. Iteration-If. AUTHOR. Michael Coughlan. DATA DIVISION. WORKING-STORAGE SECTION. 01 Num1 PIC 9 VALUE ZEROS. 01 Num2 PIC 9 VALUE ZEROS. 01 Result PIC 99 VALUE ZEROS. 01 Operator PIC X VALUE SPACE. PROCEDURE DIVISION. Calculator. PERFORM 3 TIMES DISPLAY "Enter First Number : " WITH NO ADVANCING ACCEPT Num1 DISPLAY "Enter Second Number : " WITH NO ADVANCING ACCEPT Num2 DISPLAY "Enter operator (+ or *) : " WITH NO ADVANCING ACCEPT Operator IF Operator = "+" THEN ADD Num1, Num2 GIVING Result END-IF IF Operator = "*" THEN MULTIPLY Num1 BY Num2 GIVING Result END-IF DISPLAY "Result is = ", Result END-PERFORM. STOP RUN.

  16. Sample Output

  17. Sample 2 IDENTIFICATION DIVISION. PROGRAM-ID. Conditions. AUTHOR. Michael Coughlan. * An example program demonstrating the use of * condition names (level 88's). * The EVALUATE and PERFORM verbs are also used. DATA DIVISION. WORKING-STORAGE SECTION. 01 Char PIC X. 88 Vowel VALUE "a", "e", "i", "o", "u". 88 Consonant VALUE "b", "c", "d", "f", "g", "h" "j" THRU "n", "p" THRU "t", "v" THRU "z". 88 Digit VALUE "0" THRU "9". 88 ValidCharacter VALUE "a" THRU "z", "0" THRU "9". PROCEDURE DIVISION. Begin. DISPLAY "Enter lower case character or digit. No data ends.". ACCEPT Char. PERFORM UNTIL NOT ValidCharacter EVALUATE TRUE WHEN Vowel DISPLAY "The letter " Char " is a vowel." WHEN Consonant DISPLAY "The letter " Char " is a consonant." WHEN Digit DISPLAY Char " is a digit." WHEN OTHER DISPLAY "problems found" END-EVALUATE END-PERFORM STOP RUN.

  18. Evaluation Readability Write ability Reliability Cost

  19. Sources Coughlan, Michael. Cobol Tutorial. March 1999. October 2011 <http://www.csis.ul.ie/cobol/course/DataDeclaration.htm>. Hodgson, Jonathan. Sample COBOL program. 7 February 2000. <http://www.sju.edu/~jhodgson/cobol/sample.html>. IBM. "Language Reference Version 3 Release 3." IBM, February 2004. McCloskey, Robert. COBOL Subprograms. <http://www.cs.uofs.edu/~mccloske/courses/cmps340/lecture_notes/cobol_subprogs.html>. Merant. Programmer's Guide to Writing Programs. 1999. <http://supportline.microfocus.com/documentation/books/oc41books/prconc.htm>. Reimann, Artur. COBOL 2000. San Jose: Fujitsu Software Corporation, 1999. —. "Object Oriented Programming in COBOL 2000." Fujitsu Software Corporation, 1999. Sebesta, Robert W. Concept of Programming Languages. Boston: Pearson Education, 2009. Towers, William. Manager Data Storage Joshua Towers. November 2011. Coughlan., M. (n.d.). COBOL Example Programs . Retrieved from Department of CSIS: http://www.csis.ul.ie/cobol/examples/default.htm#Selection

More Related