This preview shows page 1. Sign up to view the full content.
Unformatted text preview: evolve even today. COBOL 2002, the new
COBOL standard, has the following new features:
1. Free format, which allows statements to be positioned anywhere on the line.
The older versions of COBOL had the concept of A and B margins. The A margin
started at column 8 and was used to start a new division, section, or paragraph.
The B margin started at column 12 and was used to start any sentence. Compiler
directives allow the programmer to switch between fixed format (of older
versions) and free format (of new version) in a single program.
2. Inline comments, which allows comments to be positioned anywhere on a line
after the two consecutive characters. In older versions of COBOL, comment
statements had to be on a separate line with an asterisk (*) in column 7.
3. Common exception handling, which specifies predefined exceptions that will
be raised when a runtime exception occurs. The older versions of COBOL did not
prescribe the resultant action for runtime errors such as, subscripting with a value
larger than the size of a table.
4. Several new data types, which allow more flexible programming. Some of
these are boolean, national, and pointer. A boolean data item can have a value of
either 0 or 1. A national data type allows the use of extended character sets, such
as Unicode or Kanji, for foreign language support. A pointer data item can be used
to point to other data items.
5. Conditional compilation of certain code segments, which allows programmers
to tailor programs for different environments.
For example, Figure 12.17
illustrates how the >> define and evaluate compiler directives can be used to tailor
a program based on the value of operating system, which is obtained from the
Automatic data validation, which allows the programmer to specify
constraints with the data description so that the value of input data gets
automatically validated. Figure 12.18 illustrates how constraints can be specified
with a data description.
7. Call statement enhanc...
View Full Document
This document was uploaded on 04/07/2014.
- Spring '14