COBOL - Wikipedia, The Free Encyclopedia
COBOL - Wikipedia, The Free Encyclopedia
COBOL - Wikipedia, The Free Encyclopedia
http://en.wikipedia.org/wiki/Cobol
COBOL
From Wikipedia, the free encyclopedia
(Redirected from Cobol) COBOL /kobl/ is one of the oldest programming languages, primarily designed by Grace Hopper. Its name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments. The COBOL 2002 standard includes support for objectoriented programming and other modern language features.[1]
COBOL
Paradigm(s) Appeared in Designed by procedural, imperative, objectoriented 1959 Grace Hopper, William Selden, Gertrude Tierney, Howard Bromberg, Howard Discount, Vernon Reeves, Jean E. Sammet
Contents
1 History and specification 1.1 ANS COBOL 1968 1.2 COBOL 1974 1.3 COBOL 1985 1.4 COBOL 2002 and object-oriented COBOL 1.5 History of COBOL standards 1.6 Legacy 2 Features 2.1 Self-modifying code 2.2 Syntactic features 2.3 Data types 2.4 Hello, world 2.4.1 Hello, OS/360 circa 1972 3 Criticism and defense 3.1 Lack of structurability 3.2 Compatibility issues after standardization 3.3 Verbose syntax 3.4 Alienation from the computer science community 3.5 Other defenses 4 See also 5 References 6 Sources
Stable release
Typing discipline strong, static Major GNU Cobol, Micro Focus implementations International (e.g. the Eclipseplug-in Micro Focus Net Express) Dialects HP3000 COBOL/II, COBOL/2, IBM OS/VS COBOL, IBM COBOL/II, IBM COBOL SAA, IBM Enterprise COBOL, IBM COBOL/400, IBM ILE COBOL, Unix COBOL X/Open, Micro Focus COBOL, Microsoft COBOL, Ryan McFarland RM/COBOL, Ryan McFarland RM/COBOL-85, DOSVS COBOL, UNIVAC COBOL, Realia COBOL, Fujitsu COBOL, ICL COBOL, ACUCOBOL-GT, isCOBOL, COBOL-IT, DEC COBOL-10, DEC VAX COBOL, Wang VS COBOL, Visual COBOL, Tandem (NonStop) COBOL85, Tandem (NonStop) SCOBOL (a COBOL74 variant
for creating screens on text-based terminals) FLOW-MATIC, COMTRAN, FACT Influenced PL/I, CobolScript, ABAP
1 of 11
2/5/2014 3:47 AM
http://en.wikipedia.org/wiki/Cobol
commonly referred to as "the mother of the COBOL COBOL at Wikibooks language." The IBM COMTRAN language invented by Bob Bemer was also drawn upon, but the FACT language specification from Honeywell was not distributed to committee members until late in the process and had relatively little impact. FLOW-MATIC's status as the only language of the bunch to have actually been implemented made it particularly attractive to the committee.[2] The scene was set on April 8, 1959 at a Conference on Data Systems Languages (CODASYL) for computer manufacturers, users, and university people, at the University of Pennsylvania Computing Center. The United States Department of Defense subsequently agreed to sponsor and oversee the next activities. A meeting chaired by Charles A. Phillips was held at the Pentagon on May 28 and 29 of 1959 (exactly one year after the Zrich ALGOL 58 meeting); there it was decided to set up three committees: short, intermediate and long range (the last one was never actually formed). It was the Short Range Committee, chaired by Joseph Wegstein of the US National Bureau of Standards, that during the following months created a description of the first version of COBOL.[3] The committee was formed to recommend a short range approach to a common business language. The committee was made up of members representing six computer manufacturers and three government agencies. The six computer manufacturers were Burroughs Corporation, IBM, Minneapolis-Honeywell (Honeywell Labs), RCA, Sperry Rand, and Sylvania Electric Products. The three government agencies were the US Air Force, the Navy's David Taylor Model Basin, and the National Bureau of Standards (now National Institute of Standards and Technology). The intermediate-range committee was formed but never became operational. In the end a sub-committee of the Short Range Committee developed the specifications of the COBOL language. This sub-committee was made up of six individuals: William Selden and Gertrude Tierney of IBM Howard Bromberg and Howard Discount of RCA Vernon Reeves and Jean E. Sammet of Sylvania Electric Products[4] The decision to use the name "COBOL" was made at a meeting of the committee held on 18 September 1959. The subcommittee completed the specifications for COBOL in December 1959. The first compilers for COBOL were subsequently implemented in 1960, and on December 6 and 7, essentially the same COBOL program ran on two different computer makes, an RCA computer and a Remington-Rand Univac computer, demonstrating that compatibility could be achieved.
COBOL 1974
In 1974, ANSI published a revised version of (ANS) COBOL, containing new features such as file organizations, the report writer module and the segmentation module.[5] Several features were deleted from the standard, notably the NOTE statement, the EXAMINE statement (which was replaced by INSPECT) and the implementerdefined random access module (which was superseded by the new sequential and relative I-O modules). These made up 44 changes which rendered existing statements incompatible with the new standard.[6]
2 of 11
2/5/2014 3:47 AM
http://en.wikipedia.org/wiki/Cobol
COBOL 1985
In 1985, ANSI published another revised version that included many new features not in the 1974 standard, notably including:[7] scope terminators (END-IF, END-PERFORM, END-READ, etc.) nested subprograms the CONTINUE statement the EVALUATE statement the INITIALIZE statement reference modification the >= and <= operators
3 of 11
2/5/2014 3:47 AM
http://en.wikipedia.org/wiki/Cobol
COBOL-68 COBOL-74 COBOL-85 Intrinsic Functions Amendment - 1989 Corrections Amendment - 1991 After the Amendments to the 1985 ANSI Standard (which were adopted by ISO), primary development and ownership was taken over by ISO. The following editions and TRs (Technical Reports) have been issued by ISO (and adopted as ANSI) Standards: COBOL 2002 Finalizer Technical Report - 2003 Native XML syntax Technical Report - 2006 Object Oriented Collection Class Libraries - pending final approval... From 2002, the ISO standard is also available to the public coded as ISO/IEC 1989. Work progresses on the next full revision of the COBOL Standard. Approval and availability was expected early 2010s. For information on this revision, to see the latest draft of this revision, or to see other work on the COBOL Standard, see the COBOL Standards Website (http://www.cobolstandard.info).
Legacy
COBOL programs are in use globally in governmental and military agencies and in commercial enterprises, and are running on operating systems such as IBM's z/OS and z/VSE, the POSIX families (Unix/Linux etc.), and Microsoft's Windows as well as ICL's VME operating system and Unisys' OS 2200. In 1997, the Gartner Group reported that 80% of the world's business ran on COBOL with over 200 billion lines of code in existence and with an estimated 5 billion lines of new code annually.[9] Near the end of the twentieth century the year 2000 problem was the focus of significant COBOL programming effort, sometimes by the same programmers who had designed the systems decades before. The particular level of effort required for COBOL code has been attributed both to the large amount of business-oriented COBOL, as COBOL is by design a business language and business applications use dates heavily, and to constructs of the COBOL language such as the PICTURE clause, which can be used to define fixed-length numeric fields, including two-digit fields for years.[citation needed] Because of the clean-up effort put into these COBOL programs for Y2K, many of them have been kept in use for years since then.[10]
Features
COBOL as defined in the original specification included a PICTURE clause for detailed field specification. It did not support local variables, recursion, dynamic memory allocation, or structured programming constructs. Support for some or all of these features has been added in later editions of the COBOL standard. COBOL has many reserved words (over 400), called keywords.
Self-modifying code
The original COBOL specification supported the infamous "ALTER X TO PROCEED TO Y" statement, for which many compilers generated self-modifying code. X and Y are paragraph labels, and any "GO TO X" statements executed after such an ALTER statement have the meaning "GO TO Y" instead. Many compilers still support
4 of 11
2/5/2014 3:47 AM
http://en.wikipedia.org/wiki/Cobol
it,[11] but it was deemed obsolete in the COBOL 1985 standard[12] and should not be used in new programs. The use of ALTER has been banned altogether for some time by many software companies as part of their programming practices.
Syntactic features
COBOL provides an update-in-place syntax, for example
age += years
is equivalent to
COBOL provides "named conditions" (so-called 88-levels). These are declared as sub-items of another item (the conditional variable). The named condition can be used in an IF statement, and tests whether the conditional variable is equal to any of the values given in the named condition's VALUE clause. The SET statement can be used to make a named condition TRUE (by assigning the first of its values to the conditional variable). COBOL allows identifiers up to 30 characters long. When COBOL was introduced, much shorter lengths (e.g., 6 characters for Fortran) were prevalent. COBOL introduced the concept of copybooks chunks of code that can be inserted into a larger program.
5 of 11
2/5/2014 3:47 AM
http://en.wikipedia.org/wiki/Cobol
COBOL does this with the COPY statement, which also allows other code to replace parts of the copybook's code with other code (using the REPLACING ... BY ... clause).
Data types
Standard COBOL provides the following data types: Data type Character Edited character Sample declaration
PIC X(20) PIC A(4)9(5)X(7) PIC X99BAXX
Notes Alphanumeric and alphabetic-only Single-byte character set (SBCS) Formatted and inserted characters Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned. Conforming compilers limit the maximum value of variables based on the PICTURE clause and not the number of bits reserved for storage. 1 to 18 decimal digits (1 to 10 bytes) Signed or unsigned 1 to 18 decimal digits (1 to 18 bytes) Signed or unsigned Leading or trailing sign, overpunch or separate Binary floating-point Formatted characters and digits
or
BINARY
Numeric fixed-point packed PIC S999V99 decimal PACKED-DECIMAL Numeric fixed-point zoned decimal Numeric floating-point Edited numeric
PIC S999V99 [USAGE DISPLAY]
PIC S9V999ES99 PIC +Z,ZZ9.99 PIC $***,**9.99CR 01 CUST-NAME. 05 CUST-LAST PIC X(20). 05 CUST-FIRST PIC X(20). OCCURS 12 TIMES OCCURS 0 to 12 TIMES DEPENDING ON CUST-COUNT 66 RAW-RECORD RENAMES CUST-RECORD 88 IS-RETIRED-AGE VALUES 65 THRU 150
Group (record)
Aggregated elements
Table (array) Variable-length table Renames (variant or union data) Condition name Array index
Fixed-size array, row-major order Up to 7 dimensions Variable-sized array, row-major order Up to 7 dimensions Character data overlaying other variables Boolean value dependent upon another variable Index (subscript) of a table element May be associated with a specific table using INDEXED BY
[USAGE] INDEX
6 of 11
2/5/2014 3:47 AM
http://en.wikipedia.org/wiki/Cobol
Data type Numeric floating-point single precision Numeric floating-point double precision
Sample declaration
PIC S9V9999999ES99 [USAGE] COMPUTATIONAL-1
Notes Binary floating-point (32 bits, 7+ digits) (IBM extension) Binary floating-point (64 bits, 16+ digits) (IBM extension)
Numeric fixed-point packed PIC S9V999 Same as PACKED DECIMAL [USAGE] COMPUTATIONAL-3 (IBM extension) decimal Numeric fixed-point binary
PIC S999V99 [USAGE] COMPUTATIONAL-4
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned. The maximum PIC S999V99 value of variables based on the number [USAGE] COMPUTATIONAL-5 of bits reserved for storage and not on the PICTURE clause. (IBM extension)
PIC S999V99 [USAGE] COMPUTATIONAL-4
Numeric fixed-point binary in native byte order Numeric fixed-point binary in big-endian byte order Wide character Edited wide character Edited floating-point Data pointer Code pointer Bit field
Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned Binary 16, 32, or 64 bits (2, 4, or 8 bytes) Signed or unsigned Alphanumeric Double-byte character set (DBCS) Formatted and inserted wide characters Formatted characters, decimal digits, and exponent Data memory address Code memory address n can be from 1 to 64, defining an n-bit integer Signed or unsigned
PIC G(20)
PIC G99BGGG
PIC +9.9(6)E+99 [USAGE] POINTER [USAGE] PROCEDUREPOINTER PIC 1(n) [USAGE] COMPUTATIONAL-5
Hello, world
An example of the "Hello, world" program in COBOL:
7 of 11
2/5/2014 3:47 AM
http://en.wikipedia.org/wiki/Cobol
Hello, OS/360 circa 1972 On an IBM System/360 running OS/360 MVT 21.8f, circa 1972 (which predates the tradition of using Hello, world for introductory examples), Hello, world would have been punched onto 80-column cards, containing source code similar to:
//COBUCLG JOB CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1) //HELOWRLD EXEC COBUCLG,PARM.COB='MAP,LIST,LET' //COB.SYSIN DD * 001 IDENTIFICATION DIVISION. 002 PROGRAM-ID. 'HELLO'. 003 ENVIRONMENT DIVISION. 004 CONFIGURATION SECTION. 005 SOURCE-COMPUTER. IBM-360. 006 OBJECT-COMPUTER. IBM-360. 0065 SPECIAL-NAMES. 0066 CONSOLE IS CNSL. 007 DATA DIVISION. 008 WORKING-STORAGE SECTION. 009 77 HELLO-CONST PIC X(12) VALUE 'HELLO, WORLD'. 075 PROCEDURE DIVISION. 090 000-DISPLAY. 100 DISPLAY HELLO-CONST UPON CNSL. 110 STOP RUN. //LKED.SYSLIB DD DSNAME=SYS1.COBLIB,DISP=SHR // DD DSNAME=SYS1.LINKLIB,DISP=SHR //GO.SYSPRINT DD SYSOUT=A //
The "//" source lines are JCL statements, surrounding the COBOL sequence-numbered source code. The ANS COBOL Compile, Link, and Go module "COBUCLG" was typically utilized to compile and execute the code. The resulting "HELLO, WORLD" output would have then been displayed on the operator's console.
2/5/2014 3:47 AM
http://en.wikipedia.org/wiki/Cobol
within the program. However, its varied control structures, reduced the need for GO TOs, with the PERFORM statement allowing programmers to easily access powerful looping facilities.[15]:349350 Additionally, the introduction of OO-COBOL has added support for object-oriented code as well as user-defined functions and user-defined data types to COBOL's repertoire.
Verbose syntax
COBOL syntax has often been criticized for its verbosity. However, proponents note that this was intentional in the language design, and many consider it one of COBOL's strengths. One of the design goals of COBOL was that non-programmersmanagers, supervisors, and userscould read and understand the code.[15]:350 This is why COBOL has an English-like syntax and structural elementsincluding: nouns, verbs, clauses, sentences, sections, and divisions. Consequently, COBOL is considered by at least one source to be "The most readable, understandable and self-documenting programming language in use today. [...] Not only does this readability generally assist the maintenance process but the older a program gets the more valuable this readability becomes."[17] On the other hand, the mere ability to read and understand a few lines of COBOL code does not grant to an executive or end user the experience and knowledge needed to design, build, and maintain large software systems.
Later, as COBOL became a mainstream language, COBOL suffered as university professors taught more modern, state-of-the-art languages and techniques instead of COBOL which was said to have a "trade school" nature.[15]:351
Other defenses
Traditional COBOL is a simple language with a limited scope of function (with no pointers, no user-defined types, and no user-defined functions), encouraging a straightforward coding style. This has made it well-suited
9 of 11
2/5/2014 3:47 AM
http://en.wikipedia.org/wiki/Cobol
to its primary domain of business computingwhere the program complexity lies in the business rules that need to be encoded rather than sophisticated algorithms or data structures. Because the standard does not belong to any particular vendor, programs written in COBOL are highly portable. The language can be used on a wide variety of hardware platforms and operating systems. Additionally, the rigid hierarchical structure restricts the definition of external references to the Environment Division, which simplifies platform changes in particular.[17]
See also
Programming language genealogies Alphabetical list of programming languages Comparison of programming languages GNU Cobol CODASYL
References
1. ^ Oliveira, Rui (2006). The Power of Cobol. City: BookSurge Publishing. ISBN 0-620-34652-3. 2. ^ Sammet, Jean (1978). "The Early History of COBOL" (http://portal.acm.org/citation.cfm?id=1198367). ACM SIGPLAN Notices (Association for Computing Machinery, Inc.) 13 (8): 121161. doi:10.1145/960118.808378 (http://dx.doi.org/10.1145%2F960118.808378). Retrieved 14 January 2010. 3. ^ Garfunkel, Jerome (1987). The Cobol 85 Example Book. New York: Wiley. ISBN 0-471-80461-4. 4. ^ Wexelblat, Richard (1981). History of Programming Languages. Boston: Academic Press. ISBN 0-12-745040-8. 5. ^ Klein, William M. (4 October 2010). "American National Standard COBOL 1974" (http://home.comcast.net /~wmklein/DOX/History.pdf). The History of COBOL. p. 16. Archived (https://web.archive.org /web/20140107192608/http://home.comcast.net/~wmklein/DOX/History.pdf) from the original on 7 January 2013. Retrieved 7 January 2014. 6. ^ Baird, George N.; Oliver, Paul (May 1977). "1974 Standard (X3.231974)" (http://www.dtic.mil/dtic/tr/fulltext /u2/a039740.pdf). Programming Language Standards Who Needs Them?. pp. 1921. Archived (https://web.archive.org/web/20140107192439/http://www.dtic.mil/dtic/tr/fulltext/u2/a039740.pdf) from the original on 7 January 2014. Retrieved 7 January 2014. 7. ^ Roy, M K; Dastidar, D Ghost (1 June 1989). "Features of COBOL - 85" (http://books.google.com /?id=N066w1XgJXcC&pg=PA438&lpg=PA438&dq=cobol+1985+changes#v=onepage& q=cobol%201985%20changes&f=false). COBOL Programming: Problems and Solutions (2nd ed.). McGraw-Hill Education. pp. 438451. ISBN 978-0074603185. 8. ^ "NetCOBOL for .Net" (http://www.netcobol.com/product/netcobol-for-net/). netcobol.com. GTSoftware. 2013. Retrieved 29 January 2014. 9. ^ Kizior, Ronald J.; Carr, Donald; Halpern, Paul. "Does COBOL Have a Future?" (http://proc.isecon.org/2000/126 /ISECON.2000.Kizior.pdf). The Proceedings of the Information Systems Education Conference 2000 17 (126). Retrieved 2012-09-30. 10. ^ Carr, Donald; Kizior, Ronald J. (13 June 2003). "Continued Relevance of COBOL in Business and Academia: Current Situation and Comparison to the Year 2000 Study" (http://www.microfocus.com/000/WP20030613_tcm21-2774.pdf) (PDF). p. 16. Retrieved 5 January 2014. "Large investment in these [COBOL] applications along with major reinvestment that occurred to solve the Y2K problem and the need to recapture investment in these systems will necessitate continued future demand [for COBOL skills] over the next 10 years." 11. ^ Examples of compiler support can be seen in the following: Tiffin, Brian. September 2013 (https://sourceforge.net/p/open-cobol/discussion/109661/thread/7dc2941f/). "State of the Project". GNU Cobol. Retrieved 5 January 2014. "The ALTER Statement" (http://documentation.microfocus.com/help/topic /com.microfocus.eclipse.infocenter.visualcobol.vs2013/HRLHLHPDF803.html). Micro Focus Visual COBOL 2.2 for Visual Studio 2013 COBOL Language Reference. Micro Focus. Retrieved 5 January 2014.
10 of 11
2/5/2014 3:47 AM
http://en.wikipedia.org/wiki/Cobol
12.
13.
14. 15.
16. 17.
"ALTER Statement (Nucleus)" (http://www.csim.scu.edu.tw/~kuo/COBOL/COBOLCompiler/COBOL %E6%89%8B%E5%86%8A/cob_lrf.pdf) (PDF). COBOL85 Reference Manual. Fujitsu. November 1996. p. 555. Retrieved 5 January 2014. "ALTER Statement" (http://pic.dhe.ibm.com/infocenter/pdthelp/v1r1/topic/com.ibm.entcobol.doc_5.1 /PGandLR/ref/rlpsalte.html). Enterprise COBOL for z/OS Language Reference. IBM. June 2013. Retrieved 5 January 2014. ^ "The ALTER Statement" (http://documentation.microfocus.com /help/index.jsp?topic=%2Fcom.microfocus.eclipse.infocenter.visualcobol.vs2013%2FHRLHLHPDF803.html). Micro Focus Visual COBOL 2.2 for Visual Studio 2013 COBOL Language Reference. Micro Focus. Retrieved 28 December 2013. "The ALTER statement is classed as an obsolete element in the ANSI'85 standard and is scheduled to be deleted from the next full revision of the ANSI Standard." ^ Dijkstra (2006). "E. W. Dijkstra Archive: How do we tell truths that might hurt? (EWD498)" (http://www.cs.utexas.edu/users/EWD/transcriptions/EWD04xx/EWD498.html). University of Texas at Austin. Retrieved August 29, 2007. ^ Tompkins, H. E. (1983). "In defense of teaching structured COBOL as computer science". ACM SIGPLAN Notices 18 (4): 86. doi:10.1145/948176.948186 (http://dx.doi.org/10.1145%2F948176.948186). ^ a b c d Shneiderman, B. (October 1985). "The Relationship Between COBOL and Computer Science". Annals of the History of Computing (IEEE) 7 (4): 348352. doi:10.1109/MAHC.1985.10041 (http://dx.doi.org /10.1109%2FMAHC.1985.10041). ^ Garfunkel, Jerome (1987). The COBOL 85 example book. New York: Wiley. ISBN 0-471-80461-4. ^ a b Coughlan, Michael (2002). "Introduction to COBOL" (http://www.csis.ul.ie/cobol/course /COBOLIntro.htm#part1). Retrieved 3 February 2014.
Sources
Ebbinkhuijsen, Wim B.C., COBOL Alphen aan den Rijn/Diegem: Samson Bedrijfsinformatie bv, 1990. ISBN 90-14-04560-3. (Dutch) Retrieved from "http://en.wikipedia.org/w/index.php?title=COBOL&oldid=593940794" Categories: COBOL Object-oriented programming languages .NET programming languages Programming languages created in the 1950s Programming languages with an ISO standard This page was last modified on 4 February 2014 at 20:35. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.
11 of 11
2/5/2014 3:47 AM