Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 18

Basis

Before the mid-1960s, computers were extremely expensive and used only for special-purpose tasks. A simple batch processingarrangement ran only a single "job" at a time, one after another. But during the 1960s faster and more affordable computers became available. and as prices decreased newer computer systems supported time-sharing, a system which allows multiple users or processes to use theCPU and memory. In such a system the operating system alternates between running processes, giving each one running time on the CPU before switching to another. The machines had become fast enough that most users could feel they had the machine all to themselves. By this point the problem of interacting with the computer was a concern. In the batch processing model, users never interacted with the machine directly, instead they tended their jobs to the computer operators. Under the time-sharing model the users were given individualcomputer terminals and interacted directly. The need for system to simplify this experience, from command line interpreters to programming languages was an area of intense research during the 1960s and 70s. The original BASIC language was designed in 1964 by John Kemeny and Thomas Kurtz[2] and implemented by a team of Dartmouth students under their direction. The acronym is tied to the name of an unpublished paper by Thomas Kurtz and is not a backronym.[3] BASIC was designed to allow students to write programs for the Dartmouth Time-Sharing System. It was intended specifically for the new class of users that time-sharing systems allowedthat is, a less technical user who did not have the mathematical background of the more traditional users and was not interested in acquiring it. Being able to use a computer to support teaching and research was quite novel at the time. The language was based on FORTRAN II, with some influences from ALGOL 60 and with additions to make it suitable for timesharing. Initially, BASIC concentrated on supporting straightforward mathematical work, with matrix arithmetic support from its initial implementation as a batch language and full string functionality being added by 1965. The designers of the language decided to make the compiler available free of charge so that the language would become widespread. They also made it available to high schools in the Hanover area and put a considerable amount of effort into promoting the language. In the following years, as other dialects of BASIC appeared, Kemeny and Kurtz's original BASIC dialect became known as Dartmouth BASIC

Data types and variables


Minimal versions of BASIC had only integer variables and one-letter variable names. More powerful versions had floating-point arithmetic, and variables could be labelled with names six or more characters long. String variables are usually distinguished in many microcomputer dialects by having $ suffixed to their name, and string values are typically enclosed in quotation marks. Arrays in BASIC could contain integers, floating point or string variables.

Some dialects of BASIC supported matrices and matrix operations, useful for the solution of sets of simultaneous linear algebraic equations. These dialects would support matrix operations such as assignment, addition, multiplication (of compatible matrix types), and evaluation of a determinant. Microcomputer dialects often lacked this data type and required a programmer to provide subroutines to carry out equvalent operations.

Examples
The original Dartmouth Basic was unusual in having a matrix keyword, MAT.[notes 2] Although dropped by most later microprocessor derivatives it is used in this example from the 1968 manual[15] which averages the numbers that are input: 5 LET S = 0 10 MAT INPUT V 20 LET N = NUM 30 IF N = 0 THEN 99 40 FOR I = 1 TO N 45 LET S = S + V(I) 50 NEXT I 60 PRINT S/N 70 GO TO 5 99 END New BASIC programmers on a home computer might start with a simple program similar to the Hello world program made famous byKernighan and Ritchie. This generally involves simple use of the language's PRINT statement to display the message (such as the programmer's name) to the screen. Often an infinite loop was used to fill the display with the message. Most first generation BASIC languages such as MSX BASIC and GW-BASIC supported simple data types, loop cycles and arrays. The following example is written for GW-BASIC, but will work in most versions of BASIC with minimal changes: 10 INPUT "What is your name: ", U$ 20 PRINT "Hello "; U$ 30 INPUT "How many stars do you want: ", N 40 S$ = "" 50 FOR I = 1 TO N 60 S$ = S$ + "*" 70 NEXT I 80 PRINT S$ 90 INPUT "Do you want more stars? ", A$ 100 IF LEN(A$) = 0 THEN GOTO 90 110 A$ = LEFT$(A$, 1) 120 IF A$ = "Y" OR A$ = "y" THEN GOTO 30 130 PRINT "Goodbye "; U$

140 END The resulting dialog might resemble: What is your name: Mike Hello Mike How many stars do you want: 7 ******* Do you want more stars? yes How many stars do you want: 3 *** Do you want more stars? no Goodbye Mike Second generation BASICs (for example QuickBASIC and PowerBASIC) introduced a number of features into the language, primarily related to structured and procedure-oriented programming. Usually, line numbering is omitted from the language and replaced with labels (for GOTO) and procedures to encourage easier and more flexible design.[16] INPUT "What is your name: ", UserName$ PRINT "Hello "; UserName$ DO INPUT "How many stars do you want: ", NumStars Stars$ = STRING$(NumStars, "*") PRINT Stars$ DO INPUT "Do you want more stars? ", Answer$ LOOP UNTIL Answer$ <> "" Answer$ = LEFT$(Answer$, 1) LOOP WHILE UCASE$(Answer$) = "Y" PRINT "Goodbye "; UserName$ Third generation BASIC dialects such as Visual Basic, REALbasic, StarOffice Basic and BlitzMax introduced features to support object-oriented and event-driven programming paradigm. Most built-in procedures and functions are now represented as methods of standard objects rather than operators. The following example is in Visual Basic .NET: Public Class StarsProgram Public Shared Sub Main() Dim UserName, Answer, stars As String, NumStars As Integer Console.Write("What is your name: ") UserName = Console.ReadLine() Console.WriteLine("Hello {0}", UserName) Do

Console.Write("How many stars do you want: ") NumStars = CInt(Console.ReadLine()) stars = New String("*", NumStars) Console.WriteLine(stars) Do Console.Write("Do you want more stars? ") Answer = Console.ReadLine() Loop Until Answer <> "" Answer = Answer.Substring(0, 1) Loop While Answer.ToUpper() = "Y" Console.WriteLine("Goodbye {0}", UserName) End Sub End Class [edit]

Standards
ANSI/ISO/IEC Standard for Minimal BASIC: ANSI X3.60-1978 "For minimal BASIC" ISO/IEC 6373:1984 "Data Processing Programming Languages Minimal BASIC"

ANSI/ISO/IEC Standard for Full BASIC: ANSI X3.113-1987 "Programming Languages Full BASIC" INCITS/ISO/IEC 10279-1991 (R2005) "Information Technology - Programming Languages - Full BASIC"

ANSI/ISO/IEC Addendum Defining Modules: ANSI X3.113 Interpretations-1992 "BASIC Technical Information Bulletin # 1 Interpretations of ANSI 03.113-1987"

ISO/IEC 10279:1991/ Amd 1:1994 "Modules and Single Character Input Enhancement"

ECMA-116 BASIC (withdrawn, similar to ANSI X3.113-1987)

Fotran programming language


History - In late 1953, John W. Backus submitted a proposal to his superiors at IBM to develop a more practical alternative to assembly language for programming theirIBM 704 mainframe computer. Backus' historic FORTRAN team consisted of programmers Richard Goldberg, Sheldon F. Best, Harlan Herrick, Peter Sheridan, Roy Nutt, Robert Nelson, Irving Ziller, Lois Haibt, and David Sayre.[3] A draft specification for The IBM Mathematical Formula Translating System was completed by mid-1954. The first manual for FORTRAN appeared in October 1956, with the first FORTRAN compiler delivered in April 1957. This was the firstoptimizing compiler, because customers were reluctant to use a high-level programming language unless its compiler could generate code whose performance was comparable to that of hand-coded assembly language.[4] While the community was skeptical that this new method could possibly outperform hand-coding, it reduced the number of programming statementsnecessary to operate a machine by a factor of 20, and quickly gained acceptance. John Backus said during a 1979 interview with Think, the IBM employee magazine, "Much of my work has come from being lazy. I didn't like writing programs, and so, when I was working on the IBM 701, writing programs for computing missile trajectories, I started work on a programming system to make it easier to write programs."[5] The language was widely adopted by scientists for writing numerically intensive programs, which encouraged compiler writers to produce compilers that could generate faster and more efficient code. The inclusion of a complex number data type in the language made Fortran especially suited to technical applications such as electrical engineering. By 1960, versions of FORTRAN were available for the IBM 709, 650, 1620, and 7090 computers. Significantly, the increasing popularity of FORTRAN spurred competing computer manufacturers to provide FORTRAN compilers for their machines, so that by 1963 over 40 FORTRAN compilers existed. For these reasons, FORTRAN is considered to be the first widely used programming language supported across a variety of computer architectures. The development of FORTRAN paralleled the early evolution of compiler technology, and many advances in the theory and design ofcompilers were specifically motivated by the need to generate efficient code for FORTRAN programs.

FORTRAN II
IBM's FORTRAN II appeared in 1958. The main enhancement was to support procedural programming by allowing user-written subroutines and functions which returned values, with parameters passed by reference. The COMMON statement provided a way for subroutines to access common (or global) variables. Six new statements were introduced:

SUBROUTINE, FUNCTION, and END

CALL and RETURN COMMON

Over the next few years, FORTRAN II would also add support for the DOUBLE PRECISION and COMPLEX data types. [edit]Simple FORTRAN II program This program, for Heron's formula, reads one data card containing three 5-digit integers A, B, and C as input. If A, B, and C cannot represent the sides of a triangle in plane geometry, then the program's execution will end with an error code of "STOP 1". Otherwise, an output line will be printed showing the input values for A, B, and C, followed by the computed AREA of the triangle as a floating-point number with 2 digits after the decimal point. C C C C AREA OF A TRIANGLE WITH A STANDARD SQUARE ROOT FUNCTION INPUT - CARD READER UNIT 5, INTEGER INPUT OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUT INPUT ERROR DISPLAY ERROR OUTPUT CODE 1 IN JOB CONTROL LISTING READ INPUT TAPE 5, 501, IA, IB, IC 501 FORMAT (3I5) IA, IB, AND IC MAY NOT BE NEGATIVE FURTHERMORE, THE SUM OF TWO SIDES OF A TRIANGLE IS GREATER THAN THE THIRD SIDE, SO WE CHECK FOR THAT, TOO IF (IA) 777, 777, 701 701 IF (IB) 777, 777, 702 702 IF (IC) 777, 777, 703 703 IF (IA+IB-IC) 777,777,704 704 IF (IA+IC-IB) 777,777,705 705 IF (IB+IC-IA) 777,777,799 777 STOP 1 USING HERON'S FORMULA WE CALCULATE THE AREA OF THE TRIANGLE 799 S = FLOATF (IA + IB + IC) / 2.0 AREA = SQRT( S * (S - FLOATF(IA)) * (S - FLOATF(IB)) * + (S - FLOATF(IC))) WRITE OUTPUT TAPE 6, 601, IA, IB, IC, AREA 601 FORMAT (4H A= ,I5,5H B= ,I5,5H C= ,I5,8H AREA= ,F10.2, + 13H SQUARE UNITS) STOP END

C C C

C C

[edit]FORTRAN

III

A FORTRAN coding form, printed on paper and intended to be used by programmers to prepare programs for punching onto cards by keypunch operators. Now obsolete.

IBM also developed a FORTRAN III in 1958 that allowed for inline assembler code among other features; however, this version was never released as a product. Like the 704 FORTRAN and FORTRAN II, FORTRAN III included machine-dependent features that made code written in it unportable from machine to machine. Early versions of FORTRAN provided by other vendors suffered from the same disadvantage.

Code examples
For more details on this topic, see Wikibooks:Fortran/Fortran examples. The following program illustrates dynamic memory allocation and array-based operations, two features introduced with Fortran 90. Particularly noteworthy is the absence of DO loops and IF/THEN statements in manipulating the array; mathematical operations are applied to the array as a whole. Also apparent is the use of descriptive variable names and general code formatting that conform with contemporary programming style. This example computes an average over data entered interactively. program average

Fortran-based languages
Prior to FORTRAN 77, a number of preprocessors were commonly used to provide a friendlier language, with the advantage that the preprocessed code could be compiled on any machine with a standard FORTRAN compiler. Popular preprocessors included FLECS,MORTRAN, SFtran, S-Fortran, Ratfor, and Ratfiv. Ratfor and Ratfiv, for example, implemented a C-like language, outputting preprocessed code in standard FORTRAN 66. LRLTRAN was developed at the Lawrence Radiation Laboratory to provide support for vector arithmetic and dynamic storage, among other extensions to support systems programming. The distribution included the LTSS operating system.

The Fortran-95 Standard includes an optional Part 3 which defines an optional conditional compilation capability. This capability is often referred to as "CoCo". Many Fortran compilers have integrated subsets of the C preprocessor into their systems. SIMSCRIPT is an application specific Fortran preprocessor for modeling and simulating large discrete systems. The F programming language was designed to be a clean subset of Fortran 95 that attempted to remove the redundant, unstructured, and deprecated features of Fortran, such as the EQUIVALENCE statement. F retains the array features added in Fortran 90, and removes control statements that were made obsolete by structured programming constructs added to both Fortran 77 and Fortran 90. F is described by its creators as "a compiled, structured, array programming language especially well suited to education and scientific computing.

! Read in some numbers and take the average ! As written, if there are no data points, an average of zero is returned ! While this may not be desired behavior, it keeps this example simple implicit none real, dimension(:), allocatable :: points integer :: number_of_points real :: average_points=0., positive_average=0., negative_average=0. write (*,*) "Input number of points to average:" read (*,*) number_of_points allocate (points(number_of_points)) write (*,*) "Enter the points to average:" read (*,*) points ! Take the average by summing points and dividing by number_of_points if (number_of_points > 0) average_points = sum(points) / number_of_points ! Now form average over positive and negative points only if (count(points > 0.) > 0) then positive_average = sum(points, points > 0.) / count(points > 0.) end if if (count(points < 0.) > 0) then negative_average = sum(points, points < 0.) / count(points < 0.)

end if deallocate (points) ! Print result to terminal write (*,'(a,g12.4)') 'Average = ', average_points write (*,'(a,g12.4)') 'Average of positive points = ', positive_average write (*,'(a,g12.4)') 'Average of negative points = ', negative_average

disadvantages
Up till Fortran 90/95, the language was primarily intended for calculations. It remains one of the best computational languages ever developed, and is still in heavy use in the financial industry. However, due in large part to disagreements among members of the Fortran development groups, Fortran 77 was deficient in a number of areas. Most or all of these have since been addressed by Fortran 90/95, however, so they do not represent current language deficiencies. These limitations included:
1. Poor string handling, including weak concatenation and length functions. 2. Subroutines pass arguments by reference rather than by value, making data protection difficult. 3. Data scoping is limited. Variables can either be local or in COMMON blocks, but no other scoping is allowed. As a result, it's not possible to write file-level procedures; shared logic must be in a separate subroutine or repeated via cloning. 4. Loop controls are somewhat limited, requiring continued use of the GOTO statement to manage flow in some cases.

Basic programming language


The COBOL specification was created by a committee of researchers from private industry, universities, and government during the second half of 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 Bemerwas 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 meeting of 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. [edit]ANS

COBOL 1968

After 1959 COBOL underwent 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. [edit]COBOL

1974

In 1974, ANSI published a revised version of (ANS) COBOL, containing a number of features that were not in the 1968 version. [edit]COBOL

1985

In 1985, ANSI published still another revised version that had new features not in the 1974 standard, most notably structured language constructs ("scope terminators"), including END-IF, ENDPERFORM, END-READ, etc. [edit]COBOL

2002 and object-oriented COBOL

The language continues to evolve today. In 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, Veryant, 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++ and Java programming languages, 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.[5] 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 Microsoft's .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

[edit]History

of COBOL standards

The 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 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 what other

Self-modifying code
The original COBOL specification supported self-modifying code via the infamous "ALTER X TO PROCEED TO Y" statement. X and Y are paragraph labels, and any "GOTO X" statements executed after such an ALTER statement have the meaning "GOTO Y" instead. Most[citation needed] compilers still support it, but it should not be used in new programs as it was deprecated in COBOL 1985.[citation needed] [edit]

Syntactic features
COBOL provides an update-in-place syntax, for example ADD YEARS TO AGE The equivalent construct in many procedural languages would be age = age + years This syntax is similar to the compound assignment operator later adopted by C: age += years The abbreviated conditional expression IF SALARY > 8000 OR SUPERVISOR-SALARY OR = PREV-SALARY is equivalent to IF SALARY > 8000

OR SALARY > SUPERVISOR-SALARY OR SALARY == PREV-SALARY 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. 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). [edit]

Data types
Standard COBOL provides the following data types: Data type Sample declaration Notes

Character

PIC X(20) PIC A(4)9(5)X(7)

Alphanumeric and alphabetic-only Single-byte character set (SBCS)

Edited character

PIC X99BAXX

Formatted and inserted characters

Numeric fixed-point binary

PIC S999V99 [USAGE] COMPUTATIONAL or BINARY

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 nu of bits reserved for storage.

Numeric fixed-point packed decimal

PIC S999V99 PACKED-DECIMAL

1 to 18 decimal digits (1 to 10 bytes) Signed or unsigned

Numeric fixed-point zoned decimal

PIC S999V99 [USAGE DISPLAY]

1 to 18 decimal digits (1 to 18 bytes) Signed or unsigned Leading or trailing sign, overpunch or separate

Numeric floating-point

PIC S9V999ES99

Binary floating-point

Edited numeric

PIC +Z,ZZ9.99 PIC $***,**9.99CR

Formatted characters and digits

Group (record)

01 CUST-NAME. 05 CUST-LAST PIC X(20). Aggregated elements 05 CUST-FIRST PIC X(20).

Table (array)

OCCURS 12 TIMES

Fixed-size array, row-major order Up to 7 dimensions

Variable-length table

OCCURS 0 to 12 TIMES Variable-sized array, row-major order DEPENDING ON CUST- Up to 7 dimensions COUNT

Renames (variant or union data)

66 RAW-RECORD RENAMES CUSTRECORD

Character data overlaying other variables

Condition name

88 IS-RETIRED-AGE VALUES 65 THRU 150

Boolean value dependent upon another variable

Array index

[USAGE] INDEX

Array subscript

Most vendors provide additional types, such as: Data type Sample declaration Notes

Numeric floating-point single precision

PIC S9V9999999ES99 Binary floating-point (32 bits, 7+ digits) [USAGE] COMPUTATIONAL(IBM extension) 1

Numeric floating-point double precision

PIC S9V999ES99 Binary floating-point (64 bits, 16+ digits) [USAGE] COMPUTATIONAL(IBM extension) 2

Numeric fixedpoint packed decimal

PIC S9V999 same as PACKED DECIMAL [USAGE] COMPUTATIONAL(IBM extension) 3

Numeric fixed-point binary

PIC S999V99 same as COMPUTATIONAL or BINARY [USAGE] COMPUTATIONAL(IBM extension) 4

Numeric fixed-point binary (native binary)

Binary 16, 32, or 64 bits (2, 4, or 8 bytes) PIC S999V99 Signed or unsigned. The maximum value of variables based on th [USAGE] COMPUTATIONALnumber of bits reserved for storage and not on the picture clause. 5 (IBM extension)

Numeric fixed-point binary in native byte order

PIC S999V99 Binary 16, 32, or 64 bits (2, 4, or 8 bytes) [USAGE] COMPUTATIONALSigned or unsigned 4

PIC S999V99 Numeric fixed-point Binary 16, 32, or 64 bits (2, 4, or 8 bytes) [USAGE] COMPUTATIONALbinary Signed or unsigned in big-endian byte order 5

Wide character

PIC G(20)

Alphanumeric Double-byte character set (DBCS)

Edited wide character

PIC G99BGGG

Formatted and inserted wide characters

Edited floating-point

PIC +9.9(6)E+99

Formatted characters, decimal digits, and exponent

Data pointer

[USAGE] POINTER

Data memory address

Code pointer

[USAGE] PROCEDUREPOINTER

Code memory address

Bit field

PIC 1(n) [USAGE] COMPUTATIONAL-5

n can be from 1 to 64, defining an n-bit integer Signed or unsigned

Index

[USAGE] INDEX

Binary value corresponding to an occurrence of a table element May be linked to a specific table using INDEXED BY

[edit]

Hello, world
An example of the "Hello, world" program in COBOL: IDENTIFICATION DIVISION. PROGRAM-ID. HELLO-WORLD. PROCEDURE DIVISION. DISPLAY 'Hello, world'. STOP RUN. Like any widespread programming language, there are various dialects of COBOL. Some compilers, for example, allow the use of double quotes in addition to standard single quotes: DISPLAY "Hello, world"

Advantages cobol

COBOL is self-documenting One of the design goals for COBOL was to make it possible for non-programmers such as supervisors, managers and users, to read and understand COBOL code. As a result, COBOL contains such English-like structural elements as verbs, clauses, sentences, sections and divisions. As it happens, this design goal was not realized. Managers and users nowadays do not read COBOL programs. Computer programs are just too complex for most laymen to understand them, however familiar the syntactic elements. But the design goal and its effect on COBOL syntax has had one important side-effect. It has made COBOL the most readable, understandable and self-documenting programming language in use today. It has also made it the most verbose. It is easy for programmers unused to the business programming paradigm, where programming with a view to ease of maintenance is very important, to dismiss the advantage that COBOL's readability imparts. Not only does this readability generally assist the maintenance process but the older a program gets the more valuable this readability becomes. When programs are new, both the in-program comments and the external documentation accurately reflect the program code. But over time, as more and more revisions are applied to the code, it gets out of step with the documentation until the documentation is actually a hindrance to maintenance rather than a help. The self-documenting nature of COBOL means that this problem is not as severe with COBOL programs as it is with other languages Readers who are familiar with C or C++ or Java might want to consider how difficult it becomes to maintain programs written in these languages. C programs that you have written yourself are difficult enough to understand when you come back to them six months later. Consider how much more difficult it would be to understand a program that had been written fifteen years previously, by someone else, and which had since been amended and added to by so many others that the documentation no longer accurately reflects the program code. This is a nightmare still awaiting maintenance programmers of the future. COBOL is simple COBOL is a simple language (no pointers, no user defined functions, no user defined types) with a limited scope of function. It encourages a simple straightforward programming style. Curiously enough though, despite its limitations, COBOL has proven itself to be well suited to its targeted problem domain (business computing). Most COBOL programs operate in a domain where the program complexity lies in the business rules that have to be encoded rather than in the sophistication of the data structures or algorithms required. And in cases where sophisticated algorithms are required COBOL usually meets the need with an appropriate verb such as the SORTand the SEARCH. We noted above that COBOL is a simple language with a limited scope of function. 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

COBOL is non-proprietary (portable) The COBOL standard does not belong to any particular vendor. The vendor independent ANSI COBOL committee legislates formal, non-vendor-specific syntax and semantic language standards. COBOL has been ported to virtually every hardware platform - from every favour of Windows, to every falser of Unix, to AS/400, VSE, OS/2, DOS, VMS, Unisys, DG, VM, and MVS. COBOL is Maintainable COBOL has a 30 year proven track record for application maintenance, enhancement and production support at the enterprise level. Early indications from the year 2000 problem are that COBOL applications were actually cheaper to fix than applications written in more recent languages. [ Capers Jones] [Kappleman] One reason for the maintainability of COBOL programs has been given above - the readability of COBOL code. Another reason is COBOL's rigid hierarchical structure. In COBOL programs all external references, such as to devices, files, command sequences, collating sequences, the currency symbol and the decimal point symbol, are defined in the Environment Division. When a COBOL program is moved to a new machine, or has new peripheral devices attached, or is required to work in a different country; COBOL programmers know that the parts of the program that will have to be altered to accommodate these changes will be isolated in the Environment Division. In other programming languages, programmer discipline could have ensured that the references liable to change were restricted to one part of the program but they could just as easily be spread throughout the program. In COBOL programs, programmers have no choice. COBOL's rigid hierarchical structure ensures that these items are restricted to the Environment Division.

disadvantages

are its very tedious and lengthy to code, limited in its ability to do mathematical functions. and a dying obsolescent language.

You might also like