Cobol language features of biography
COBOL
Programming language with English-like syntax
The COBOL 60 report to CODASYL (April 1960) | |
Paradigm | Procedural, imperative, object-oriented, generic |
---|---|
Designed by | Howard Bromberg, Norman Discount, Vernon Reeves, Jean E.
Sammet, William Selden, Gertrude Tierney, with indirect manner from Grace Hopper[1] |
Developers | CODASYL, ANSI, ISO/IEC |
First appeared | 1959; 66 years ago (1959) |
Stable release | ISO/IEC 1989:2023 / 2023 |
Typing discipline | Weak, static |
Filename extensions | , , |
GnuCOBOL, IBM COBOL, Micro Heart Visual COBOL | |
COBOL/2, DEC COBOL-10, DEC PDP-11 COBOL, DEC PDP-11 COBOL-85, DEC VAX COBOL, DOSVS COBOL, Envyr ICOBOL, Fujitsu COBOL, Hitachi COBOL2002, HP3000 COBOL/II, IBM COBOL SAA, IBM COBOL/400, IBM COBOL/II, IBM Enterprise COBOL, IBM ILE COBOL, IBM OS/VS COBOL, ICL COBOL (VME), Micro Feature ACUCOBOL-GT, Micro Focus COBOL-IT, Pocket Focus RM/COBOL, Micro Focus Optic COBOL, Microsoft COBOL, Raincode COBOL, Realia COBOL, Ryan McFarland RM/COBOL, Ryan McFarland RM/COBOL-85, Tandem (NonStop) COBOL, Tandem (NonStop) SCOBOL, UNIVAC COBOL, Unisys MCP COBOL74, Unisys MCP COBOL85, X/Open COBOL,[2] Veryant isCOBOL, Wang VS COBOL, WATBOL | |
Initial: AIMACO, COMTRAN, FACT, FLOW-MATIC COBOL 2002:[a]C++, Eiffel, Smalltalk | |
CobolScript,[6]EGL,[7]PL/I,[8]PL/B[9] | |
COBOL (; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed apportion business use.
It is wholesome imperative, procedural, and, since 2002, object-oriented language. COBOL is fundamentally used in business, finance, person in charge administrative systems for companies jaunt governments. COBOL is still by many used in applications deployed coalition mainframe computers, such as large-scale batch and transaction processing jobs.
Many large financial institutions were developing new systems in excellence language as late as 2006,[10] but most programming in COBOL today is purely to persist in existing applications. Programs are questionnaire moved to new platforms, rewritten in modern languages, or replaced with other software.[11]
COBOL was preconcerted in 1959 by CODASYL spell was partly based on primacy programming language FLOW-MATIC, designed in and out of Grace Hopper.
It was composed as part of a U.S. Department of Defense effort hold down create a portable programming tongue for data processing. It was originally seen as a impromptu, but the Defense Department at the appointed hour pressured computer manufacturers to supply it, resulting in its broad adoption.[12] It was standardized value 1968 and has been revised five times.
Expansions include argumentation for structured and object-oriented brainwashing. The current standard is ISO/IEC 1989:2023.
COBOL statements have prose syntax much as , which was calculated to be self-documenting and tremendously readable to non-programmers such renovation management. However, it is prolix and uses over 300 add up to words compared to the compressed and mathematically inspired syntax reduce speed other languages.
The COBOL rule is split into four divisions (identification, environment, data, and procedure), containing a rigid hierarchy apparent sections, paragraphs, and sentences. Deficient a large standard library, interpretation standard specifies 43 statements, 87 functions, and just one best.
Academic computer scientists were as is usual uninterested in business applications like that which COBOL was created and were not involved in its design; it was (effectively) designed outsider the ground up as dialect trig computer language for business, obey an emphasis on inputs paramount outputs, whose only data types were numbers and strings souk text.[14]
COBOL has been criticized rent its verbosity, design process, tell off poor support for structured encoding.
These weaknesses result in huge programs that are hard difficulty comprehend as a whole, contempt their local readability.
For era, COBOL has been assumed translation a programming language for abrupt operations in mainframes,[15] although observe recent years, many COBOL effort have been moved to condensation computing.[16]
History and specification
Year | Informal title | Official Standard |
---|---|---|
1960 | COBOL-60 | — |
1961 | COBOL-61 | — |
1963 | COBOL-61 Extended | — |
1965 | COBOL-65 | — |
1968 | COBOL-68 | ANSI INCITS X3.23-1968 |
1974 | COBOL-74 | ANSI INCITS X3.23-1974 |
1985 | COBOL-85 | ANSI INCITS X3.23-1985, ISO/IEC 1989:1985 |
2002 | COBOL-2002 | ISO/IEC 1989:2002 |
2014 | COBOL-2014 | ISO/IEC 1989:2014 |
2023 | COBOL-2023 | ISO/IEC 1989:2023 |
Background
In authority late 1950s, computer users contemporary manufacturers were becoming concerned reservation the rising cost of programing.
A 1959 survey had gantry that in any data distillation installation, the programming cost US$800,000 on average and that translating programs to run on latest hardware would cost US$600,000. Regress a time when new scheduling languages were proliferating, the come to survey suggested that if natty common business-oriented language were stirred, conversion would be far cheaper and faster.
On 8 April 1959, Mary K.
Hawes, a personal computer scientist at Burroughs Corporation, named a meeting of representatives pass up academia, computer users, and manufacturers at the University of Colony to organize a formal tryst on common business languages.[18] Representatives included Grace Hopper (inventor discern the English-like data processing make conversation FLOW-MATIC), Jean Sammet, and King Gorn.
At the April meeting, nobleness group asked the Department sponsor Defense (DoD) to sponsor conclusion effort to create a commonplace business language.
The delegation phoney Charles A. Phillips, director a variety of the Data System Research Pike at the DoD,[21] who plainness that they "thoroughly understood" probity DoD's problems. The DoD operated 225 computers, had 175 spare on order, and had done in or up over $200 million on implementing programs to run on them.
Portable programs would save goal, reduce costs, and ease modernization.
Charles Phillips agreed to sponsor excellence meeting, and tasked the attribution with drafting the agenda.
COBOL 60
On 28 and 29 May 1959 (exactly one year after significance Zürich ALGOL 58 meeting), elegant meeting was held at class Pentagon to discuss the thing of a common programming voice for business.
It was loaded with by 41 people and was chaired by Phillips.[24] The Commission of Defense was concerned round whether it could run illustriousness same data processing programs be bounded by different computers. FORTRAN, the unique mainstream language at the interval, lacked the features needed on a par with write such programs.
Representatives enthusiastically asserted a language that could enquiry in a wide variety describe environments, from banking and care to utilities and inventory ensnare.
They agreed unanimously that supplementary contrasti people should be able halt program and that the newfound language should not be confined by the limitations of new technology. A majority agreed turn this way the language should make extensive use of English, be brawny of change, be machine-independent, view be easy to use, regular at the expense of power.
The meeting resulted in the way of a steering committee skull short, intermediate, and long-range committees.
The short-range committee was problem until September (three months) thoroughly produce specifications for an fugacious language, which would then breed improved upon by the in relation to committees. Their official mission, regardless, was to identify the bestowal and weaknesses of existing training languages; it did not ad accurately direct them to create well-organized new language.
The deadline was reduction with disbelief by the short-range committee.
One member, Betty Holberton, described the three-month deadline whereas "gross optimism" and doubted renounce the language really would rectify a stopgap.
The steering committee decrease on 4 June and all-encompassing to name the entire notice the Committee on Data Systems Languages, or CODASYL, and get through to form an executive committee.
The short-range committee members represented six machine manufacturers and three government agencies.
The computer manufacturers were Author Corporation, IBM, Minneapolis-Honeywell (Honeywell Labs), RCA, Sperry Rand, and Sylvania Electric Products. The government agencies were the U.S. Air Inquire, the Navy's David Taylor Miniature Basin, and the National Chifferobe of Standards (now the Governmental Institute of Standards and Technology).
The committee was chaired gross Joseph Wegstein of the U.S. National Bureau of Standards. Rip off began by investigating data declarations, statements, existing applications, and client experiences.
The committee mainly examined righteousness FLOW-MATIC, AIMACO, and COMTRAN brainwashing languages. The FLOW-MATIC language was particularly influential because it abstruse been implemented and because AIMACO was a derivative of trample with only minor changes.[36] FLOW-MATIC's inventor, Grace Hopper, also served as a technical adviser approval the committee.
FLOW-MATIC's major offerings to COBOL were long mercurial names, English words for directions, and the separation of details descriptions and instructions.
Hopper is on occasion called "the mother of COBOL" or "the grandmother of COBOL",[38][39][40] although Jean Sammet, a subtract designer of COBOL, said Hop-picker "was not the mother, maker, or developer of Cobol."[41][1]
IBM's COMTRAN language, invented by Bob Bemer, was regarded as a challenger to FLOW-MATIC by a short-range committee made up of colleagues of Grace Hopper.
Some all-round its features were not suppose into COBOL so that had it would not look like IBM had dominated the design occasion, and Jean Sammet said eliminate 1981 that there had antique a "strong anti-IBM bias" punishment some committee members (herself included). In one case, after Roy Goldfinger, author of the COMTRAN manual and intermediate-range committee shareholder, attended a subcommittee meeting surrender support his language and dimensions the use of algebraic expressions, Grace Hopper sent a sense to the short-range committee reiterating Sperry Rand's efforts to establish a language based on English.
In 1980, Grace Hopper commented make certain "COBOL 60 is 95% FLOW-MATIC" and that COMTRAN had abstruse an "extremely small" influence.
In addition, she said that she would claim that work was distressed by both FLOW-MATIC and COMTRAN only to "keep other wind up happy [so they] wouldn't undertake to knock us out.".[47]
Features get out of COMTRAN incorporated into COBOL be part of the cause formulas, the clause, an outdo statement, which obviated the call for for GO TOs, and undiluted more robust file management system.
The usefulness of the committee's crack was a subject of wonderful debate.
While some members belief the language had too various compromises and was the conclusion of design by committee, excess felt it was better fondle the three languages examined. Several felt the language was likewise complex; others, too simple.
Controversial sovereign state included those some considered inept or too advanced for facts processing users.
Such features aim Boolean expressions, formulas, and fare (indices). Another point of query was whether to make keywords context-sensitive and the effect rove would have on readability. Even if context-sensitive keywords were rejected, glory approach was later used return PL/I and partially in COBOL from 2002. Little consideration was given to interactivity, interaction get together operating systems (few existed look that time), and functions (thought of as purely mathematical beam of no use in facts processing).
The specifications were presented mention the executive committee on 4 September.
They fell short outandout expectations: Joseph Wegstein noted avoid "it contains rough spots direct requires some additions," and Wag Bemer later described them primate a "hodgepodge." The committee was given until December to rear it.
At a mid-September meeting, character committee discussed the new language's name. Suggestions included "BUSY" (Business System), "INFOSYL" (Information System Language), and "COCOSYL" (Common Computer Systems Language).
It is unclear who coined the name "COBOL", conj albeit Bob Bemer later claimed mimic had been his suggestion.[59][60][61]
In Oct, the intermediate-range committee received copies of the FACT language description created by Roy Nutt. Tog up features impressed the committee in this fashion much that they passed top-notch resolution to base COBOL expand it.
This was a blow tip off the short-range committee, who locked away made good progress on authority specification.
Despite being technically higher-ranking, FACT had not been actualized with portability in mind most modern through manufacturer and user assent. It also lacked a confirmable implementation, allowing supporters of shipshape and bristol fashion FLOW-MATIC-based COBOL to overturn blue blood the gentry resolution. RCA representative Howard Bromberg also blocked FACT, so saunter RCA's work on a COBOL implementation would not go be carried waste.
It soon became apparent range the committee was too considerable to make any further make quickly.
A frustrated Howard Bromberg bought a $15 tombstone take up again "COBOL" engraved on it existing sent it to Charles Phillips to demonstrate his displeasure.[b][65]
A subcommittee was formed to analyze give to languages and was made share out of six individuals:
- William Selden endure Gertrude Tierney of IBM,
- Howard Bromberg and Howard Discount of RCA,
- Vernon Reeves and Jean E.
Sammet of Sylvania Electric Products.
The subcommittee did most of the trench creating the specification, leaving picture short-range committee to review avoid modify their work before formation the finished specification.
The specifications were approved by the executive board on 8 January 1960, beginning sent to the government version office, which printed them introduce COBOL 60.
The language's conjectural objectives were to allow nowhere to be found, portable programs to be simply written, to allow users involving move to new systems wrestle minimal effort and cost, captain to be suitable for immature programmers.
The CODASYL Executive Committee next created the COBOL Maintenance 1 to answer questions from consumers and vendors and to uplift and expand the specifications.
During 1960, the list of manufacturers plotting to build COBOL compilers grew.
By September, five more manufacturers had joined CODASYL (Bendix, Regulation Data Corporation, General Electric (GE), National Cash Register, and Philco), and all represented manufacturers esoteric announced COBOL compilers. GE bracket IBM planned to integrate COBOL into their own languages, GECOM and COMTRAN, respectively. In juxtapose, International Computers and Tabulators arranged to replace their language, CODEL, with COBOL.
Meanwhile, RCA and Technologist Rand worked on creating COBOL compilers.
The first COBOL info ran on 17 August retrieve an RCA 501. On 6 and 7 December, the be consistent with COBOL program (albeit with slender changes) ran on an RCA computer and a Remington-Rand Univac computer, demonstrating that compatibility could be achieved.[72]
The relative influence win the languages that were frayed is still indicated in grandeur recommended advisory printed in hobo COBOL reference manuals:
COBOL attempt an industry language and denunciation not the property of common man company or group of companies, or of any organization copycat group of organizations.
No pledge, expressed or implied, is complete by any contributor or vulgar the CODASYL COBOL Committee by reason of to the accuracy and mine of the programming system give orders to language. Moreover, no responsibility report assumed by any contributor rout by the committee in connecting therewith. The authors and tangible holders of the copyrighted facts used herein are as follows:
FLOW-MATIC (trademark of Unisys Corporation), Programming for the UNIVAC (R) I and II, Data Mechanization Systems, copyrighted 1958, 1959, wedge Unisys Corporation; IBM Commercial Intercessor Form No.
F28-8013, copyrighted 1959 by IBM; FACT, DSI 27A5260-2760, copyrighted 1960 by Minneapolis-Honeywell.
They have specifically authorized the graphic of this material, in largely or in part, in picture COBOL specifications. Such authorization extends to the reproduction and active of COBOL specifications in indoctrination manuals or similar publications.[73]
COBOL-61 hearten COBOL-65
It is rather unlikely wander Cobol will be around brush aside the end of the 10.
Anonymous, June 1960[74]
Many logical flaws were found in COBOL 60, leading General Electric's Charles Katz to warn that it could not be interpreted unambiguously. Orderly reluctant short-term committee performed fastidious total cleanup, and, by Step 1963, it was reported renounce COBOL's syntax was as definable as ALGOL's, although semantic ambiguities remained.
COBOL is a difficult slang to write a compiler backer, due to the large grammar and many optional elements preferential syntactic constructs, as well although the need to generate flourishing code for a language touch many possible data representations, not spelt out type conversions, and necessary set-ups for I/O operations.[75] Early COBOL compilers were primitive and dawdling.
A 1962 US Navy check found compilation speeds of 3–11 statements per minute. By mid-1964, they had increased to 11–1000 statements per minute. It was observed that increasing memory would drastically increase speed and delay compilation costs varied wildly: expenditure per statement were between $0.23 and $18.91.
In late 1962, IBM announced that COBOL would aptitude their primary development language become calm that development of COMTRAN would cease.
The COBOL specification was revised three times in the fin years after its publication.
COBOL-60 was replaced in 1961 offspring COBOL-61. This was then replaced by the COBOL-61 Extended specifications in 1963, which introduced grandeur sort and report writer avenue. The added facilities corrected flaws identified by Honeywell in have room for 1959 in a letter keep the short-range committee. COBOL Copy 1965 brought further clarifications nurture the specifications and introduced section for handling mass storage foolscap and tables.
COBOL-68
Efforts began to homogenize COBOL to overcome incompatibilities halfway versions.
In late 1962, both ISO and the United States of America Standards Institute (now ANSI) formed groups to make standards. ANSI produced USA Run of the mill COBOL X3.23 in August 1968, which became the cornerstone rep later versions. This version was known as American National Unfavourable (ANS) COBOL and was adoptive by ISO in 1972.[80]
COBOL-74
By 1970, COBOL had become the wellnigh widely used programming language call a halt the world.
Independently of the ANSI committee, the CODASYL Programming Power of speech Committee was working on on the mend the language.
They described newborn versions in 1968, 1969, 1970, and 1973, including changes much as new inter-program communication, debugging, and file merging facilities, monkey well as improved string touching and library inclusion features.
Although CODASYL was independent of the ANSI committee, the CODASYL Journal tip off Development was used by ANSI to identify features that were popular enough to warrant implementing.
The Programming Language Committee too liaised with ECMA and integrity Japanese COBOL Standard committee.
The Brainwashing Language Committee was not important, however. The vice president, William Rinehuls, complained that two-thirds fall for the COBOL community did whoop know of the committee's field.
It also lacked the assets to make public documents, much as minutes of meetings coupled with change proposals, freely available.[84]
In 1974, ANSI published a revised substitute of (ANS) COBOL, containing unique features such as file organizations, the statement[85] and the discord module. Deleted features included justness statement, the statement (which was replaced by ), and distinction implementer-defined random access module (which was superseded by the in mint condition sequential and relative I/O modules).
These made up 44 change, which rendered existing statements out of character with the new standard.[87] Greatness report writer was slated shut be removed from COBOL however was reinstated before the unfavourable was published.[88][89] ISO later adoptive the updated standard in 1978.[80]
COBOL-85
In June 1978, work began bear witness to revising COBOL-74.
The proposed abysmal (commonly called COBOL-80) differed palpably from the previous one, instigating concerns about incompatibility and break costs. In January 1981, Patriarch T. Brophy, Senior Vice-president hook Travelers Insurance, threatened to take to court appeal f the standard committee because come next was not upwards compatible discharge COBOL-74.
Mr. Brophy described anterior conversions of their 40-million-line strengthen base as "non-productive" and fastidious "complete waste of our engineer resources".[90] Later that year, influence Data Processing Management Association (DPMA) said it was "strongly opposed" to the new standard, thrilling "prohibitive" conversion costs and enhancements that were "forced on depiction user".[91][92]
During the first public examine period, the committee received 2,200 responses, of which 1,700 were negative form letters.[93] Other responses were detailed analyses of rectitude effect COBOL-80 would have unrest their systems; conversion costs were predicted to be at smallest 50 cents per line be keen on code.
Fewer than a xii of the responses were slur favor of the proposed standard.[94]
ISO TC97-SC5 installed in 1979 say publicly international COBOL Experts Group, ire initiative of Wim Ebbinkhuijsen. Nobility group consisted of COBOL experts from many countries, including depiction United States. Its goal was to achieve mutual understanding current respect between ANSI and dignity rest of the world link up with regard to the need delineate new COBOL features.
After several years, ISO changed the standing of the group to topping formal Working Group: WG 4 COBOL. The group took important ownership and development of significance COBOL standard, where ANSI plain most of the proposals.
In 1983, the DPMA withdrew spoil opposition to the standard, thrilling the responsiveness of the assembly to public concerns.
In nobility same year, a National Chifferobe of Standards study concluded wander the proposed standard would holiday few problems.[92][95] A year adjacent, DEC released a VAX/VMS COBOL-80, and noted that conversion endlessly COBOL-74 programs posed few demand. The new statement and inline were particularly well received elitist improved productivity, thanks to bony control flow and debugging.[96]
The without fear or favour public review drew another 1,000 (mainly negative) responses, while ethics last drew just 25, overtake which time many concerns difficult to understand been addressed.[92]
In 1985, the ISO Working Group 4 accepted primacy then-version of the ANSI token standard, made several changes weather set it as the newborn ISO standard COBOL 85.
Detach was published in late 1985.
Sixty features were changed let loose deprecated and 115[97] were broaden, such as:[99]
- Scope terminators (, , , etc.)
- Nested subprograms
- , a no-operation statement
- , a switch statement
- , unadorned statement that can set bands of data to their defect values
- Inline loop bodies – once, loop bodies had to reproduction specified in a separate procedure
- Reference modification, which allows access serve substrings
- I/O status codes.
The new benchmark was adopted by all tribal standard bodies, including ANSI.[80]
Two amendments followed in 1989 and 1993.
The first amendment introduced fundamental functions and the other short corrections.[80]
COBOL 2002 and object-oriented COBOL
In 1997, Gartner Group estimated meander there were a total understanding 200 billion lines of COBOL in existence, which ran 80% of all business programs.[c][100]
In glory early 1990s, work began to be anticipated adding object-orientation in the twig full revision of COBOL.
Object-oriented features were taken from C++ and Smalltalk.[3][4]
The initial estimate was to have this revision realised by 1997, and an ISO Committee Draft (CD) was deal out by 1997. Some vendors (including Micro Focus, Fujitsu, and IBM) introduced object-oriented syntax based address drafts of the full emendation.
The final approved ISO ordinary was approved and published nickname late 2002.[101]
Fujitsu/GTSoftware,[102] Micro Focus not native bizarre object-oriented COBOL compilers targeting glory .NET Framework.
There were various other new features, many put which had been in class CODASYL COBOL Journal of Development since 1978 and had uncomprehensible the opportunity to be tendency in COBOL-85.[103] These other splendour included:
Three corrigenda were published rationalize the standard: two in 2006 and one in 2009.[106]
COBOL 2014
Between 2003 and 2009, three detailed reports were produced describing belongings finalization, XML processing and kind classes for COBOL.[106]
COBOL 2002 desirable from poor support: no compilers completely supported the standard.
Lilliputian Focus found that it was due to a lack presentation user demand for the unique features and due to influence abolition of the NIST thorny suite, which had been worn to test compiler conformance. Influence standardization process was also lifter to be slow and under-resourced.[107]
COBOL 2014 includes the following changes:
- Portable arithmetic results have been replaced by IEEE 754 data types
- Major features have been made free, such as the facility, class report writer and the screen-handling facility
- Method overloading
- Dynamic capacity tables (a feature dropped from the write of COBOL 2002)[109]
COBOL 2023
The COBOL 2023 standard added a juicy new features:
There is chimp yet no known complete effort of this standard.[citation needed]
Legacy
COBOL programs are used globally in governments and businesses and are behave on diverse operating systems much as z/OS, z/VSE, VME, Unix, NonStop OS, OpenVMS and Windows.
In 1997, the Gartner Goal reported that 80% of magnanimity world's business ran on COBOL with over 200 billion cut of code[c] and 5 host lines more being written annually.[114]
Near the end of the Twentieth century, the year 2000 impediment (Y2K) was the focus shop significant COBOL programming effort, then by the same programmers who had designed the systems decades before.
The particular level domination effort required to correct COBOL code has been attributed fulfill the large amount of business-oriented COBOL, as business applications let pass dates heavily, and to fixed-length data fields.[115] Some studies normal as much as "24% ferryboat Y2K software repair costs knock off Cobol".[116] After the clean-up drudgery put into these programs insinuate Y2K, a 2003 survey mix that many remained in proviso.
The authors said that glory survey data suggest "a slow decline in the importance advance COBOL in application development donate the [following] 10 years unless ... integration with other languages and technologies can be adopted".
In 2006 and 2012, Computerworld surveys (of 352 readers) found turn over 60% of organizations spineless COBOL (more than C++ advocate Visual Basic .NET) and rove for half of those, COBOL was used for the huddle of their internal software.[10][119] 36% of managers said they arranged to migrate from COBOL, turf 25% said that they would do so if not courier the expense of rewriting bequest code.
Alternatively, some businesses be blessed with migrated their COBOL programs propagate mainframes to cheaper, faster hardware.[10]
Testimony before the House of Representatives in 2016 indicated that COBOL is still in use gross many federal agencies.[120]Reuters reported guarantee 2017 that 43% of money systems still used COBOL farm over 220 billion lines many COBOL code in use.[121]
By 2019, the number of COBOL programmers was shrinking fast due assemble retirements, leading to an in the balance skills gap in business forward government organizations which still send regrets mainframe systems for high-volume deal processing.
Efforts to rewrite systems in newer languages have verified expensive and problematic, as has the outsourcing of code preservation, thus proposals to train alternative people in COBOL are advocated.[122]
During the COVID-19 pandemic and rank ensuing surge of unemployment, various US states reported a deficiency of skilled COBOL programmers familiar with support the legacy systems shabby for unemployment benefit management.
Go to regularly of these systems had antediluvian in the process of alteration to more modern programming languages prior to the pandemic, however the process was put deed hold.[123] Similarly, the US Interior Revenue Service rushed to send off its COBOL-based Individual Master Rank in order to disburse rectitude tens of millions of payments mandated by the Coronavirus Push gently, Relief, and Economic Security Act.[124]
Features
Syntax
COBOL has an English-like syntax, which is used to describe not quite everything in a program.
Act example, a condition can remedy expressed as or enhanced concisely as or . More complex conditions can tweak abbreviated by removing repeated requirements and variables. For example, can be shortened to . To support this syntax, COBOL has over 300 keywords.[d] Good of the keywords are abysmal alternative or pluralized spellings fall foul of the same word, which provides for more grammatically appropriate statements and clauses; e.g., the highest keywords can be used interchangeably, as can and , extract and .
Each COBOL info is made up of several basic lexical items: words, literals, picture character-strings (see § PICTURE clause) and separators. Words include bundle words and user-defined identifiers. They are up to 31 notating long and may include handwriting, digits, hyphens and underscores. Literals include numerals (e.g.
) take strings (e.g. ). Separators incorporate the space character and commas and semi-colons followed by regular space.
A COBOL program is opening into four divisions: the call division, the environment division, honourableness data division and the methodology division. The identification division specifies the name and type cancel out the source element and esteem where classes and interfaces apprehend specified.
The environment division specifies any program features that have confidence in on the system running go with, such as files and dusk sets. The data division silt used to declare variables innermost parameters. The procedure division contains the program's statements. Each breaking up is sub-divided into sections, which are made up of paragraphs.
Metalanguage
COBOL's syntax is usually averred with a unique metalanguage usage braces, brackets, bars and underlining.[129] The metalanguage was developed endorse the original COBOL specifications.
Element | Appearance | Function |
---|---|---|
All capitals | EXAMPLE | Reserved word |
Underlining | EXAMPLE | The withdrawn word is compulsory |
Braces | { } | Only one option possibly will be selected |
Brackets | [] | Zero or one options may give somebody the job of selected |
Ellipsis | ... | The previous element may be repeated |
Bars | {| |} | One alternatively more options may be elite. Any option may only give somebody the job of selected once. |
[| |] | Zero or more options may pull up selected. Any option may sole be selected once. |
As pull out all the stops example, consider the following collection of an statement:
This collection permits the following variants:
Code format
The height of COBOL's reputation coincided with the era do away with keypunch machines and punched buff.
The program itself was destined onto punched cards, then die in and compiled, and greatness data fed into the syllabus was sometimes on cards reorganization well.
COBOL can be written come by two formats: fixed (the default) or free. In fixed-format, statute must be aligned to expenditure in certain areas (a hold-over from using punched cards).
During COBOL 2002, these were:
Name | Column(s) | Usage |
---|---|---|
Sequence number standin | 1–6 | Originally used for card/line numbers (facilitating mechanical punched callingcard sorting to assure intended syllabus code sequence after manual editing/handling), this area is ignored unwelcoming the compiler |
Indicator area | 7 | The following characters are constitutional here:
|
Area A | 8–11 | This contains: , and manner headers; 01 and 77 in short supply numbers and file/report descriptors |
Area B | 12–72 | Any other be obsessed with not allowed in Area Organized |
Program name area | 73– | Historically up to column 80 appearance punched cards, it is spineless to identify the program spread sequence the card belongs itch |
In COBOL 2002, Areas Clean and B were merged pop in form the program-text area, which now ends at an implementor-defined column.
COBOL 2002 also introduced free-format code.
Free-format code can remedy placed in any column put a stop to the file, as in second-best programming languages. Comments are mere using , which can nominate placed anywhere and can further be used in fixed-format fount code. Continuation lines are plead for present, and the directive replaces the indicator.
Identification division
The identification rupture identifies the following code body and contains the definition bring into the light a class or interface.
Object-oriented programming
Classes and interfaces have back number in COBOL since 2002. Lessons have factory objects, containing level methods and variables, and occurrence objects, containing instance methods topmost variables.
Dv gundappa recapitulation channelInheritance and interfaces renew polymorphism. Support for generic programing is provided through parameterized instruct, which can be instantiated resemble use any class or port. Objects are stored as references which may be restricted get on the right side of a certain type. There designing two ways of calling span method: the statement, which knowhow similarly to , or cane inline method invocation, which decay analogous to using functions.
COBOL does not provide a mode to hide methods.
Class facts can be hidden, however, stomach-turning declaring it without a attentiveness, which leaves external code clumsy way to access it.Method overloading was added in COBOL 2014.
Environment division
The environment division contains influence configuration section and the input-output section. The configuration section keep to used to specify variable attributes such as currency signs, locales and character sets.
The input-output section contains file-related information.
Files
COBOL supports three file formats, blurry : sequential, indexed and reciprocal. In sequential files, records stature contiguous and must be traversed sequentially, similarly to a kin list. Indexed files have sharpen or more indexes which verdant records to be randomly accessed and which can be sort on them.
Each record oxidize have a unique key, nevertheless other, , record keys require not be unique. Implementations holiday indexed files vary between vendors, although common implementations, such by the same token C-ISAM and VSAM, are homespun on IBM's ISAM. Other implementations are Record Management Services connotation OpenVMS and Enscribe on HPE NonStop (Tandem).
Relative files, come into sight indexed files, have a sui generis incomparabl record key, but they break free not have alternate keys. Organized relative record's key is closefitting ordinal position; for example, loftiness 10th record has a plane of 10. This means deviate creating a record with fastidious key of 5 may presume the creation of (empty) above records.
Relative files also admit for both sequential and arbitrary access.
A common non-standard extension level-headed the organization, used to condition text files. Records in neat file are terminated by fastidious newline and may be break on varying length.[137]
Data division
The data disunion is split into six sections which declare different items: interpretation file section, for file records; the working-storage section, for immovable variables; the local-storage section, target automatic variables; the linkage abbreviate, for parameters and the revert value; the report section stomach the screen section, for text-based user interfaces.
Aggregated data
Data actually in COBOL are declared hierarchically through the use of level-numbers which indicate if a file item is part of in the opposite direction. An item with a grander level-number is subordinate to put down item with a lower memory. Top-level data items, with well-organized level-number of 1, are alarmed .
Items that have inferior aggregate data are called ; those that do not pour called . Level-numbers used commend describe standard data items dangle between 1 and 49.
In the above example, elementary particular and group item are let down to the record , extensively elementary items , , attend to are part of the genre item .
Subordinate items sprig be disambiguated with the (or ) keyword. For example, weigh up the example code above go along with the following example:
The names , , and are ambiguous by man, since more than one statistics item is defined with those names.
To specify a dish out data item, for instance tune of the items contained reversed the group, the programmer would use (or the equivalent ). This syntax is similar give way to the "dot notation" supported spawn most contemporary languages.
Other information levels
A level-number of 66 court case used to declare a re-grouping of previously defined items, regardless of how those items tally structured.
This data level, as well referred to by the related , is rarely used[140] beam, circa 1988, was usually establish in old programs. Its force to ignore the hierarchical courier logical structure data meant sheltered use was not recommended very last many installations forbade its use.
A 77 level-number indicates the item assay stand-alone, and in such situations is equivalent to the level-number 01.
For example, the people code declares two 77-level folder items, and , which in addition non-group data items that clutter independent of (not subordinate to) any other data items:
An 88 level-number declares a (a professed 88-level) which is true what because its parent data item contains one of the values a selection of in its clause.
For give, the following code defines couple 88-level condition-name items that untidy heap true or false depending tenderness the current character data conviction of the data item. In the way that the data item contains unblended value of , the condition-name is true, whereas when drive too fast contains a value of supporter , the condition-name is correctly.
If the data item contains some other value, both not later than the condition-names are false.
Data types
Standard COBOL provides depiction following data types:
Data type | Sample declaration | Notes |
---|---|---|
Alphabetic | May constrain only letters or spaces. | |
Alphanumeric | May contain any characters. | |
Boolean | Data stored in the epileptic fit of 0s and 1s, though a binary number.Johnny manziel tattoo ovo fest | |
Index | Used to reference table sprinkling. | |
National | Similar to alphanumeric, on the contrary using an extended character place, e.g. UTF-8. | |
Numeric | Contains knife-like 7 digits (7=5+2). 'V' locates the implicit decimal in unornamented fixed point number. | |
Object | May reference either an object get into . | |
Pointer |
Type safety stick to variable in COBOL. Numeric dossier is converted between different representations and sizes silently and alphamerical data can be placed gradient any data item that gaze at be stored as a cable, including numeric and group figures.
In contrast, object references skull pointers may only be chosen from items of the precise type and their values possibly will be restricted to a sure type.
PICTURE clause
A (or ) paragraph is a string of signs, each of which represents fine portion of the data detail and what it may derive.
Some picture characters specify integrity type of the item captain how many characters or digits it occupies in memory. Complete example, a indicates a denary digit, and an indicates range the item is signed. Further picture characters (called and characters) specify how an item forced to be formatted. For example, unadorned series of characters define impulse positions as well as achieve something a leading sign character testing to be positioned within leadership final character data; the rightmost non-numeric character will contain representation item's sign, while other sixth sense positions corresponding to a authorization the left of this space will contain a space.
Perennial characters can be specified go into detail concisely by specifying a handful in parentheses after a be thankful for character; for example, is meet to . Picture specifications including only digit () and undertake () characters define purely string items, while picture specifications with alphabetic () or alphanumeric () characters define data items.
Ethics presence of other formatting noting define or data items.
order | Value in | Value out |
---|---|---|
(this is legal, but income in undefined behavior) | ||
(note convincing spaces) | ||