Cevela about COBOL COBOL language - Home - Site Map - About Cevela - MX COBOL    <prev   next>
Classical concepts and MX COBOL
For more - see links to the main provider's on-line documentation.
For MX COBOL see - Formats in detail + Summary comment + FAQ and How to ..

1. Partly fixed program structure and language fundamentals
There are some standard division, section and paragraph headers that must be used in prescribed order when the relevant parts of program are desired. The basic principle valid from COBOL-60 is separation of common program options (Identification division and Environment division), data descriptions (Data division) and procedural statements (Procedure division). This historical concept not only considerably increases simplicity, clarify and maintainbility of programs but also enables to join the most modern qualities to the classical ones. As examples we can give class-id, method-id, function-id etc. from new COBOL-02. For details - see paragraph "Selected COBOL dialects and their providers" in COBOL language link above.

The very majority basic language fundamentals of COBOL-85 dialect are implemented in MX COBOL. The intrinsic functions from COBOL-89 are not implemented but there are called library routines with some of their qualities. Embedded source units from COBOL-85 and OO concept with other news from COBOL-02 are also not implemented in MX COBOL.

Program structure,

2. Data items (structures, records) have to be explicitly described
in sections of the data division. Each data description entry begins with a level-number followed by the programmer's data-name, and a sequence of independent clauses descriptive of the item. Main data categories are numeric ( pic 9 ) and alphanumeric/non-numeric ( pic x ) elementary data items which can create group items in different levels – 1 (or 01) thru 49 and 77 for separate elementary item. Other very important operands are named sets of value = condition names valid from COBOL-74 and wide used in COBOL-02 as Exception condition EC-names.

EC-names are not implemented in MX COBOL.

Data description,

3. Program control flow in style of top-down structured programming
can be realized by means of exceptional statement perform for called (paragraph-name) or embedded (terminated with end-perform) internal subprograms. Statement if and evaluate with logical expressions and conditional names as well as continue and end-delimiters for imperative statements allow create all algorithms as three basic structures - sequence, decision and iteration or as decision-tables-like ones.

The "evaluate" and "continue" statements and end-delimiters except "end-if" and "end-perform" are not implemented in MX COBOL.

Statements, demo-b (calculator),

4. I/O handling via keyboard, screen and command line
Statements accept, display, exhibit and stop „literal“ give the possibility of the on-line interactive dialog with program. This dialog can be programmed not only in line-mode but with screen section declaration in positioned text-mode full-screen according to COBOL-02 too.

In MX COBOL is input from command line realized by means of "embedded C-language" with the "ufd" and "ufo" statements. see more. The possibility to create GUI environment is not implemented.

Statements, demo-a (hello), demo-b (calculator), demo-c (seq-file),

5. Classical Cobol file handling
Organization of files can be sequential (include line sequential for simple text files) or indexed/relative with direct access to record with key-item. Important is the possibility for sorting and merging files.

In MX COBOL there are some limitations for indexed files and there is not functional "use" statement - see more.

Statements - files, Statements - sort file, demo-c (seq-file), demo-d (idx-file),

6. Standard arithmetic
is realized with basic operations (add, subtract, multiply, divide) and universal compute [rounded] statement for arithmetical expressions as desired. From COBOL-89 are mathematical (and other) intrinsic functions at disposal.

There are not intrinsic functions in MX COBOL but as extension there is set of mathematical functions from C-library used as called library routines.

Statements, demo-b (calculator), MX COBOL library routines,

7. Elementary data manipulation and strings-character handling
Besides standard move and initialize statements is possible to string items from different parts, unstring from free format with separators to fix structure, analyse, replace and transform according to any code-table include hexadecimal one.

MX COBOL provides some useful extensions to COBOL-02 (e.g. inspect .. for ending ..) and set of library routines for work with bits, dynamic allocating of memory and others. Statement phrases "set condition-name to true" and "inspect replacing" are not implemented - instead of the last one there is the old "transform" statement.


some examples:
   string X-1 delimited  Y-1 … into Z-1,
   unstring A-1 delimited [all] B-1 or B-2 …
      into C-1 delimiter D-1 count E-1
             …,
   inspect F-1
      tallying G-1 for all/leading/ending [before/after [initial] H-1]
      replacing
         all/leading/ending/first/last I-1 by J-1
         …,
   transform K-1 from „1234567890“ to #f1f2f3f4f5f6f7f8f9f0#.
   

Statements - memory, Statements - strings, demo-a (hello), demo-b (calculator), MX COBOL library routines,

8. Subscripting and table handling
for saving of data fields in memory (Dat-1 occurs Integer-1 [depending Dat-2]) and searching with „search Dat-1“ statement is in COBOL language realized standardly.

The phrase "search all" is not functional in MX COBOL.

Statements,

9. Modular structure of project
is possible to be realized by means of external subprograms using the call/entry and cancel/goback statements. From COBOL-85 is "embedded program structure" possible - that is more subprograms in one source text.

In MX COBOL is embedded structure not implemented.

Statements,

10. Report writer for level-controlled listings
is traditional Cobol-tool included not only in MX COBOL but also in most modern COBOL-02. It contains report section (with “rd” = report group descriptions) + initiate, generate and terminate statements.

Statements,

COBOL language in brief - © Vlastimil Cevela 2006

Date 2006-06-04 - Text Builder 0.65 - Time 14:05:07