HP 3000 Manuals

ANSI85 Features [ HP COBOL II/XL Programmer's Guide ] MPE/iX 5.0 Documentation


HP COBOL II/XL Programmer's Guide

ANSI85 Features 

ANSI85 features are those that ANSI74 does not have.  If you use them in
your program, you must invoke the COBOL compiler through its ANSI85 entry
point.

The ANSI85 features are listed below, by division.  Those marked with an
asterisk (*) support structured programming, and are explained in Chapter
3 .  The others are explained in this chapter, by division.

Division                              ANSI85 Feature 

Not part of a division                  *  END PROGRAM header

IDENTIFICATION DIVISION                    INITIAL clause

                                      *  COMMON clause

ENVIRONMENT DIVISION                       CLASS clause

                                         SYMBOLIC CHARACTERS clause

DATA DIVISION                              EXTERNAL data items and files

                                         FILLER is now optional
                                      *  GLOBAL data items and files
                                         USAGE data item formats

PROCEDURE DIVISION                         ADD statement enhancement

                                         ALPHABETIC-LOWER
                                         ALPHABETIC-UPPER
                                         CALL BY CONTENT
                                      *  CONTINUE statement
                                         De-editing
                                      *  EVALUATE statement
                                      *  Explicit scope terminators
                                         INITIALIZE statement
                                         INSPECT CONVERTING statement
                                      *  NOT phrases
                                      *  PERFORM statement enhancements
                                         Reference modification
                                         Relational operators
                                         REPLACE statement
                                         Setting switches
                                         Setting condition names
                                         Table Initialization
                                      *  USE GLOBAL AFTER ERROR
                                         PROCEDURE ON statement

The END PROGRAM header is not considered to be part of any division.  It
supports nested and concatenated programs and is explained in Chapter 3
.

ANSI85 Features in the IDENTIFICATION DIVISION: 

This section explains the INITIAL clause, one ANSI85 feature of the
IDENTIFICATION DIVISION. The other ANSI85 feature of the IDENTIFICATION
DIVISION, the COMMON clause, supports structured programming, and is
explained in Chapter 3 .

The INITIAL Clause 

The INITIAL clause is in the PROGRAM-ID paragraph of the IDENTIFICATION
DIVISION. It specifies that the program is in an initial state whenever
it is called, not only when it is canceled.  In an initial state, data is
initialized to the values specified in VALUE clauses.

If a program that specifies the INITIAL clause contains other programs
(directly or indirectly), the INITIAL clause applies to those programs
also.

The INITIAL clause has the same effect as the DYNAMIC control option.

Example.   

     PROGRAM-ID.  SUB-PROG INITIAL.
             :
     DATA DIVISION.
     WORKING-STORAGE SECTION.
     01   A-COUNT         PIC 9(8) COMP-3  VALUE ZEROS.
     01   B-COUNT         PIC 9(8) COMP-3  VALUE ZEROS
     01   CONV-FIELD.
          05  YY   PIC XX.
          05  MM   PIC XX.
          05  DD   PIC XX.
              :

The fields A-COUNT and B-COUNT are initialized to zeros each time this
subprogram is called, but the initial value of CONV-FIELD is undefined.

The COMMON Clause 

The other ANSI85 feature in the IDENTIFICATION DIVISION is the COMMON
clause.  The COMMON clause supports structured programming and is
explained in Chapter 3 .



MPE/iX 5.0 Documentation