862d7804c77fb1eef79a43a50eb8b20d.ppt
- Количество слайдов: 17
COBOL LANGUAGE COmmon Business Oriented Language Sarunya Dechasajja 47541487
BACKGROUND - - Developed in 1959 by a group of computer professionals called the Conference on Data Systems Languages (CODASYL) In 1968 the American National Standards Institute (ANSI) developed a standard form of the language. This version was known as American National Standard (ANS) COBOL. Object-oriented COBOL is a subset of COBOL 97, which is the fourth edition in the continuing evolution of ANSI/ISO standard COBOL. Like the C++ programming language, objectoriented COBOL compilers are available even as
DESCRIPTION OF COBOL LANGUAGE 1. 2. COBOL is a Third-generation programming language, and one of the oldest programming languages still in active use. Defining its primary domain in business, finance, and administrative system for companies and governments. Example of COBOL standard: COBOL-68, COBOL-74 , COBOL-85 and COBOL 2002
LANGUAGE PROGRESSIVE
LANGUAGE PROGRESSIVE
DISTINCTIVE CHARACTERISTIC - - The language that automated business Allows names to be truly connotative - permits both long names (up to 30 characters) and word-connector characters (dashes ( Every variable is defined in detail - this includes number of decimal digits and the location of the implied decimal point File records are also described with great detail, as are lines to be output to a printer - ideal for printing accounting reports Offers object, visual programming environments Class Libraries Rapid Application Capabilities Integration with the World Wide Web
DISTINCTIVE CHARACTERISTIC COBOL, long associated with green screens, core dumps, and traditional mainframe connections, may at first glance seem at odds with object technology , push-button graphical interfaces, and interactive development environments. This perceived incongruity, however, is more a reflection of the mainframe’s ability to keep pace with the innovations of desktop and clientserver computing than a flaw in the COBOL language.
DESIGN GOALS 1. One goal of COBOL's design was for it to be readable by managers, so the syntax had very much of an English-like flavor. - The specifications were to a great extent inspired by the FLOW-MATIC language invented by Grace Hopper - She then promoted COBOL’s use
CHARACTERISTICS COBOL is a simple language with a limited scope of function(no pointers, no user defined functions, no user defined types ). And that is the way it used to be but the introduction of OO-COBOL has changed all that. OO-COBOL retains all the advantages of previous versions but now includes - User Defined Functions -Object Orientation -National Characters - Unicode -Multiple Currency Symbols -Cultural Adaptability (Locales ( -Dynamic Memory Allocation (pointers ( -Data Validation Using New VALIDATE Verb -Binary and Floating Point Data Types -User Defined Data Types
SAMPLE PROGRAM: Displaying the message "Hello world!". 000100 IDENTIFICATION DIVISION. 000200 PROGRAM-ID. HELLOWORLD. 000300 *000400 000500 ENVIRONMENT DIVISION. 000600 CONFIGURATION SECTION. 000700 SOURCE-COMPUTER. RM-COBOL. 000800 OBJECT-COMPUTER. RM-COBOL. 000900 001000 DATA DIVISION. 001100 FILE SECTION. 001200 100000 PROCEDURE DIVISION. 100100 100200 MAIN-LOGIC SECTION. 100300 BEGIN. 100400 DISPLAY " " LINE 1 POSITION 1 ERASE EOS. 100500 DISPLAY "Hello world!" LINE 15 POSITION 10. 100600 STOP RUN. 100700 MAIN-LOGIC-EXIT. 100800 EXIT. Sample Run Hello world!
SAMPLE PROGRAM: Accepts two numbers and adds them together 000100 ID DIVISION. 000200 PROGRAM-ID. ACCEPT 1. 000300 DATA DIVISION. 000400 WORKING-STORAGE SECTION. 000500 01 WS-FIRST-NUMBER PIC 9(3). 000600 01 WS-SECOND-NUMBER PIC 9(3). 000700 01 WS-TOTAL PIC ZZZ 9. 000800* 000900 PROCEDURE DIVISION. 001000 0000 -MAINLINE. 001100 DISPLAY 'ENTER A NUMBER: '. 001200 ACCEPT WS-FIRST-NUMBER. 001300* 001400 DISPLAY 'ANOTHER NUMBER: '. 001500 ACCEPT WS-SECOND-NUMBER. 001600* 001700 COMPUTE WS-TOTAL = WS-FIRST-NUMBER + WS-SECOND-NUMBER. 001800 DISPLAY 'THE TOTAL IS: ', WS-TOTAL. 001900 STOP RUN. Sample Run ENTER A NUMBER ANOTHER NUMBER THE TOTAL IS: a +
SAMPLE PROGRAM: Takes all input records of salesperson data and writes it to an output file reformatted 000100 000200 000300 000400 000500 000600 000700 000800 000900 001000 001100 001200 001300 001400 001500 001600 001700 001800 ID DIVISION. PROGRAM-ID. SLS 02. FILE-CONTROL. SELECT SALESPERSON-FILE ASSIGN TO DISK. SELECT REPORT-FILE ASSIGN TO PRINTER. DATA DIVISION. FILE SECTION. FD SALESPERSON-FILE. 01 SALESPERSON-RECORD. 05 FILLER PIC XX. 05 SP-NUMBER PIC X(4). 05 SP-NAME PIC X(18). 05 FILLER PIC X(21). 05 SP-CURRENT-SALES PIC 9(5)V 99. 05 SP-CURRENT-RETURNS PIC 9(4)V 99. FD REPORT-FILE.
SAMPLE PROGRAM: Takes all input records of salesperson data and writes it to an output file reformatted 001900 01 REPORT-RECORD. 002000 05 FILLER PIC X(10). 002100 05 RT-NUMBER PIC X(4). 002200 05 FILLER PIC X(6). 002300 05 RT-NAME PIC X(18). 002400 05 FILLER PIC X(6). 002500 05 RT-CURRENT-SALES PIC ZZ, ZZZ. 99. 002600 05 FILLER PIC X(6). 002700 05 RT-CURRENT-RETURNS PIC Z, ZZZ. 99. 002800 05 FILLER PIC X(65). 002900 WORKING-STORAGE SECTION. 003000 01 WS-EOF-FLAG PIC X. 003100* 003200 PROCEDURE DIVISION. 003300* 003400 MAIN-ROUTINE. 003500 OPEN INPUT SALESPERSON-FILE 003600 OUTPUT REPORT-FILE 003700 MOVE "N" TO WS-EOF-FLAG 003800 READ SALESPERSON-FILE 003900 AT END MOVE "Y" TO WS-EOF-FLAG 004000 END-READ
SAMPLE PROGRAM: Takes all input records of salesperson data and writes it to an output file reformatted 004100* 004200 PERFORM UNTIL WS-EOF-FLAG IS EQUAL TO "Y" 004300 MOVE SPACES TO REPORT-RECORD 004400 MOVE SP-NUMBER TO RT-NUMBER 004500 MOVE SP-NAME TO RT-NAME 004600 MOVE SP-CURRENT-SALES TO RT-CURRENT-SALES 004700 MOVE SP-CURRENT-RETURNS TO RT-CURRENT-RETURNS 004800 WRITE REPORT-RECORD 004900 READ SALESPERSON-FILE 005000 AT END MOVE "Y" TO WS-EOF-FLAG 005100 END-READ 005200 END-PERFORM 0005 BENNETT ROBERT 1, 600. 35 005300* 0016 LOCK ANDREW S 357. 72 005400 CLOSE SALESPERSON-FILE, REPORT-FILE 005500 STOP RUN. 0080 PARKER JAMES E 18, 200. 00 Sample Run 0401 1375 1442 1842 REDDING OLIVIA BENTON ALEX J ADAMS JUNE R COLE ROBERT N 16, 123. 99 3, 250. 00 4, 635. 21 14, 285. 14
CONTRIBUTION TO COMPUTER LANGUAGE COBOL programs are in use globally in governmental and military agencies, in commercial enterprises, and on operating systems such as IBM's z/OS, Microsoft's Windows, and the POSIX families
HOW WIDELY USED IS COBOL? ? - - - In 1997 they estimated that there were about 300 billion lines of computer code in use in the world. Of that they estimated that about 80% (240 billion lines) were in COBOL and 20% (60 billion lines) were written in all the other computer languages combined [Brown. [ In 1999 they reported that over 50% of all new missioncritical applications were still being done in COBOL and their recent estimates indicate that through 2004 -2005 15% of all new applications (5 billion lines) will be developed in COBOL while 80% of all deployed applications will include extensions to existing legacy (usually COBOL) programs. Gartner estimates for 2002 are that there about two million COBOL programmers world-wide compared to about one million Java programmers and one million
RESOURCES - - - http//: www. engin. umd. umich. edu/CIS/course. des/ cis 400/cobol. html http: //www. computerworld. com/action/article. do? c ommand=view. Article. Basic&article. Id=266156&pag e. Number=1 http: //www. csis. ul. ie/cobol/Course/COBOLIntro. ht m#part 1 Presented by: Sarunya Dechasajja 47541487
862d7804c77fb1eef79a43a50eb8b20d.ppt