COBOL.doc_第1页
COBOL.doc_第2页
COBOL.doc_第3页
COBOL.doc_第4页
COBOL.doc_第5页
免费预览已结束,剩余2页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

COBOLCOBOL (pronounced /kobl/) is one of the oldest programming languages. 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 object-oriented programming and other modern language features.History and specificationA specification of COBOL was initially created during the second half of 1959 by Grace Hopper. The scene was set on April 8 at a meeting of computer manufacturers, users and university people at the University of Pennsylvania Computing Center and subsequently the United States Department of Defense agreed to sponsor and oversee the next activities. A meeting was held at the Pentagon on May 28 and 29 (exactly one year after the Zrich ALGOL 58 meeting), chaired by Charles A. Phillips. There it was decided to set up three committees, short, intermediate and long range (the last one was actually never formed). It was the Short Range Committee, chaired by Joseph Wegstein of the US National Bureau of Standards, that during the next months would create a description of the first version of COBOL. 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 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 This subcommittee completed the specifications for COBOL in December 1959. The specifications were to a great extent inspired by the FLOW-MATIC language invented by Grace Hopper, commonly referred to as the mother of the COBOL language, the IBM COMTRAN language invented by Bob Bemer, and the FACT language from Honeywell.The name COBOL was decided upon at a meeting of the committee held on 18 September 1959.The first compilers for COBOL were subsequently implemented during the year 1960 and on 6 and 7 December essentially the same COBOL program was run on two different makes of computers, an RCA computer and a Remington-Rand Univac computer, demonstrating that compatibility could be achieved.Since 1959 COBOL has undergone several modifications and improvements. In an attempt to overcome the problem of incompatibility between different versions of COBOL, the American National Standards Institute (ANSI) developed a standard form of the language in 1968. This version was known as American National Standard (ANS) COBOL. In 1974, ANSI published a revised version of (ANS) COBOL, containing a number of features that were not in the 1968 version. In 1985, ANSI published still another revised version that had new features not in the 1974 standard. The language continues to evolve today.COBOL 2002 and object-oriented COBOLIn the early 1990s it was decided to add object-orientation in the next full revision of COBOL. The initial estimate was to have this revision completed by 1997 and an ISO CD (Committee Draft) was available by 1997. Some implementers (including Micro Focus, Fujitsu, and IBM) introduced object-oriented syntax based on the 1997 or other drafts of the full revision. The final approved ISO Standard (adopted as an ANSI standard by INCITS) was approved and made available in 2002.Like the C+ programming language, object-oriented COBOL compilers are available even as the language moves toward standardization. Fujitsu and Micro Focus currently support object-oriented COBOL compilers targeting the .NET framework.The 2002 (4th revision) of COBOL included many other features beyond object-orientation. These included (but are not limited to): National Language support (including but not limited to Unicode support) Locale-based processing User-defined functions CALL (and function) prototypes (for compile-time parameter checking) Pointers and syntax for getting and freeing storage Calling conventions to and from non-COBOL languages such as C Support for execution within framework environments such as Microsofts .NET and Java (including COBOL instantiated as Enterprise JavaBeans) Bit and Boolean support “True” binary support (up until this enhancement, binary items were truncated based on the (base-10) specification within the Data Division) Floating-point support Standard (or portable) arithmetic results XML generation and parsing History of COBOL standardsThe specifications approved by the full Short Range Committee were approved by the Executive Committee on January 3, 1960, and sent to the government printing office, which edited and printed these specifications as Cobol 60.The American National Standards Institute (ANSI) produced several revisions of the COBOL standard, including: 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 is progressing on the next full revision of the COBOL Standard. It is expected to be approved and available in the early 2010s. For information on this revision, to see the latest draft of this revision, or to see what other works is happening with the COBOL Standard, see the COBOL Standards Website.LegacyCOBOL programs are in use globally in governmental and military agencies, in commercial enterprises, and on operating systems such as IBMs z/OS, Microsofts Windows, and the POSIX families (Unix/Linux etc.). In 1997, the Gartner Group reported that 80% of the worlds business ran on COBOL with over 200 billion lines of code in existence and with an estimated 5 billion lines of new code annually.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.FeaturesCOBOL 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. The original COBOL specification supported self-modifying code via the infamous ALTER X TO PROCEED TO Y statement. This capability has since been removed.Syntactic featuresCOBOL provides an update-in-place syntax, for example ADD YEARS TO AGEThe equivalent construct in many procedural languages would beage = age + yearsThis syntax is similar to the compound assignment operator later adopted by C:age += yearsThe abbreviated conditional expression IF SALARY 9000 OR SUPERVISOR-SALARY OR = PREV-SALARYis equivalent to IF SALARY 9000 OR SALARY SUPERVISOR-SALARY OR SALARY = PREV-SALARYCOBOL 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 conditions 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 to be up to 30 characters long. When COBOL was introduced, much shorter lengths (e.g., 6 characters for FORTRAN) were prevalent.The concept of copybooks was introduced by COBOL; these are chunks of text which can be inserted into a programs code. This is done with the COPY statement, which also allows parts of the copybooks text to be replaced with other text (using the REPLACING . BY . clause).Data typesStandard COBOL provides the following data types:Data typeSample declarationNotesCharacterPIC X(20)PIC A(4)9(5)X(7)Alphanumeric and alphabetic-onlySingle-byte character set (SBCS)Edited characterPIC X99BAXXFormatted and inserted charactersNumeric fixed-point binaryPIC S999V99USAGE COMPUTATIONALorBINARYBinary 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.Numeric fixed-point packed decimalPIC S999V99USAGE PACKED-DECIMAL1 to 18 decimal digits (1 to 10 bytes)Signed or unsignedNumeric fixed-point zoned decimalPIC S999V99USAGE DISPLAY1 to 18 decimal digits (1 to 18 bytes)Signed or unsignedLeading or trailing sign, overpunch or separateNumeric floating-pointPIC S9V999ES99Binary floating-pointEdited numericPIC +Z,ZZ9.99PIC $*,*9.99CRFormatted characters and digitsGroup (record)01 CUST-NAME.05 CUST-LAST PIC X(20).05 CUST-FIRST PIC X(20).Aggregated elementsTable (array)OCCURS 12 TIMESFixed-size array, row-major orderUp to 7 dimensionsVariable-length tableOCCURS 0 to 12 TIMESDEPENDING ON CUST-COUNTVariable-sized array, row-major orderUp to 7 dimensionsRenames (variant or union data)66 RAW-RECORDRENAMES CUST-RECORDCharacter data overlaying other variablesCondition name88 IS-RETIRED-AGEVALUES 65 THRU 150Boolean valuedependent upon another variableArray indexUSAGE INDEXArray subscriptMost vendors provide additional types, such as:Data typeSample declarationNotesNumeric fixed-point binaryin native byte orderPIC S999V99USAGE COMPUTATIONAL-4Binary 16, 32, or 64 bits (2, 4, or 8 bytes)Signed or unsignedNumeric fixed-point binaryin big-endian byte orderPIC S999V99USAGE COMPUTATIONAL-5Binary 16, 32, or 64 bits (2, 4, or 8 bytes)Signed or unsignedWide characterPIC G(20)AlphanumericDouble-byte character set (DBCS)Edited wide characterPIC G99BGGGFormatted and inserted wide charactersEdited floating-pointPIC +9.9(6)E+99Formatted characters and decimal digitsData pointerUSAGE POINTERData memory addressCode pointerUSAGE PROCEDURE-POINTERCode memory addressBit fieldPIC 1(n) USAGE COMPUTATIONAL-5n can be from 1 to 64, defining an n-bit integerSigned or unsignedIndexUSAGE INDEXBinary value corresponding to an occurrence of a table elementMay be linked to a specific table using INDEXED BYHello, worldAn example of the Hello, world program in COBOL: IDENTIFICATION DIVISION. PROGRAM-ID. HELLO-WORLD. PROCEDURE DIVISION. MAIN. DISPLAY Hello, world. STOP RUN.CriticismCritics have argued that COBOLs syntax serves mainly to increase the size of programs, at the expense of developing the thinking process needed for software development. In his letter to an editor in 1975 titled How do we tell truths that might hurt?, computer scientist and Turing Award recipient Edsger Dijkstra remarked that The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense.COBOL 85 was not compatible with earlier versions, resulting in the cesarean birth of COBOL 85. Joseph T. Brophy, CIO, Travelers Insurance, spearheaded an effort to inform users of COBOL of the heavy reprogramming costs of implementing the new standard. As a result the ANSI COBOL Committee received more than 3,200 letters from the public, mostly negative, requiring the committee to make changes.Older versions of COBOL lack local variables and so cannot truly support structured programming.Others criticize the ad hoc incorporation of features on a language that was meant to be a short term solution to interoperability in 1959. Coupled with the perceived archaic syntax, they argue that it tries to fill a niche for which better tools have already been de

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论