107
ISO/IEC CD 1.1 1989 : yyyy(E) i Contents Contents Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii 1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 Normative references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3 Conformance to this draft International Standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.1 A conforming implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.1.1 Acceptance of standard language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.1.2 Interaction with non-COBOL programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.1.3 Interaction between COBOL implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.1.4 Implementor-defined language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3.1.5 Processor-dependent language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.1.6 Reserved words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.1.7 Standard extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.1.8 Nonstandard extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.1.9 Substitute or additional language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.1.10 Archaic language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.1.11 Obsolete language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.1.12 Externally provided functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.1.13 Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.1.14 User documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.1.15 Character substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.2 A conforming compilation group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.3 Relationship of a conforming compilation group to a conforming implementation . . . . . . . . . . . . . . . . . . . 6 4 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 5 Description techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.1 General formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.1.1 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.1.2 Optional words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.1.3 Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.1.4 Level numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.1.5 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.1.5.1 Brackets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.1.5.2 Braces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.1.5.3 Choice indicators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.1.6 Ellipses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

i Contents

Contents

Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i

Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii

1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Normative references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

3 Conformance to this draft International Standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.1 A conforming implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.1.1 Acceptance of standard language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.1.2 Interaction with non-COBOL programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.1.3 Interaction between COBOL implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.1.4 Implementor-defined language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.1.5 Processor-dependent language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3.1.6 Reserved words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3.1.7 Standard extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3.1.8 Nonstandard extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3.1.9 Substitute or additional language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3.1.10 Archaic language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3.1.11 Obsolete language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3.1.12 Externally provided functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.1.13 Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.1.14 User documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.1.15 Character substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.2 A conforming compilation group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3.3 Relationship of a conforming compilation group to a conforming implementation . . . . . . . . . . . . . . . . . . . 6

4 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

5 Description techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

5.1 General formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

5.1.1 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

5.1.2 Optional words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

5.1.3 Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

5.1.4 Level numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.1.5 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.1.5.1 Brackets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.1.5.2 Braces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.1.5.3 Choice indicators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.1.6 Ellipses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

Page 2: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

Contents ii

5.1.7 Punctuation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.1.8 Special characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.1.9 Meta-terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

5.2 Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.2.1 Syntax rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.2.2 General rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.2.3 Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.2.4 Returned values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.3 Arithmetic expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.3.1 Double subscripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.3.2 Ellipses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.3.3 Parentheses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.4 Natural language text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.5 Hyphens in text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

6 Reference format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

6.1 Fixed-form reference format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

6.2 Free-form reference format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

6.3 Logical conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

7 Compiler directing facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

7.1 Source text manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

7.1.1 Source text manipulation elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

7.1.2 COPY statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

7.1.3 REPLACE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

7.2 Compiler directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

7.2.4 Conditional compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

7.2.5 Constant conditional expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

7.2.6 CONSTANT directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

7.2.7 EVALUATE directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

7.2.8 EXTENDED-LETTERS directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

7.2.9 FLAG-85 directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

7.2.10 IF directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

7.2.11 LISTING directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

7.2.12 PAGE directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

7.2.13 PROPAGATE directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

7.2.14 REPOSITORY directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

7.2.15 SOURCE FORMAT directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

7.2.16 TURN directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

8 Language fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

8.1 Character sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

8.1.1 Computer's character set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

8.1.2 COBOL character set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

8.1.3 Alphabets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

8.2 Locales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

Page 3: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

iii Contents

8.3 Lexical elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

8.3.1 Character-strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

8.3.1.1 COBOL words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

8.3.1.2 Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

8.3.1.3 Special registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

8.3.1.3.1 LINAGE-COUNTER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

8.3.1.3.2 PAGE-COUNTER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

8.3.1.3.3 LINE-COUNTER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

8.3.1.4 PICTURE character-strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

8.3.2 Punctuation characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

8.3.3 Separators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

8.4 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

8.4.1 Condition-name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

8.4.2 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

8.4.2.1 Identifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

8.4.2.2 Function-identifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

8.4.2.3 Reference-modifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

8.4.2.4 Subscripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

8.4.2.5 In-line method invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

8.4.2.6 Object-modifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

8.4.2.7 EXCEPTION-OBJECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

8.4.2.8 NULL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

8.4.2.9 SELF and SUPER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

8.4.2.10 Object property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

8.4.2.11 Type-modifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

8.4.2.12 Predefined-address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

8.4.2.13 Data-address-identifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

8.4.2.14 Program-address-identifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

8.4.3 External switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

8.4.4 Uniqueness of reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

8.4.5 Explicit and implicit references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

8.4.6 Scope of names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

8.4.6.1 Conventions for program-names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

8.4.6.2 Conventions for condition-names, data-names, file-names, record-names, report-names, screen-names, and

type-names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

8.4.6.3 Conventions for index-names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

8.4.6.4 Conventions for class-names and interface-names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

8.4.6.5 Conventions for method-names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

8.4.6.6 Conventions for function-prototype-names and program-prototype-names . . . . . . . . . . . . . . . . . . . 101

8.4.6.7 Conventions for constant-names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

8.5 Class and category of data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

8.6 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

8.6.1 Weakly typed items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

8.6.2 Strongly typed items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

8.7 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

8.7.1 Arithmetic operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

Page 4: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

Contents iv

8.7.2 Boolean operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

8.7.3 Concatenation operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

8.7.4 Invocation operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

8.7.5 Relational operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

8.8 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

8.8.1 Arithmetic expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

8.8.2 Boolean expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

8.8.3 Concatenation expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

8.8.4 Conditional expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

8.9 Reserved words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

8.10 Context-sensitive words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

8.11 Intrinsic function names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

9 Input/output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

9.1 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

9.1.1 File attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

9.1.2 IOCS and MSCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

9.1.3 Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

9.1.3.1 Sequential . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

9.1.3.2 Relative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

9.1.3.3 Indexed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

9.1.4 Access modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

9.1.4.1 Sequential access mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

9.1.4.2 Random access mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

9.1.4.3 Dynamic access mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

9.1.5 Reel and unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

9.1.6 Current volume pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

9.1.7 File position indicator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

9.1.8 I-O status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

9.1.9 Invalid key condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

9.1.10 At end condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

9.1.11 RETRY phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

9.1.12 Sharing mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

9.1.13 Sort file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

9.1.14 Merge file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

9.1.15 Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

9.2 Screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

9.2.1 Terminal screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

9.2.2 Function keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

9.2.3 CRT status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

9.2.4 Cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

9.2.5 Cursor locator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

9.2.6 Current screen item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

9.2.7 Color number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

10 Compilation group structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

Page 5: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

v Contents

10.1 Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

10.1.1 COBOL compilation group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

10.2 End markers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

10.3 External repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

10.4 Program organization and communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

10.4.1 Objects and classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

10.4.2 Object references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

10.4.3 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

10.4.4 File connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

10.4.5 Global names and local names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

10.4.6 External and internal items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

10.4.7 Automatic, initial, and static items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

10.4.8 Common, initial, and recursive programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

10.4.9 Sharing data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

10.4.10 Sharing file connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

10.4.11 Method invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

10.4.12 Method results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

10.4.13 Function results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

10.4.14 Program results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

10.4.15 Conformance and interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

10.4.16 Polymorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

10.4.17 Class inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

10.4.18 Interface inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

10.4.19 Parameterized classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

10.4.20 Parameterized interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

10.5 Object life cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

10.5.1 Life cycle for factory objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

10.5.2 Life cycle for objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

10.5.3 Life cycle for parameterized classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

10.5.4 Life cycle of parameterized interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

11 Identification division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

11.1.1 Program definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

11.1.2 Program prototype definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

11.1.3 Class definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

11.1.4 Factory definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

11.1.5 Object definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

11.1.6 Method definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

11.1.7 Interface definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

11.1.8 Function definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

11.1.9 Function protoype definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

11.2 PROGRAM-ID paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

11.3 CLASS-ID paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

11.4 FACTORY paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

11.5 OBJECT paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

11.6 METHOD-ID paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

Page 6: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

Contents vi

11.7 INTERFACE-ID paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

11.8 FUNCTION-ID paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

11.9 OPTIONS paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

11.9.3 General Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

11.9.4 ARITHMETIC clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

11.9.5 CALL-CONVENTION clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

11.9.6 LOCALIZE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

12 Environment division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

12.2 Configuration section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

12.2.4 SOURCE-COMPUTER paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

12.2.5 OBJECT-COMPUTER paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

12.2.6 SPECIAL-NAMES paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

12.2.7 REPOSITORY paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

12.3 Input-output section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

12.3.3 FILE-CONTROL paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

12.3.4 File control entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

12.3.4.4 ACCESS MODE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

12.3.4.5 ALTERNATE RECORD KEY clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

12.3.4.6 COLLATING SEQUENCE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

12.3.4.7 FILE STATUS clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204

12.3.4.8 LOCK MODE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205

12.3.4.9 ORGANIZATION clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206

12.3.4.10 PADDING CHARACTER clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

12.3.4.11 RECORD DELIMITER clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208

12.3.4.12 RECORD KEY clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

12.3.4.13 RELATIVE KEY clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

12.3.4.14 RESERVE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

12.3.4.15 SHARING clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212

12.3.5 I-O-CONTROL paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

12.3.6 SAME clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

13 Data division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215

13.2 Computer-independent data description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215

13.2.1 Physical aspects of a file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216

13.2.2 Characteristics of a file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216

13.2.3 Record concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216

13.2.4 Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216

13.2.5 Selection of character representation and radix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217

13.2.6 Limitations of character handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

13.2.7 Algebraic signs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

13.2.8 Standard alignment rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218

13.2.9 Item alignment for increased object-code efficiency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

13.3 Explicit and implicit attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

13.4 File section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220

13.4.3 General Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220

Page 7: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

vii Contents

13.4.4 File description entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221

13.4.5 Sort-merge file description entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

13.5 Working-storage section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225

13.6 Local-storage section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

13.6.1 General format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

13.7 Linkage section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

13.8 Report section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228

13.8.3 Report group description entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228

13.9 Screen section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

13.10 Constant entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230

13.11 Record description entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231

13.12 77-level data description entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232

13.13 Report description entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

13.13.4 Report writer special registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

13.14 Report group description entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

13.15 Data description entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

13.16 Screen description entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

13.17 Data division clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246

13.17.1 ALLOW clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246

13.17.2 AUTO clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

13.17.3 BACKGROUND-COLOR clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248

13.17.4 BELL clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249

13.17.5 BLANK clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

13.17.6 BLANK WHEN ZERO clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

13.17.7 BLINK clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

13.17.8 BLOCK CONTAINS clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253

13.17.9 CLASS clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254

13.17.10 CODE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255

13.17.11 CODE-SET clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256

13.17.12 COLUMN clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258

13.17.13 CONTROL clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262

13.17.14 Data-name, screen-name, or FILLER clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264

13.17.15 DEFAULT clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265

13.17.16 DESTINATION clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266

13.17.17 ERASE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

13.17.18 ERROR clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268

13.17.19 EXTERNAL clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

13.17.20 FOREGROUND-COLOR clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271

13.17.21 FORMAT clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

13.17.22 FROM clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275

13.17.23 FULL clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276

13.17.24 GLOBAL clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277

13.17.25 GROUP INDICATE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278

13.17.26 HIGHLIGHT clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279

13.17.27 INVALID clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280

13.17.28 JUSTIFIED clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281

Page 8: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

Contents viii

13.17.29 Level-number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282

13.17.30 LINAGE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

13.17.31 LINE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286

13.17.32 LOWLIGHT clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

13.17.33 NEXT GROUP clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

13.17.34 OCCURS clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294

13.17.35 PAGE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300

13.17.36 PICTURE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

13.17.37 PRESENT WHEN clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314

13.17.38 PROPERTY clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316

13.17.39 RECORD clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319

13.17.40 REDEFINES clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322

13.17.41 RENAMES clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324

13.17.42 REPORT clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

13.17.43 REQUIRED clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

13.17.44 REVERSE-VIDEO clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

13.17.45 SAME AS clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328

13.17.46 SECURE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

13.17.47 SELECT WHEN clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

13.17.48 SIGN clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331

13.17.49 SOURCE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333

13.17.50 SUM clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334

13.17.51 SYNCHRONIZED clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337

13.17.52 TO clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339

13.17.53 TYPE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340

13.17.54 TYPEDEF clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344

13.17.55 UNDERLINE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

13.17.56 USAGE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346

13.17.57 USING clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351

13.17.58 VALUE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352

13.17.59 VARYING clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357

13.17.60 WITH POINTER clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358

14 Procedure division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359

14.4 Declaratives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

14.5 Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

14.5.1 Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

14.5.2 Paragraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

14.6 Statements and sentences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363

14.6.1 Conditional statements and sentences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363

14.6.2 Declarative statements and declarative sentences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363

14.6.3 Imperative statements and imperative sentences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364

14.6.4 Delimited scope statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364

14.6.5 Explicit and implicit scope terminators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365

14.7 Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365

14.7.1 State of a function, method, object, or program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365

Page 9: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

ix Contents

14.7.2 Explicit and implicit transfers of control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367

14.7.3 Item identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368

14.7.4 Locale identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368

14.7.5 Sending and Receiving operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369

14.7.6 Run unit termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369

14.7.7 Overlapping operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369

14.7.8 Multiple results in arithmetic statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369

14.7.9 Condition handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370

14.8 Common phrases and features for statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376

14.8.1 ROUNDED phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376

14.8.2 ON SIZE ERROR phrase and size error condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376

14.8.3 CORRESPONDING phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378

14.8.4 Arithmetic statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378

14.9 Conformance for parameters and returning items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378

14.9.1 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378

14.9.2 Returning items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380

14.10 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382

14.10.1 ACCEPT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382

14.10.2 ADD statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387

14.10.3 ALLOCATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389

14.10.4 CALL statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390

14.10.4.2 Syntax rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391

14.10.5 CANCEL statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395

14.10.6 CLOSE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397

14.10.7 COMPUTE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400

14.10.8 CONTINUE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401

14.10.9 DELETE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402

14.10.10 DISPLAY statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404

14.10.11 DIVIDE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407

14.10.12 EVALUATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410

14.10.13 EXIT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414

14.10.14 FREE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417

14.10.15 GENERATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418

14.10.16 GO TO statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420

14.10.17 GOBACK statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421

14.10.18 IF statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422

14.10.19 INITIALIZE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424

14.10.20 INITIATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427

14.10.21 INSPECT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428

14.10.22 INVOKE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434

14.10.23 MERGE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437

14.10.24 MOVE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442

14.10.25 MULTIPLY statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446

14.10.26 OPEN statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448

14.10.27 PERFORM statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453

14.10.28 RAISE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458

Page 10: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

Contents x

14.10.29 READ statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459

14.10.30 RELEASE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466

14.10.31 RESUME statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467

14.10.32 RETURN statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468

14.10.33 REWRITE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470

14.10.34 SEARCH statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474

14.10.35 SET statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478

14.10.36 SORT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487

14.10.37 START statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494

14.10.38 STOP statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497

14.10.39 STRING statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498

14.10.40 SUBTRACT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501

14.10.41 SUPPRESS statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503

14.10.42 TERMINATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504

14.10.43 UNLOCK statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505

14.10.44 UNSTRING statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506

14.10.45 USE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510

14.10.46 VALIDATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514

14.10.47 WRITE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517

15 Intrinsic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524

15.1 Types of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524

15.2 Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524

15.3 Returned values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525

15.4 Date conversion functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526

15.5 Summary of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526

15.6 ABS function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532

15.7 ACOS function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533

15.8 ALLOCATED-OCCURRENCES function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534

15.9 ANNUITY function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535

15.10 ASIN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536

15.11 ATAN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537

15.12 BOOLEAN-OF-INTEGER function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538

15.13 CHAR function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539

15.14 CHAR-NATIONAL function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540

15.15 COS function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541

15.16 CURRENT-DATE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542

15.17 DATE-OF-INTEGER function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543

15.18 DATE-TO-YYYYMMDD function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544

15.19 DAY-OF-INTEGER function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545

15.20 DAY-TO-YYYYDDD function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546

15.21 DISPLAY-OF function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547

15.22 E function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548

15.23 EXCEPTION-FILE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549

15.24 EXCEPTION-LOCATION function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550

15.25 EXCEPTION-STATEMENT function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551

Page 11: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

xi Contents

15.26 EXCEPTION-STATUS function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552

15.27 EXP function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553

15.28 EXP10 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554

15.29 FACTORIAL function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555

15.30 FRACTION-PART function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556

15.31 HIGHEST-ALGEBRAIC function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557

15.32 INTEGER function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558

15.33 INTEGER-OF-BOOLEAN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559

15.34 INTEGER-OF-DATE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560

15.35 INTEGER-OF-DAY function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561

15.36 INTEGER-PART function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562

15.37 LENGTH function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563

15.38 LENGTH-AN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564

15.39 LOCALE-COMPARE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565

15.40 LOCALE-DATE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566

15.41 LOCALE-TIME function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567

15.42 LOG function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568

15.43 LOG10 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569

15.44 LOWER-CASE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570

15.45 LOWEST-ALGEBRAIC function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571

15.46 MAX function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572

15.47 MEAN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573

15.48 MEDIAN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574

15.49 MIDRANGE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575

15.50 MIN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576

15.51 MOD function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577

15.52 NATIONAL-OF function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578

15.53 NUMVAL function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579

15.54 NUMVAL-C function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580

15.55 NUMVAL-F function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581

15.56 ORD function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582

15.57 ORD-MAX function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583

15.58 ORD-MIN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584

15.59 PI function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585

15.60 PRESENT-VALUE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586

15.61 RANDOM function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587

15.62 RANGE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588

15.63 REM function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589

15.64 REVERSE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590

15.65 SIGN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591

15.66 SIN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592

15.67 SQRT function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593

15.68 STANDARD-COMPARE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594

15.69 STANDARD-DEVIATION function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595

15.70 SUM function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596

15.71 TAN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597

Page 12: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

Contents xii

15.72 TEST-DATE-YYYYMMDD function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598

15.73 TEST-DAY-YYYYDDD function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599

15.74 TEST-NUMVAL function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600

15.75 TEST-NUMVAL-C function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601

15.76 TEST-NUMVAL-F function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602

15.77 UPPER-CASE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603

15.78 VARIANCE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604

15.79 WHEN-COMPILED function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605

15.80 YEAR-TO-YYYY function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606

16 Standard classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608

16.1 BASE class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608

16.1.1 New method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608

16.1.2 FactoryObject method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608

16.1.3 NULL class and NULL object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609

A Communications facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610

A.1 Data division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610

A.2 Procedure division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622

A.2.2 DISABLE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623

A.2.3 ENABLE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624

A.2.4 PURGE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625

A.2.5 RECEIVE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626

A.2.6 SEND statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628

B Language element lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632

B.1 Implementor-defined language element list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632

B.2 Undefined language element list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643

B.3 Processor-dependent language element list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 648

C Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650

C.1 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 650

C.2 Table handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657

C.3 Shared memory area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 664

C.4 Compilation group and run unit organization and communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665

C.5 Communication facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673

C.6 Intrinsic function facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680

C.7 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681

C.8 Source text manipulation facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682

C.9 Bit/boolean support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683

C.10 National character handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685

C.11 Dynamic collating sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687

C.12 Internationalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688

C.13 Exception processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690

C.14 Standard arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692

C.15 Object oriented concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698

Page 13: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

xiii Contents

C.16 Report writer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711

C.17 Validate facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717

C.18 Conditional compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721

C.19 Example of order of evaluation of conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722

C.20 Examples of the execution of the INSPECT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726

C.21 Examples of the execution of the PERFORM statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729

C.22 Example of free-form reference format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733

D Substantive changes list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734

D.1 Substantive changes potentially affecting existing programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734

D.2 Substantive changes not affecting existing programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743

E Archaic and obsolete language element lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752

E.1 Archaic language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752

E.2 Obsolete language elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753

F Known errors in the standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754

G Composite language skeleton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 825

Page 14: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

Tables xiv

Tables

1 COBOL character set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

2 Category and class relationships for elementary items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

3 Combinations of symbols in arithemetic expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

4 Combination of symbols in boolean expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

5 Combinations of conditions, logical operators, and parentheses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

6 Category and type of editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308

7 Results of fixed insertion editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

8 Results of floating insertion editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310

9 PICTURE symbol order of precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312

10 Locale picture precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313

11 Exception-names and exception conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373

12 Relationship of categories of files and the format of the CLOSE statement . . . . . . . . . . . . . . . . . . . . . . 397

13 Combination of operands in EVALUATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411

14 Category of figurative constants used in the MOVE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443

15 Validity of types of MOVE statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445

16 Opening available and unavailable files (file not currently open) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449

17 Opening available shared files that are currently open by another file connector . . . . . . . . . . . . . . . . . . . 449

18 Permissable statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450

19 Validity of operand combinations on format 1 SET statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483

20 Table of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527

A.1 Communication status key conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620

A.2 Error key values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621

A.3 Indicators and identifier-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630

Page 15: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

xv Figures

Figures

1 Fixed-form source reference format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

2 Vertical regions of a page and types of report groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301

C.1 Format 1 SEARCH statement having two WHEN phrases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661

C.2 COBOL communication environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675

C.3 Hierarchy of queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678

C.4 Manager class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703

C.5 Banking hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704

C.6 Evaluation of the hierarchal level condition-1 AND condition-2 AND ... condition-n . . . . . . . . . . . . . . . . 722

C.7 Evaluation of the hierarchal level condition-1 OR condition-2 OR ... condition-n . . . . . . . . . . . . . . . . . . 723

C.8 Evaluation of condition-1 OR condition-2 AND condition-3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724

C.9 Evaluation of (condition-1 OR NOT condition-2) AND condition-3 AND condition-4 . . . . . . . . . . . . . . . . 725

C.10 The VARYING option of a PERFORM statement with the TEST BEFORE phrase having one condition . . 729

C.11 The VARYING option of a PERFORM statement with the TEST BEFORE phrase having two conditions . 730

C.12 The VARYING option of a PERFORM statement with the TEST AFTER phrase having one condition . . . 731

C.13 The VARYING option of a PERFORM statement with the TEST AFTER phrase having two conditions . . 732

Page 16: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

Foreword xvi

Foreword

ISO (International Organization for Standardization) and IEC (International Electrotechnical Commission) form thespecialized system for worldwide standardization. National bodies that are members of ISO or IEC participate in thedevelopment of International Standards through technical committees established by the respective organization todeal with particular fields of technical activity. ISO and IEC technical committees collaborate in fields of mutualinterest. Other international organizations, governmental and non-governmental, in liaison with ISO and IEC, alsotake part in the work.

In the field of information technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1. DraftInternational Standards adopted by the joint technical committee are circulated to national bodies for voting.Publication as an International Standard requires approval by at least 75% of the national bodies casting a vote.

This draft International Standard was prepared by Joint Technical Committee ISO/IEC JTC 1, InformationTechnology, Sub-committee SC 22, Programming languages, their environments and system software interfaces.

This draft International Standard replaces ISO 1989:1985 and its amendments, ISO 1989:1985/Amd.1:1992 andISO 1989:1985/Amd.2:1994. This edition introduces the following significant technical enhancements:

— features for object-oriented programming

— additional features for detection and reporting of exceptions

— a boolean data type for bit handling and boolean operations

— native binary and floating-point data types

— a national character data type for processing multiple-octet coded character sets

— internationalization: i.e. features for accommodation of local cultural conventions

— increased portability of arithmetic

— free-form source text

— compiler directives for portable specification of processing options

— conditional compilation

— automatically-expanded tables

— an enhanced report writer

— features for data validation

— an enhanced CALL statement

— user-defined functions

— a screen handling facility

— file sharing and record locking

— support for ISO/IEC 10646-1 for data interchange

Annexes A and B form an integral part of this draft International Standard. Annexes C and D are for information only.Annex E provides a complete list of technical changes. Annexes F and G are for information only.

Page 17: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

xvii Introduction

Introduction

COBOL began as a business programming language, but its present use has spread well beyond that to a general-purpose programming language. COBOL is well known for its file handling capabilities, which are extended in thisrevision by the addition of file sharing and record locking capabilities. Other major enhancements add object-orientedcapabilities, handling of national characters, and enhanced interoperability with other programming languages.Annex C, Concepts, includes an explanation of the major new features and is the suggested starting point for thereading of this document.

The previous revision of the COBOL standard was published in 1985 and extended by an amendment that added theIntrinsic Functions module in 1989. Implementors have provided language extensions in response to the demandsof their users. Several changes and extensions have, therefore, been made to this revision in order to prevent furtherdivergence, and to ensure consistency and coherence.

During the development of this revision, great care was taken to minimize changes that would impact existingprograms. Most substantive changes that may impact existing programs were introduced to resolve ambiguities inthe previous revision. Details of the substantive changes are given in Annex D, Substantive changes list.

Development of the COBOL language began in 1959, which was before the invention of formal techniques forspecification of programming languages. Hence, the COBOL standard uses its own description techniques, whichare described in 5, Description techniques. These techniques involve general formats, which describe the syntax,and natural language.

This revision is a result of the standardization efforts of working group ISO/IEC JTC 1/SC22/WG4 and technicalcommittee J4, a subgroup of Accredited Standards Committee NCITS.

Acknowledgment

Any organization interested in reproducing the COBOL standard and specifications in whole or in part, using ideasfrom this document as the basis for an instruction manual or for any other purpose, is free to do so. However, allsuch organizations are requested to reproduce the following acknowledgment paragraphs in their entirety as part ofthe preface to any such publication:

COBOL is an industry language and is not the property of any company or group of companies, or of anyorganization or group of organizations.

No warranty, expressed or implied, is made by any contributor or by the CODASYL COBOL Committee as to theaccuracy and functioning of the programming system and language. Moreover, no responsibility is assumed byany contributor, or by the committee, in connection therewith.

The authors and copyright holders of the copyrighted materials used herein

FLOW-MATIC (trademark of Sperry Rand Corporation), Programming for the UNIVAC (R) I and II, DataAutomation Systems copyrighted 1958, 1959, by Sperry Rand Corporation; IBM Commercial TranslatorForm No. F28-8013, copyrighted 1959 by IBM; FACT, DSI 27A5260-2760, copyrighted 1960 byMinneapolis-Honeywell

have specifically authorized the use of this material, in whole or in part, in the COBOL specifications. Suchauthorization extends to the reproduction and use of COBOL specifications in programming manuals or similarpublications.

Any organization using a short passage from this document, such as in a book review, is requested to mention"COBOL" in acknowledgment of the source.

Page 18: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)

1: Scope 1

Information technology — Programming languages,their environments and system software interfaces

Programming language COBOL

1 Scope

This draft International Standard specifies the syntax and meaning of programs written in COBOL. Its purpose is topromote a high degree of machine independence in COBOL programs to permit their use on a variety of dataprocessing systems.

This draft International Standard specifies:

— The form of a program written in COBOL.

— The effect of compiling and executing such a program.

— The manner in which programs may be combined to form run-units.

— The elements of the language for which a conforming implementation is required to supply a definition.

— The elements of the language for which meaning is explicitly undefined.

— The elements of the language that are dependent on the capabilities of the processor.

This draft International Standard does not specify:

— The means whereby a program written in COBOL is compiled into code executable by a processor.

— The form or content of error or warning messages.

Page 19: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Normative references

2 2: Normative references

2 Normative references

The following standards contain provisions which, through reference in this text, constitute provisions of this draftInternational Standard. At the time of publication, the editions indicated were valid. All standards are subject torevision, and parties to agreements based on this draft International Standard are encouraged to investigate thepossibility of applying the most recent editions of the standards indicated below. Members of IEC and ISO maintainregisters of currently valid International Standards.

ISO/IEC 646:1991, Information technology — ISO 7-bit coded character set for information interchange.

ISO 1001:1986, Information processing — File structure and labelling of magnetic tapes for information interchange.

ISO 8601:1988, Data elements and interchange formats - Information interchange — Representation of dates andtimes.

ISO/IEC 9945-2:1993, Information technology — Portable Operating System Interface (POSIX) — Part 2: Shell andUtilities.

ISO/IEC 10646-1:1993, Information technology — Universal Multiple-Octet Coded Character Set (UCS) - Part 1:Architecture and Basic Multilingual Plane.

ISO/IEC 10646-1:1993/Amd.1:1996, Information technology — Universal Multiple-Octet Coded Character Set(UCS) — Part 1: Architecture and Basic Multilingual Plane, AMENDMENT 1: Transformation Format for 16 planesof group 00 (UTF-16).

ISO/IEC 10646-1:1993/Amd.2:1996, Information technology — Universal Multiple-Octet Coded Character Set(UCS) - Part 1: Architecture and Basic Multilingual Plane, AMENDMENT 2: UCS Transformation Format 8 (UTF-8).

ISO/IEC CD 14651, International String Ordering — Method for Comparing Character Strings and Description of aDefault Tailorable Ordering.

Page 20: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Conformance to this draft International Standard

3: Conformance 3

3 Conformance to this draft International Standard

3.1 A conforming implementation

To conform to this draft International Standard, an implementation of standard COBOL shall provide the normativeelements specified in clauses 6 through 16 and meet the criteria of 3.1.1 through 3.1.15.

An implementation may optionally provide the elements specified in Annex A, Communications facility.

3.1.1 Acceptance of standard language elements

An implementation shall accept the syntax and provide the functionality for all standard COBOL language elementsof a facility that is claimed as being included in the implementation, except for

— implementor-defined language elements not required to be specified, as indicated in B.1,Implementor-defined language element list, and

— language elements dependent on specific processor components, as indicated in B.3, Processor-dependentlanguage element list.

An implementation shall provide a warning mechanism that optionally can be invoked by the user at compile time toindicate violations of the general formats and the explicit syntax rules of standard COBOL. There are rules in standardCOBOL that are not identified as general formats or syntax rules, but nevertheless specify elements that aresyntactically distinguishable. This warning mechanism should indicate violations of such rules. It is left to theimplementor's judgement to determine what is syntactically distinguishable.

There are general rules in standard COBOL that could have been classified as syntax rules. These rules are classifiedas general rules for the purpose of avoiding syntax checking, and do not reflect errors in standard COBOL. Animplementation may, but is not required to, flag violations of such rules.

3.1.2 Interaction with non-COBOL programs

Facilities are provided in this specification that enable calling and sharing of external items between COBOL sourceunits and non-COBOL programs. No requirements is placed on an implementation to support this interaction. Whensupported, an implementor shall document the languages and the implementations supported.

3.1.3 Interaction between COBOL implementations

Facilities are provided in this specification that enhance the capability of calling and sharing external items betweenCOBOL source units translated on COBOL implementations produced by different implementors. No requirement isplaced on an implementation to support this interaction. When supported, an implementor shall document theimplementations supported.

3.1.4 Implementor-defined language elements

Language elements that depend on implementor definition to complete the specification of the syntax or general rulesfor the elements are listed in B.1, Implementor-defined language element list. To meet the requirements of standardCOBOL, the implementor shall specify, at a minimum, the implementor-defined language elements that are identifiedas required. Each implementor-defined language element specified by the implementor shall be documented if theimplementor-defined language element is identified as requiring user documentation. When support is claimed for aspecific implementor-defined language element, all language elements that pertain to that implementor-definedlanguage element shall be implemented.

While the implementor specifies the constraints on that portion of each element's syntax or rules that is indicated tobe implementor defined, such constraints shall not include requirements for the inclusion in the compilation group ofsubstitute or additional language elements.

Page 21: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Processor-dependent language elements

4 3: Conformance

3.1.5 Processor-dependent language elements

Processor refers to the entire computing system that is used to translate and execute source units, consisting of bothhardware and relevant associated software. Language elements that pertain to specific processor components arelisted in B.3, Processor-dependent language element list. To meet the requirements of standard COBOL, theimplementor shall document the associated processor components for which the implementation claims support.When support is claimed for a specific component, all language elements that pertain to that component shall beimplemented. The absence of processor-dependent elements from an implementation shall be specified in theimplementor's user documentation.

3.1.6 Reserved words

An implementation shall recognize as reserved words all the COBOL reserved words specified in 8.9, Reserved words,and shall recognize in context all the context-sensitive words specified in 8.10, Context-sensitive words.

3.1.7 Standard extensions

A standard extension is supported syntax for a facility defined in standard COBOL where support for that entirefacility is not claimed. When an implementation supports standard extensions, the implementation shall provide thefunctionality specified in standard COBOL for that syntax or shall identify those language elements as nonstandardextensions.

3.1.8 Nonstandard extensions

An implementation may include language elements or functionality not defined in standard COBOL. Thatimplementation meets the requirements of standard COBOL even though additional reserved words may beintroduced by the implementor, thereby preventing translation of some compilation groups that meet therequirements of standard COBOL.

Documentation associated with an implementation shall identify nonstandard extensions for which support is claimedand shall specify any reserved words added for nonstandard extensions.

An implementation shall provide a warning mechanism that optionally can be invoked by the user at compile time toindicate each use of a nonstandard extension in a compilation group. This warning mechanism is required to flagonly extensions that are syntactically distinguishable.

3.1.9 Substitute or additional language elements

An implementation shall not require the inclusion of substitute or additional language elements in the compilationgroup in order to accomplish functionality identical to that of a standard COBOL language element.

3.1.10 Archaic language elements

Archaic language elements are those identified in E.1, Archaic language elements. Archaic language elements shouldnot be used in new compilation groups because better programming practices exist. Because of widespread use inexisting programs, there is no schedule for deleting archaic elements from standard COBOL; however, this may bereevaluated for any future revisions of standard COBOL.

An implementation is required to support archaic language elements of the facilities for which support is claimed.Documentation associated with an implementation shall identify archaic language elements in the implementation.

An implementation shall provide a warning mechanism that optionally can be invoked by the user at compile time toindicate each use of an archaic language element in a compilation group.

3.1.11 Obsolete language elements

Obsolete language elements are identified in E.2, Obsolete language elements. Obsolete language elements will beremoved from the next revision of standard COBOL.

Page 22: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Externally provided functionality

3: Conformance 5

No language elements shall be deleted from the next revision of standard COBOL without having first been identifiedas obsolete in this draft International Standard.

An implementation is required to support obsolete language elements of the facilities for which support is claimed.Documentation associated with an implementation shall identify all obsolete language elements in theimplementation.

An implementation shall provide a warning mechanism that optionally can be invoked by the user at compile time toindicate each use of an obsolete element in a compilation group.

3.1.12 Externally provided functionality

An implementation may require specifications outside the compilation group to interface with the operatingenvironment to support functionality specified in a compilation group.

An implementation may require the presence in the operating environment of programs or products in addition to theCOBOL implementation to support syntax or functionality specified in a compilation group.

NOTE — This permits an implementation to require components outside the COBOL implementation, such as pre-compilers,file systems, and sort products.

If any feature is provided outside the compilation group that accomplishes functionality specified by an standardCOBOL language element, the implementation shall not require the specification of the external feature in thecompilation group in place of or in addition to that standard COBOL language element.

3.1.13 Limits

In general, standard COBOL specifies no upper limit on such things as the number of statements in a compilationgroup or the number of operands permitted in certain statements. It is recognized that these limits will vary fromone implementation of standard COBOL to another and may prevent the successful translation by a conformingimplementation of some compilation groups that meet the requirements of standard COBOL.

3.1.14 User documentation

An implementation shall satisfy the user documentation requirements specified in 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.8,3.1.10, and 3.1.11 by specification in at least one form of documentation. This may include, but is not limited to,hardcopy manuals, on-line documentation, and user help screens.

Documentation requirements may be met by reference to other documents, including those of the operatingenvironment and other COBOL implementations.

An implementor shall identify one document that provides references to all documentation referenced in this clause.

3.1.15 Character substitution

The definition of the COBOL character set in 8.1.2, COBOL character set, presents the complete COBOL characterset for standard COBOL. When an implementation does not provide for a graphic representation for all the basiccharacters of the COBOL character set, substitute graphics may be specified by the implementor to replace thecharacters not represented.

3.2 A conforming compilation group

A conforming compilation group is one that does not violate the explicitly stated provisions and specifications ofstandard COBOL. In order for a compilation group to conform to standard COBOL, it shall not include any languageelements not specified in this draft International Standard. The processing of a run unit, the source text of whichconforms to standard COBOL, is predictable only to the extent defined in standard COBOL. The results of violatingthe formats or rules of standard COBOL are undefined unless otherwise specified in this draft International Standard.

Page 23: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Relationship of a conforming compilation group to a conforming implementation

6 3: Conformance

Situations in which the results of executing a statement are explicitly undefined or unpredictable are identified in B.2,Undefined language element list. A COBOL compilation group that allows these situations to happen is a conformingcompilation group, although the resultant execution is not defined by standard COBOL.

3.3 Relationship of a conforming compilation group to a conforming implementation

The translation of a conforming compilation group by a conforming implementation and its subsequent execution ina run unit is defined only to the extent specified in standard COBOL. However, the preceding statement does notimply that the program will be translated or executed successfully. Successful translation and execution depend onother factors, such as the use of implementor-defined language elements, the logical correctness of the program, thedata upon which the program operates, and the limits of an implementation.

Page 24: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 7

4 DefinitionsFor the purposes of this draft International Standard, the following definitions apply:

4.1 abbreviated combined relation condition: The combined condition that results from the explicit omission ofa common subject or a common subject and common relational operator in a consecutive sequence of relationconditions.

4.2 absent data item: A data item that plays no part in the processing of a given instance of a containing groupentry because of a PRESENT WHEN (or equivalent) clause or an OCCURS clause with a DEPENDING ON phrase inthe data item's data description entry.

4.3 absolute (of a report line or printable item): Described using a LINE NUMBER or COLUMN NUMBER clausewithout the word PLUS or +, and therefore always printed in a fixed vertical position (in the case of a line) or a fixedhorizontal position (in the case of a printable item).

4.4 access mode: The manner in which records are to be operated upon within a file.

4.5 activated run time entity: A function, method, or program placed into the active state by a statement.

4.6 activating statement: A statement that causes the execution of a function, method, or program.

4.7 activating run time entity: A function, method, or program that contains the activating statement.

4.8 active state: The state of a program that has been called but has not yet returned to the calling program.

4.9 actual decimal point: The physical representation, using the decimal point characters period ( . ) or comma( , ), of the decimal point position in a data item.

4.10 address-identifier: An identifier that references the address of a data item or pointer.

4.11 alphabet-name: A user-defined word in the SPECIAL-NAMES paragraph of the environment division thatassigns a name to a specific character set and collating sequence.

4.12 alphabetic character: A basic letter or a space character.

4.13 alphanumeric character: Any character in an alphanumeric character set.

4.14 alphanumeric character position: The amount of physical storage required to store, or presentation spacerequired to print or display, a single character of an alphanumeric character set.

4.15 alphanumeric character set: Any character set that is used to represent data associated with COBOL's usagedisplay.

4.16 alphanumeric collating sequence: A collating sequence associated with an alphanumeric character set.

4.17 alphanumeric function: A function whose value is composed of a string of one or more alphanumericcharacters from an alphanumeric character set.

4.18 alphanumeric literal: A literal delimited by either (1) paired quotation symbols or (2) the opening delimiter T',T", X', or X" on the left and a matching quotation symbol on the right. The literal has the class and categoryalphanumeric and its content may be one or more characters from the computer's character set.

4.19 alternate record key: A key, other than the prime record key, whose contents identify a record within anindexed file.

Page 25: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

8 4: Definitions

4.20 argument: An operand specified in the activating statement of a function, method, or program that specifiesthe data to be passed upon activation of the run time entity.

4.21 arithmetic operation: Any of the basic mathematical processes of addition, subtraction, multiplication,division, exponentiation, unary plus, and unary minus.

4.22 ascending key: A key upon the values of which data is ordered starting with the lowest value of key up tothe highest value of key in accordance with the rules for comparing data items.

4.23 assumed decimal point: A decimal point position that does not involve the existence of an actual characterin a data item. The assumed decimal point has logical meaning with no physical representation.

4.24 at end condition: A condition caused:

1) During the execution of a READ statement for a sequentially accessed file, when no next logical record exists inthe file, or when the number of significant digits in the relative record number is larger than the size of the relativekey data item, or when an optional input file is not present.

2) During the execution of a RETURN statement, when no next logical record exists for the associated sort or mergefile.

3) During the execution of a SEARCH statement, when the search operation terminates without satisfying thecondition specified in any of the associated WHEN phrases.

4.25 automatic data: The data described in the local-storage section.

4.26 automatic data item: A data item that is described as part of an automatic data record.

4.27 automatic data record: A logical record that is described in the local-storage section.

4.28 based item: A data item that is defined with the WITH POINTER clause. A based item has no storageassociated with it.

4.29 basic letters: The uppercase letters ’A’ through ’Z’ or the lowercase letters ’a’ through ’z’ in the COBOLcharacter set.

4.30 binding: The process of linking a method invocation to a method implementation. Binding can be done atcompile time if the compiler is able to determine the class of the object; in this case it is called static or early binding.Binding that is not done at compile time is called dynamic or late binding and is a form of method resolution thatassociates a method with an operation at run time, depending on the class of the receiving object.

4.31 bit: The smallest unit in a computer's storage structure capable of representing two distinct alternatives.

4.32 bit position: The amount of physical storage required to store, or presentation space required to print ordisplay, a single bit.

4.33 block; physical block: A physical unit of data that is normally composed of one or more logical records.

4.34 body group: Generic name for a report group of TYPE DETAIL, CONTROL HEADING, or CONTROL FOOTING.

4.35 boolean character: A unit of information that consists of the value zero or one.

4.36 boolean data item: A data item capable of representing a set of boolean values.

4.37 boolean expression: One or more boolean operands separated by boolean operators.

Page 26: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 9

4.38 boolean function: A function whose value is a string of one or more boolean characters.

4.39 boolean literal: A literal delimited by the opening delimiter B', B", BX', or BX" on the left and a matchingquotation symbol on the right. The literal has the class and category boolean and its content may be one or moreboolean characters.

4.40 boolean operator: A reserved word used in the construction of a boolean expression to indicate a booleanoperation.

4.41 boolean position: The amount of physical storage required to store, or presentation space required to printor display, a single boolean character.

4.42 boolean value: A value consisting of a sequence of one or more boolean characters.

4.43 bottom margin: An empty area that follows the page body.

4.44 call convention: The information required to interact successfully with a function, method, or program. Thisincludes items such as name case sensitivity, how arguments are passed, and stack management.

4.45 called program; subprogram: A program that receives control as the result of the execution of a CALLstatement.

4.46 calling program: A program that transfers control to another program by execution of a CALL statement.

4.47 cd-name: A user-defined word that names an MCS interface area described in a communication descriptionentry within the communication section of the data division.

4.48 character: The basic unit of the language.

4.49 character addressable terminal: A terminal that consists of a terminal display screen and a terminal keyboardfor entering data where the display screen represents a rectangular grid of character positions, for example 24 display lines of 80 character positions.

4.50 character boundary: The leftmost bit of an addressing boundary in the storage of the computer.

4.51 character position: The amount of physical storage required to store, or presentation space required to printor display, one character -- either an alphanumeric character or a national character.

4.52 character-string: A sequence of contiguous characters that form a COBOL word, a literal, or a PICTUREcharacter-string.

4.53 class: The entity that defines common behavior and implementation for zero, one, or more objects. Theobjects that share the same implementation are considered to be objects of the same class.

4.54 class condition: The proposition, for which a truth value can be determined, that the content of an item iswholly alphabetic, wholly uppercase alphabetic, wholly lowercase alphabetic, is wholly numeric, is wholly boolean,or consists exclusively of those characters listed in the definition of a class-name.

4.55 class definition: The source unit that defines a class.

4.56 class-name (for truth value proposition): A user-defined word defined in the SPECIAL-NAMES paragraph ofthe environment division that assigns a name to the proposition for which a truth value can be determined, that thecontent of a data item consists exclusively of those characters listed in the definition of the class-name.

4.57 class-name (for object orientation): A user-defined word that identifies a class.

Page 27: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

10 4: Definitions

4.58 clause: A clause is an ordered set of consecutive COBOL character-strings whose purpose is to specify anattribute of an entry.

4.59 COBOL character set: A character set used to express the syntax of a COBOL source program, except forthe content of alphanumeric literals, national literals, and comments.

4.60 COBOL word: A character string that forms a compiler-directive word, a context-sensitive word, anexception-name, an intrinsic-function-name, a reserved word, a system-name, or a user-defined word.

4.61 code-name: A system-name that identifies a character code set and/or a collating sequence.

4.62 coded character set: A set of unambiguous rules that establishes a character set and the relationshipbetween the characters of the set and their coded representation. [ISO/IEC 10646-1]

4.63 collating sequence: The sequence in which the characters that are acceptable to a computer are ordered forpurposes of sorting, merging, comparing, and for processing indexed files sequentially.

4.64 column: A character position within a print line.

4.65 combined condition: A condition that is the result of connecting two or more conditions with the 'AND' orthe 'OR' logical operator.

4.66 combining character: A member of an identified subset of the coded character set of ISO/IEC 10646intended for combination with the preceding non-combining graphic character, or with a sequence of combiningcharacters preceded by a non-combining character. [ISO/IEC 10646-1]

4.67 comment indicator: The two contiguous COBOL characters '*>', which indicate a comment line or an in-linecomment.

4.68 comment line: A line that serves only for documentation.

4.69 common program: A program that, despite being directly contained within another program, may be calledfrom any program directly or indirectly contained in that other program.

4.70 communication description entry: An entry in the communication section of the data division that describesthe interface between the message control system (MCS) and the COBOL program.

4.71 communication device: A mechanism (hardware or hardware/software) capable of sending data to a queueand/or receiving data from a queue. This mechanism may be a computer or a peripheral device.

4.72 communication section: The section of the data division that describes the interface areas between themessage control system (MCS) and the program.

4.73 compilation group: A sequence of source units submitted for compilation together.

4.74 compiler directive: An instruction to the COBOL compiler to take specific action when compiling a sourceprogram.

4.75 compiler-directive word: A COBOL word that is used in the syntax of a compiler directive.

4.76 compile time: The time at which a COBOL source program is translated to an executable program.

4.77 compiler directing statement: A statement that instructs the compiler to take a specific action in the processof compiling a program.

4.78 complex condition: A condition in which one or more logical operators act upon one or more conditions.

Page 28: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 11

4.79 composite sequence: A sequence of graphic characters consisting of a non-combining character followedby one or more combining characters. [ISO/IEC 10646-1].

4.80 computer-name: A system-name that identifies the computer upon which the program is to be compiled orrun.

4.81 concatenation expression: An expression consisting of two operands separated by a concatenationoperator.

4.82 concatenation operator: The symbol '&'.

4.83 condition: A status of a program at execution time for which a truth value can be determined.

4.84 condition-name: A user-defined word that assigns a name to a subset of values that a conditional variablemay assume; or a user-defined word assigned to a status of an implementor-defined switch or device.

4.85 condition-name condition: The proposition, for which a truth value can be determined, that the value of aconditional variable is a member of the set of values attributed to a condition-name associated with the conditionalvariable.

4.86 conditional expression: A simple condition or a complex condition specified in an EVALUATE, IF, PERFORM,or SEARCH statement.

4.87 conditional phrase: A phrase that specifies the action to be taken upon determination of the truth value ofa condition resulting from the execution of a conditional statement.

4.88 conditional statement: A statement for which the truth value of a specified condition is determined and usedto control the subsequent action of the program.

4.89 conditional variable: A data item one or more values of which has a condition-name assigned to it.

4.90 configuration section: A section of the environment division that describes overall specifications of sourceand object programs.

4.91 conformance (for object orientation): The property that allows an object with a given interface to be usedwhere an object with a different interface is expected. Conformance ensures that any operation specified for theconformed interface is supported by the conforming interface.

4.92 content validation: That stage of the execution of a VALIDATE statement in which the contents of dataitems are checked against their permitted values or ranges of values, wherever specified.

4.93 context-dependent function key: A key on the keyboard that is defined as carrying out a particular functionin a specific context.

4.94 context-sensitive words: COBOL words that are specified in formats but are reserved only in the context inwhich they are specified.

4.95 contiguous items: Items that are described by consecutive entries in the data division and that bear a definitehierarchical relationship to each other.

4.96 control break: A change in the value of a data item that is referenced in the CONTROL clause. Moregenerally, a change in the value of a data item that is used to control the hierarchical structure of a report.

4.97 control break level: The relative position within a control hierarchy at which the highest-level control breakoccurred.

Page 29: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

12 4: Definitions

4.98 control data item: A data item, a change in whose content may produce a control break.

4.99 control data-name: A data-name that appears in a CONTROL clause and refers to a control data item.

4.100 control footing: A report group that is printed at the end of a control group of which it is a member.

4.101 control function: An action that affects the recording, processing, transmission, or interpretation of data,and that has a coded representation consisting of one or more characters.

NOTE — This definition is the same as that in ISO/IEC 10646-1 except that "octets" is replaced by "characters" because theterm "octet" is not used in the COBOL specification.

4.102 control group: A set of body groups that is printed for a specific value of a control data item (or FINAL) andconsisting of a control heading (if defined for that control break level), other body groups (if generated) and a controlfooting (if defined for that control break level).

4.103 control heading: A report group that is printed at the beginning of a control group of which it is a memberand, if so specified, at the head of each page of the report.

4.104 control hierarchy: The order from major to minor of the operands of a CONTROL clause, defined by theorder in which they are specified, and used to subdivide the report.

4.105 counter: A data item used for storing numbers or number representations in a manner that permits thesenumbers to be increased or decreased by the value of another number, or to be changed or reset to zero or to anarbitrary positive or negative value.

4.106 CRT status: A four-character conceptual entity whose value is set to indicate the status of a terminalinput-output operation during the execution of an ACCEPT screen statement.

4.107 cultural element: An element of data for computer use that may vary dependent on language, geographicalterritory, or other cultural circumstances.

4.108 currency sign: The character '$' of the COBOL character set.

4.109 currency string: The set of characters placed into numeric edited data items as a result of editing operationswhen the item includes a currency symbol in its PICTURE character-string.

4.110 currency symbol: The character used in the PICTURE character-string to represent the presence of acurrency string.

4.111 current record: In file processing, the record that is available in the record area associated with a file.

4.112 current volume pointer: A conceptual entity that points to the current volume of a sequential file.

4.113 cursor: A visible indicator on a character addressable terminal screen that shows the position on the screenat which the next data character input at the keyboard will be displayed.

4.114 cursor control keys: Keys on the keyboard of a character addressable terminal that control the positioningof the cursor on the screen. Typically these include keys that move the cursor up, down, left, right, next screenitem, previous screen item.

4.115 data clause: A clause, appearing in a data description entry in the data division of a COBOL program, thatprovides information describing a particular attribute of a data item.

4.116 data description entry: A data division entry that specifies the characteristics of a data item.

Page 30: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 13

4.117 data item: A unit of data (excluding literals) defined by the COBOL program or by the rules for functionevaluation.

4.118 data keys: Keys on the keyboard of a character addressable terminal that represent individual printable datacharacters.

4.119 data-name: A user-defined word that names a data item described in a data description entry or a recorddescribed in a record-description entry.

4.120 data-pointer data item: A data item in which the address of a data item may be stored.

4.121 debugging indicator: The three contiguous COBOL characters '>>D' followed by a space, when specified asthe first non-space characters of a free-form source line, that indicate a debugging line.

4.122 debugging line: A source line that optionally may be compiled, depending on the setting of a debuggingmode switch specified in the OBJECT-COMPUTER paragraph.

4.123 declarative statement: A statement beginning with the word USE that directs the compiler to generate codeto take a specific action during the processing of other statements.

4.124 declaratives: A set of one or more special purpose sections, the first of which is preceded by the key wordDECLARATIVES and the last of which is followed by the key words END DECLARATIVES.

4.125 de-edit: The logical removal of all editing characters from a numeric edited data item in order to determinethat item's unedited numeric value.

4.126 default value: A value supplied whenever a given data item is referred to during execution of a VALIDATEstatement when the data item is blank or, if elementary, has failed format validation.

4.127 delimited scope statement: Any statement that includes its explicit scope terminator.

4.128 descending key: A key upon the values of which data is ordered starting with the highest value of key downto the lowest value of key, in accordance with the rules for comparing data items.

4.129 destination: The symbolic identification of the receiver of a transmission from a queue.

4.130 detail: A report group that shall be explicitly generated to be printed, as opposed to headings and footingsthat are printed automatically.

4.131 device-name: A system-name that identifies an input-output device.

4.132 digit position: The amount of physical storage required to store, or presentation space required to print ordisplay, a single digit.

4.133 display attributes: Attributes associated with screen items that specify their rendition on the terminal whenthey are referenced in an ACCEPT or DISPLAY statement.

4.134 division: A collection of zero, one, or more sections or paragraphs, called the division body, that are formedand combined in accordance with a specific set of rules. Each division consists of the division header and the relateddivision body. There are four divisions in a COBOL program: identification, environment, data, and procedure.

4.135 division header: A combination of words, followed by a separator period, that indicates the beginning of adivision.

4.136 dummy report group: A report group that consists only of a single level-01 entry and contains no LINENUMBER or COLUMN NUMBER clauses.

Page 31: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

14 4: Definitions

4.137 dynamic access: An access mode in which specific logical records can be obtained from or placed into amass storage file in a nonsequential manner and obtained from a file in a sequential manner during the scope of thesame OPEN statement.

4.138 dynamic storage: Storage that is allocated during run time on request with an ALLOCATE statement andreleased on request with a FREE statement.

4.139 dynamic table: A table for which the number of occurrences for which storage is allocated may beincremented or decremented at execution time.

4.140 elementary item: A data item that is described as not being further logically subdivided.

4.141 elementary report item: A report item defined by an elementary entry in the report section.

4.142 end marker: A marker for the end of a source unit.

4.143 end of procedure division: The physical position of a COBOL source program after which no furtherprocedures appear.

4.144 end program marker: A combination of words, followed by a separator period, that indicates the end of aCOBOL source program. The end program marker is:

END PROGRAM program-name.

4.145 enter key: A key on the keyboard of a character addressable terminal that signals that the input of the screenitem or the screen record is complete.

4.146 entry: Any descriptive set of consecutive clauses terminated by a separator period and written in theidentification division, environment division, or data division of a COBOL program.

4.147 error indication: The final stage of the execution of a VALIDATE statement that consists in setting orresetting any error messages or indicators that have been defined, in a different part of the data division, for the dataitem being validated, or its subordinate data items.

4.148 exception condition: A condition detected during the execution of a program that indicates that an error orexception to normal processing has occurred.

4.149 exception-name: The name of a specific type of exception condition.

4.150 exception object: An object that acts as an exception condition.

4.151 exception status indicator: A conceptual entity that exists for each exception-name.

4.152 execution time: The time at which a program is executed.

4.153 explicit scope terminator: A reserved word that terminates the scope of a particular procedure divisionstatement.

4.154 exponent: In floating-point representation, that power to which the radix of the representation is to beraised.

4.155 expression: An arithmetic or conditional expression.

4.156 extend mode: The state of a file connector after execution of an OPEN statement, with the EXTEND phrasespecified, for that file connector and before the execution of a CLOSE statement without the REEL or UNIT phrasefor that file connector.

Page 32: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 15

4.157 extended letter: A letter, other than the basic letters, in the set of characters defined for the COBOLcharacter set.

4.158 external data: The data described in a program as external data items and external file connectors.

4.159 external data item: A data item that is described as part of an external record in one or more programs of arun unit and that may be referenced from any program in which it is described.

4.160 external data record: A logical record that is described in one or more programs of a run unit and whoseconstituent data items may be referenced from any program in which they are described.

4.161 external file connector: A file connector that is accessible to one or more object programs in the run unit.

4.162 external media format: A form of data suitable for presentation or printing, including any control functionsnecessary for representation as readable text.

4.163 external repository: An implementor-provided storage for information relating to class names, methodnames, method parameters, and any other information that the implementor requires.

4.164 external switch: A hardware or software device, defined and named by the implementor, that is used toindicate that one of two alternate states exists.

4.165 factory method: A method for a factory object.

4.166 factory object: The single object of a class, defined by the factory definition of a class. There is one factoryobject for each class. The factory object is the creator of objects of the class.

4.167 factory (object) data: The data for a factory object, declared in the data division of a factory definition andcommon for all objects of the class.

4.168 factory (object) identifier: An object identifier that identifies a factory object.

4.169 factory definition: The source unit that defines a factory object.

4.170 feature-name: A system-name that identifies a feature of an input-output device.

4.171 field: A contiguous area of a terminal screen that represents an elementary screen item.

4.172 figurative constant: A compiler-generated value referenced through the use of certain reserved words orreserved words and alphanumeric, boolean, or national literals.

4.173 file: A physical collection of logical records.

4.174 file attribute conflict condition: A condition occurring when an unsuccessful attempt has been made toexecute an input-output operation on a file and the file attributes, as specified for that file in the program, do notmatch the fixed attributes for that file.

4.175 file connector: A storage area that contains information about a file and is used as the linkage between afile-name and a physical file and between a file-name and its associated record area.

4.176 file control entry: A SELECT clause and subordinate clauses that declare the relevant physical attributes ofa file.

4.177 file description entry: A data division entry that specifies the characteristics of a file.

Page 33: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

16 4: Definitions

4.178 file-name: A user-defined word that names a file connector described in a file description entry or asort-merge file description entry within the file section of the data division.

4.179 file organization: The permanent logical file structure established at the time that a file is created.

4.180 file position indicator: A conceptual entity that contains the value of the current key within the key ofreference for an indexed file, or the record number of the current record for a sequential file, or the relative recordnumber of the current record for a relative file, or indicates that no next logical record exists, or that the number ofsignificant digits in the relative record number is larger than the size of the relative key data item, or that an optionalinput file is not present, or that the at end condition already exists, or that no valid next record has been established.

4.181 file section: The section of the data division that contains file description entries and sort-merge filedescription entries together with their associated record descriptions

4.182 file sharing: A cooperative environment that controls concurrent access to the same physical file.fixed fileattributes: Information about a file that is established when a file is created and shall not subsequently be changedduring the existence of the file.

4.183 fixed-length record: A record associated with a file whose file description or sort-merge description entryrequires that all records contain the same number of character positions.

4.184 fixed-point numeric item: A numeric data item using fixed-point representation.

4.185 fixed-point numeric literal: A quantity, in fixed-point representation, that has a radix of ten and is expressedas a literal composed of one or more numeric characters and optionally either a decimal point or an algebraic sign, orboth.

4.186 fixed-point representation: A positional representation in which each number is represented by a singlesequence of digits, the position of the radix point being fixed with respect to the rightmost end of the set accordingto the position of the implicit or explicit radix point.

4.187 floating-point numeric item: A numeric data item using floating-point representation.

4.188 floating-point numeric literal: A quantity, in floating-point representation, that has a radix of ten.

4.189 floating-point representation: A number representation in which a number is represented by two sequencesof digits, the significand and the exponent.

4.190 footing area: The position of the page body adjacent to the bottom margin.

4.191 formal parameter: A data-name specified in the USING phrase of the procedure division header that givesthe name used in the function, method, or program for a parameter.

4.192 format: A specific arrangement of a set of data.

4.193 format validation: That stage of the execution of a VALIDATE statement in which the formats of elementarydata items are checked for conformance with their associated PICTURE, SIGN and USAGE clauses, whereverspecified.

4.194 function: A temporary data item whose value is determined at the time an intrinsic or a user-defined functionis referenced during the execution of a statement.

4.195 function-identifier: An identifier that references an intrinsic-function-name, a user-defined-name, or afunction-prototype-name.

Page 34: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 17

4.196 function key: A key on the keyboard of a character addressable terminal that, when enabled and pressed,signals that input of the screen record is complete and a function is requested.

4.197 function prototype definition: A definition that specifies the rules governing the arguments needed for theevaluation of a particular function, the data item resulting from the evaluation of the function, and all otherrequirements needed for the evaluation of that function.

4.198 global name: A name declared in only one program that may be referenced from that program and from anyprogram contained within that program.

4.199 graphic character: A character, other than a control function, that has a visual representation normallyhandwritten, printed, or displayed. [ISO/IEC 10646-1].

4.200 graphic symbol: The visual representation of a graphic character or of a composite sequence. [ISO/IEC10646-1] .

4.201 group item: A data item that is composed of subordinate data items.

4.202 high-order end: The leftmost position of a string of characters or a string of bits.

4.203 i-o mode: The state of a file connector after execution of an OPEN statement, with the I-O phrase specified,for that file connector and before the execution of a CLOSE statement without the REEL or UNIT phrase for that fileconnector.

4.204 i-o status: A conceptual entity that contains a two-character value indicating the status of an input-outputoperation.

4.205 identifier: A language element that uniquely references a data item or a function.

4.206 imperative statement: A statement that specifies an unconditional action to be taken or a conditionalstatement that is delimited by its explicit scope terminator (delimited scope statement). An imperative statementmay consist of a sequence of imperative statements.

4.207 implicit scope terminator: A separator period that terminates the scope of any preceding unterminatedstatement, or a phrase of a statement that by its occurrence indicates the end of the scope of any statementcontained within the preceding phrase.

4.208 index: A computer storage area or register, the content of which represents the identification of a particularelement in a table.

4.209 index data item: A data item in which a value associated with an index-name may be stored in a formspecified by the implementor.

4.210 index-name: A user-defined word that names an index associated with a table.

4.211 indexed file: A file with indexed organization.

4.212 indexed organization: The permanent logical file structure in which each record is identified by the value ofone or more keys within that record.

4.213 inheritance (for classes): A mechanism for using the interface and implementation of one or more classesas the basis for another class. A subclass inherits from one or more superclasses. The interface of an inheriting classconforms to the interface of the inherited classes.

4.214 inheritance (for interfaces): A mechanism for using the specification of one or more interfaces as the basisfor another interface. An inheriting interface conforms to the inherited interface.

Page 35: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

18 4: Definitions

4.215 initial data: The data described in the working-storage or file section of an initial program.

4.216 initial data item: A data item that is described as part of an initial data record.

4.217 initial data record: A logical record that is described in the working-storage or file section of an initialprogram and is initialized on every call to the program.

4.218 initial file connector: A file connector that is described in an initial program and is not in an open mode onany call to the program.

4.219 initial program: A program that is placed into an initial state every time the program is called in a run unit.

4.220 initial state: The state of a program when it is first called in a run unit.

4.221 in-line comment: a comment preceded on a source line by one or more COBOL words or character-strings.

4.222 input distribution: That stage of the execution of a VALIDATE statement that consists in moving each dataitem, or its default value, to target data items.

4.223 input file: A file that is opened in the input mode.

4.224 input mode: The state of a file connector after execution of an OPEN statement, with the INPUT phrasespecified, for that file connector and before the execution of a CLOSE statement without the REEL or UNIT phrasefor that file connector.

4.225 input-output control system; IOCS: A system provided by the implementor that directs, or controls, theprocessing of files.

4.226 input-output file: A file that is opened in the I-O mode.

4.227 input-output section: The section of the environment division that names the files and the external mediarequired by an object program and provides information required for transmission and handling of data duringexecution of the object program.

4.228 input-output statement: A statement that causes files to be processed by performing operations uponindividual records or upon the file as a unit. The input-output statements are: CLOSE, DELETE, OPEN, READ,REWRITE, START, and WRITE.

4.229 input procedure: A set of statements to which control is given during the execution of a SORT statement,for the purpose of controlling the release of specified records to be sorted.

4.230 integer:

1) A fixed-point numeric literal that does not include any digit positions to the right of the decimal point.

2) A fixed-point numeric data item defined in the data division that does not include any digit positions to the rightof the decimal point.

3) An integer function

4) A standard intermediate data item whose decimal fixed-point representation contains only zeros to the right ofthe decimal point.

NOTES1 The unique value zero is an integer.

2 If the value of the exponent is greater than 31, the value of the standard intermediate data item is an integer.

Page 36: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 19

3 If the value of the exponent is less than 1 then the value of the standard intermediate data item is not an integer.

4.231 integer function: A function whose category is numeric and whose definition provides that all digits to theright of the decimal point are zero in the returned value for any possible evaluation of the function.

4.232 interface (for a method): The information needed to invoke a method correctly.

4.233 interface (the language construct): A grouping of method prototypes.

4.234 interface definition: The source unit that defines an interface.

4.235 internal data: The data described in a program excluding all external data items and external file connectors.

4.236 internal data item: A data item described in one program.

4.237 internal file connector: A file connector that is accessible to only one object program in the run unit.

4.238 intrinsic-function-name: A word that names a mechanism provided by the implementor to determine thevalue of a function.

4.239 invalid key condition: A condition occurring at execution time when a specific value of the key associatedwith an indexed or relative file is determined to be invalid.invocation; method invocation: See method invocation.

4.240 invocation operator: A pair of adjacent colon characters, i.e.: '::', used in an in-line invocation of a method.

4.241 IOCS; input-output control system: See input-output control system.

4.242 item identification: The process of identifying the data item referenced by an identifier.

4.243 key: A data item that identifies the location of a record, or a set of data items that serve to identify theordering of data.

4.244 key of reference: The key, either prime or alternate, currently being used by a file connector to accessrecords within an indexed file.

4.245 key word: A reserved word or intrinsic-function-name whose presence is required when the general formatin which the word appears is used in a source program.

4.246 last exception status: A conceptual entity that is set to indicate the last level-3 exception that was raised inthe function, method, or program, or is set to indicate no exception because no exception has been raised or becausethe last exception status was cleared with a SET statement.

4.247 letter: A basic letter or an extended letter.

4.248 level indicator: Two alphabetic characters that identify a specific type of file or a position in a hierarchy.The level indicators in the data division are: CD, FD, RD, and SD.

4.249 level-number: A user-defined word, expressed as a one or two digit number, that indicates the hierarchicalposition of a data item or the special properties of a data description entry.

4.250 level-1 exception-name: The most inclusive exception-name. There is only one, and it is EC-ALL.

4.251 level-2 exception-name: An exception-name used to group like exception-names.

4.252 level-3 exception-name: The least inclusive exception-name that identifies a specific exception condition.Each level-3 exception name begins with its associated level-2 exception-name.

Page 37: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

20 4: Definitions

4.253 library-name: A system-name that names a COBOL library that is to be used by the compiler for a givensource program compilation.

4.254 library text: Text that resides in a COBOL library for the purpose of being introduced into a source programat compile time by a COPY statement.

4.255 line width; line (of a report): A complete row of characters arranged in horizontal columns.

4.256 line number: An integer that denotes the vertical position of a report line on a page.

4.257 linkage section: A section in the data division of a called program that describes data items available froma calling program.

4.258 literal: A character-string whose value is derived from the ordered set of characters in the string.

4.259 locale: The definition of the subset of a user's information technology environment that depends onlanguage and cultural conventions.

4.260 lock mode: The state of an open file connector when record locking is in effect that indicates whether recordlocking is manual or automatic.

4.261 logical operator: One of the reserved words AND, OR, or NOT.

4.262 logical page: A conceptual entity consisting of the top margin, the page body, and the bottom margin.

4.263 logical record; record: A data item defined with level number 01.

4.264 low-order end: The rightmost position of a string of characters or a string of bits.

4.265 mass storage: A storage medium in which data may be organized and maintained in both a sequential andnonsequential manner.

4.266 mass storage control system; MSCS: An input-output control system that directs, or controls, theprocessing of mass storage files.

4.267 mass storage file: A collection of records that is assigned to a mass storage medium.

4.268 MCS; message control system: See message control system.

4.269 merge file: A collection of records to be merged by a MERGE statement.

4.270 message: Data associated with an end of message indicator or an end of group indicator in thecommunications facility.

4.271 message control system; MCS: A communication control system that supports the processing of messages.

4.272 message count: The count of the number of complete messages that exist in the designated queue ofmessages.

4.273 message indicators: Conceptual indicators that notify the message control system that a specific conditionexists (end of group, end of message, or end of segment).

4.274 message segment: Data that forms a logical subdivision of a message, normally associated with an end ofsegment indicator.

Page 38: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 21

4.275 method: Procedural code that is declared in the procedure division of a method and is executed by a methodinvocation on that object.

4.276 method data: The data declared in the data division of a method definition.

4.277 method definition: The source unit that defines a method.

4.278 method invocation; invocation: The request to execute a named method on a given object. A methodinvocation identifies an object, a method name, and the parameters required by the method definition.

4.279 method-name: A user-defined word that identifies a method.

4.280 method prototype: The method-name and parameter types (including a returning item if specified) for amethod. It is specified by a method definition in an interface.

4.281 method prototype definition: The source unit that defines a method prototype.

4.282 mnemonic-name: A user-defined word that is associated in the environment division with a specificsystem-name.

4.283 MSCS; mass storage control system: See mass storage control system.

4.284 multiple (of a COLUMN, LINE, SOURCE or VALUE clause in the report section): Having more than one integeroperand.

4.285 national character: Any character in a national character set.

4.286 national character position: The amount of physical storage required to store, or presentation space requiredto print or display, a single character whose usage is national.

4.287 national character set: Any character set that is used to represent data associated with COBOL's usagenational.

4.288 national collating sequence: A collating sequence associated with a national character set.

4.289 national function: A function whose value is composed of a string of one or more national characters froma national character set.

4.290 national literal: A literal delimited by the opening delimiter N', N", NX', or NX" on the left and a matchingquotation symbol on the right. The literal has the class and category national and its content may be one or morecharacters from the computer's national character set.

4.291 native alphanumeric character set: A character set, used to represent data associated with COBOL's usagedisplay, that consists of all characters in the computer's alphanumeric character set.

4.292 native arithmetic: A mode of arithmetic in which the techniques used in handling arithmetic are specified bythe implementor.

4.293 native character set: An implementor-defined character set, either alphanumeric or national, that isassociated with the computer on which a program is executed.

4.294 native collating sequence: An implementor-defined collating sequence, either an alphanumeric collatingsequence or a national collating sequence, that is associated with the computer on which a program is executed.

4.295 native national character set: A character set, used to represent data associated with COBOL's usagenational, that consists of all characters in the computer's national character set.

Page 39: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

22 4: Definitions

4.296 negated combined condition: The 'NOT' logical operator immediately followed by a parenthesizedcombined condition.

4.297 negated simple condition: The 'NOT' logical operator immediately followed by a simple condition.

4.298 next executable sentence: The next sentence to which control will be transferred after execution of thecurrent statement is complete.

4.299 next executable statement: The next statement to which control will be transferred after execution of thecurrent statement is complete.

4.300 next record: The record that logically follows the current record of a file.

4.301 noncontiguous item: Elementary data items in the working-storage, local-storage, and linkage sections thatbear no hierarchic relationship to other data items.

4.302 numeric character: A character that belongs to the following set of digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

4.303 numeric function: A function whose class and category are numeric but that for some possible evaluationdoes not satisfy the requirements of an integer function.

4.304 numeric item: A data item whose description restricts its content to a value represented by characterschosen from the digits '0' through '9' and optionally the signs '+', '–', or other representation of an operationalsign.

4.305 numeric literal: Either a fixed-point numeric literal or a floating-point numeric literal.

4.306 object (instance): A unit consisting of data and the methods that act upon that data.

4.307 object computer entry: An entry in the OBJECT-COMPUTER paragraph of the environment division thatdescribes the computer environment in which the object program is to be executed.

4.308 object data: Data described in the data division of an object definition, excluding data described in itsmethods.

4.309 object definition: The source unit that defines an object.

4.310 object identifier: An identifier that identifies an object. An object identifier may be a predefined objectidentifier or an object reference identifier.

4.311 object method: A method of an object (as opposed to a factory method), although a factory method is amethod of a factory object.

4.312 object of entry: A set of operands and reserved words, within a data division entry of a COBOL program,that immediately follows the subject of the entry.

4.313 object program: A set or group of executable machine language instructions and other material designed tointeract with data to provide problem solutions. In this context, an object program is generally the machine languageresult of the operation of a COBOL compiler on a source program. Where there is no danger of ambiguity, the word'program' alone may be used in place of the phrase 'object program'.

4.314 object property: A name that may be used to qualify an object reference to get a value from or pass a valueto an object.

4.315 object reference: An data item that contains a reference to an object.

Page 40: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 23

4.316 object reference identifier: An identifier that identifies an object by an object reference.

4.317 obsolete element: A language element in Standard COBOL that is to be deleted from the next revision ofStandard COBOL.

4.318 open mode: The state of a file after execution of an OPEN statement for that file and before the executionof a CLOSE statement without the REEL or UNIT phrase for that file. The particular open mode is specified in theOPEN statement as either INPUT, OUTPUT, I-O, or EXTEND.

4.319 operational sign: An algebraic sign associated with a numeric data item or a numeric literal that indicateswhether its value is positive or negative.

4.320 optional file: A file declared as being not necessarily present each time the program is executed.

4.321 optional word: A reserved word that is included in a specific format only to improve the readability of thelanguage and whose presence is optional to the user when the format in which the word appears is used in a sourceprogram.

4.322 output file: A file that is opened in either the output mode or extend mode.

4.323 output mode: The state of a file connector after execution of an OPEN statement, with the OUTPUT orEXTEND phrase specified, for that file connector and before the execution of a CLOSE statement without the REELor UNIT phrase for that file connector.

4.324 output procedure: A set of statements to which control is given during execution of a SORT statement afterthe sort function is completed, or during execution of a MERGE statement after the merge function reaches a pointat which it can select the next record in merged order when requested.

4.325 padding character: An alphanumeric character used to fill the unused character positions in a physicalrecord.

4.326 page (of a report): A physical division of a report consisting of a vertical arrangement of lines, up to amaximum number. If the report is not so divided, it is regarded as consisting of a single page of indefinite length.

4.327 page advance: A procedure performed automatically before a body group is printed when the body groupcannot be printed on the current page.

4.328 page body: That part of the logical page in which lines may be written and/or spaced.

4.329 page fit test: A test performed automatically before any body group is printed to establish whether the bodygroup will fit entirely on the current page.

4.330 page footing: A report group that is printed automatically at the bottom of each page of a report.

4.331 page heading: A report group that is printed automatically at the top of each page of a report.

4.332 page limit: The greatest permissible number of line positions available on any page of a given report.

4.333 page width: The greatest permissible number of column positions available on any line of a given report.

4.334 paragraph:

1) In the procedure division, a paragraph-name followed by a separator period and by zero, one, or more sentences.

2) In the identification division, a paragraph header followed by one entry.

Page 41: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

24 4: Definitions

3) In the environment division, a paragraph header followed by zero, one, or more entries.

4.335 paragraph header: A reserved word, followed by the separator period, that indicates the beginning of aparagraph in the identification and environment divisions.

4.336 paragraph-name: A user-defined word that identifies and begins a paragraph in the procedure division.

4.337 parameterized class: A class where the full details of one or more dependent classes are not specified in theclass definition. The full details of these dependent classes are specified by parameters before the parameterizedclass is used.

4.338 phrase: An ordered set of COBOL character-strings that specifies an attribute of an entry or a statement andis a subset of a clause or paragraph in all divisions except the procedure division, and a subset of a statement in theprocedure division.

4.339 physical page: A device-dependent concept defined by the implementor.

4.340 physical record: The term is synonymous with block.

4.341 predefined object identifiers: The reserved words EXCEPTION-OBJECT, NULL, SELF, and SUPER used toidentify particular objects.

4.342 prime record key: A key whose contents uniquely identify a record within an indexed file.

4.343 printable group: A report group that contains at least one print line.

4.344 printable item: An elementary report item whose description contains a LINE NUMBER or COLUMN NUMBERclause and which consequently produces a row of printed characters or a blank line in the report.

4.345 prior control: An internal data item, of the same size and format as an operand of a CONTROL clause, usedto hold its prior value and thereby to enable a control break to be sensed.

4.346 procedure: A paragraph or group of logically successive paragraphs, or a section or group of logicallysuccessive sections, within the procedure division.

4.347 procedure branching statement: A statement that causes the explicit transfer of control to a statement otherthan the next executable statement in the sequence in which the statements are written in the source program. Theprocedure branching statements are: CALL, EXIT, EXIT PROGRAM, GO TO, GOBACK, MERGE (with the OUTPUTPROCEDURE phrase), PERFORM, RECOVER, and SORT (with the INPUT PROCEDURE or OUTPUT PROCEDUREphrase).

4.348 procedure-name: A user-defined word that names a paragraph or section in the procedure division.

4.349 processor: The computing system that enables a user to compile and execute source units, consisting ofboth hardware and relevant associated software.

4.350 program identification entry: An entry in the PROGRAM-ID paragraph of the identification division thatspecifies the program-name and assigns selected program attributes to the program.

4.351 program-name: A user-defined word that identifies a COBOL source program.

4.352 program-pointer data item: A data item in which the address of a program may be stored.

4.353 program prototype definition: A definition that specifies the rules governing the class of the parametersexpected to be received by a particular subprogram, and any other requirements needed to transfer control to, andget control and return information back from that subprogram.

Page 42: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 25

4.354 property: See object property.

4.355 pseudo-text: A sequence of text-words, comment lines, or the separator space in a source program orCOBOL library bounded by, but not including, pseudo-text delimiters.

4.356 pseudo-text delimiter: Two contiguous characters "==" used to delimit pseudo-text.

4.357 punctuation character: A character used in formation of separators.

4.358 qualified data-name: An identifier composed of a data-name followed by one or more sets of either of theconnectives OF or IN followed by a data-name qualifier.

4.359 qualifier:

1) A data-name or a name associated with a level indicator that is used in a reference either together with adata-name of an item that is subordinate to the qualifier or together with a condition-name.

2) A section-name that is used in a reference together with a paragraph-name specified in that section.

3) A library-name that is used in a reference together with a text-name associated with that library.

4.360 queue: A logical collection of messages awaiting transmission or processing.

4.361 queue name: A symbolic name that indicates to the message control system the logical path by which amessage or a portion of a completed message may be accessible in a queue.

4.362 quotation symbol: Either the COBOL character quotation mark (") or the COBOL character apostrophe (')used in the opening and closing delimiters of literals.

4.363 radix: In positional representation of numeric values, that positive integer by which the significance of a digitplace must be multiplied to give the significance of the next higher digit position.

4.364 radix point: A generalization of the decimal point for numeric representations in any radix.

4.365 random access: An access mode in which the program-specified value of a key data item identifies thelogical record that is obtained from, deleted from, or placed into a relative or indexed file.

4.366 record; logical record: See logical record.

4.367 record area: A storage area allocated for the purpose of processing the record described in a recorddescription entry in the file section of the data division.

4.368 record description; record description entry: The total set of data description entries associated with aparticular record.

4.369 record description entry; record description: See record description.

4.370 record key: A key, either a prime record key or an alternate record key, whose contents identify a recordwithin an indexed file.

4.371 record-key-name: A user-defined word that names a key associated with an indexed file. This key may bemade up from one or more portions of the record area associated with the file.

4.372 record lock: An indicator that is associated with a specific record in a file and is set and released by thelocking facility. It is used to determine whether multiple file connectors may access the record concurrently.

Page 43: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

26 4: Definitions

4.373 record locking: The controlling of record access for shared files in which a record lock prevents access tothe associated record from other file connectors.

4.374 record-name: A data-name that names a record described in a record description entry.

4.375 record number: The ordinal number of a record in a file whose organization is sequential.

4.376 reel; unit; volume: A discrete portion of a storage medium that contains part of a file, all of a file, or anynumber of files.

4.377 reference format: A format that provides a standard method for describing COBOL source programs.

4.378 reference-modifier: An identifier that references a unique data item created by specifying an identifier, astarting position, and a length.

4.379 rejection on format, content or relation: The action of setting an internal indicator during the execution of aVALIDATE statement to record the fact that a data item has failed a check during the format, content, or relationvalidation stage. The data item itself is not changed.

4.380 relation character: A character that belongs to the following set:

Character Meaning> greater than< less than= equal to

4.381 relation condition: A proposition, for which a truth value may be determined, that the value of an expression,data item, literal, or index has a specific relationship to another expression, data item, literal, or index.

4.382 relation validation: That stage of the execution of a VALIDATE statement in which data items are checked,wherever specified, for consistency in relation to other data items.

4.383 relational operator: A reserved word, a relation character, a group of consecutive reserved words, or a groupof consecutive reserved words and relation characters used in the construction of a relation condition.

4.384 relative (of a report writer line or printable item): Described using a LINE NUMBER or COLUMN NUMBERclause with the word PLUS or +, and therefore positioned by spacing downwards from the previous line (in the caseof a line) or rightwards from the previous column (in the case of a printable item).

4.385 relative file: A file with relative organization.

4.386 relative key: A key whose contents identify a logical record in a relative file.

4.387 relative organization: The permanent logical file structure in which each record is uniquely identified by aninteger value greater than zero, that specifies the record's logical ordinal position in the file.

4.388 relative record number: The ordinal number of a record in a file whose organization is relative.

4.389 repeating data item (report writer): A set of data items defined using a single data description entry in thereport section.

4.390 repeating entry (in the report section): Any entry that has either an OCCURS clause or a multiple LINENUMBER or multiple COLUMN NUMBER clause.

4.391 report: Any printed output described in the report section and generated from data descriptions by theprocedural statements INITIATE, GENERATE and TERMINATE.

Page 44: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 27

4.392 report description entry: A data division entry that describes the characteristics of a report file.

4.393 report file: An output file whose file description entry contains a REPORT clause. A report file's records arewritten as a result of the execution of a GENERATE or TERMINATE statement, rather than by means of WRITEstatements.

4.394 report footing: A report group that is printed once only at the very end of a report.

4.395 report group: A set of report lines, printed contiguously on the same page in a single operation and definedin the report section by a level-01 entry and any subordinate entries.

4.396 report group description entry: An entry in the report section of the data division that is composed of thelevel-number 01, an optional data-name, a TYPE clause, and an optional set of report clauses.

4.397 report heading: A report group that is printed once only at the very beginning of a report.

4.398 report item: A printable item, unprintable item, group of such items, report line, group of report lines orreport group, corresponding to one report section entry.

4.399 report line: A set of zero, one or more adjacent printable items that, when printed, appear together in oneline.

4.400 report-name: A user-defined word that names a report described in a report description entry within thereport section of the data division.

4.401 report section: The section of the data division in which reports are described.

4.402 report writer: A comprehensive set of data clauses and statements that enable a print layout to be describedaccording to its general appearance rather than through of a series of procedural steps.

4.403 reserved word: A word used in the COBOL language that is not available for use as a user-defined word ora system-name.

4.404 resource: A facility or service, controlled by the operating system, that can be used by an executingprogram.

4.405 restricted pointer: A pointer data item that is restricted to data items of a specified type or to programs withthe same signature as a specified program.

4.406 resultant identifier: A user-defined data item that is to contain the result of an arithmetic operation.

4.407 run time entity: The executable unit resulting from compiling a source element, which may be a function,method, or program.

4.408 run unit: One or more object programs that interact with one another and that function, at execution time,as an entity to provide problem solutions.

4.409 screen description entry: A data description entry in the screen section that describes a screen item and itsattributes.

4.410 screen item: A unit of display upon a character addressable terminal.

4.411 screen-name: A user-defined word that names a screen item described in a screen description entry.

4.412 screen record: A screen description entry with a level-number of 01.

Page 45: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

28 4: Definitions

4.413 section: A set of zero, one, or more paragraphs or entries, called a section body, the first of which ispreceded by a section header.

4.414 section header: A combination of words followed by a separator period that indicates the beginning of asection in the environment, data, and procedure division.

4.415 section-name: A user-defined word that names a section in the procedure division.

4.416 sentence: A sequence of one or more statements, the last of which is terminated by a separator period.

4.417 separately-compiled program: A program that, together with its contained programs, is compiled separatelyfrom all other programs.

4.418 separately-compiled source unit: A class definition, function definition, function prototype definition,interface definition, or program prototype definition that can be compiled separately from any other source unit.

4.419 separator: A character or two contiguous characters used to delimit character-strings.

4.420 sequential access: An access mode in which logical records are obtained from or placed into a file in aconsecutive predecessor-to-successor logical record sequence determined by the order of records in the file.

4.421 sequential file: A file with sequential organization.

4.422 sequential organization: The permanent logical file structure in which a record is identified by apredecessor-successor relationship established when the record is placed into the file.

4.423 shared file: A file for which file sharing has been specified.

4.424 sharing mode: The state of an open file connector that indicates the mode of file sharing. The sharing modesare: sharing with all other, sharing with no other, and sharing with read only.

4.425 sign condition: The proposition, for which a truth value can be determined, that the algebraic value of a dataitem or an arithmetic expression is either less than, greater than, or equal to zero.

4.426 signature: The information stored about a compilation unit in the external repository.

4.427 significand: In floating-point representation, the fixed-point numeral that represents the significant digits ofthe number.

4.428 simple condition: Any single condition chosen from the set:relation conditionclass conditioncondition-name conditionswitch-status conditionsign condition(simple-condition)

4.429 size error condition: A condition that may be raised during the execution of arithmetic statements to indicatethat a size error occurred and is tested with the SIZE ERROR phrase of arithmetic statements. It is not associatedwith an exception status indicator

4.430 sort file: A collection of records to be sorted by a SORT statement.

4.431 sort-merge file description entry: A data division entry that specifies the characteristics of a sort or mergefile.

Page 46: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 29

4.432 source: The symbolic identification of the originator of a transmission to a queue.

4.433 source computer entry: An entry in the SOURCE-COMPUTER paragraph of the environment division thatdescribes the computer environment in which the source program is to be compiled.

4.434 source element: A source unit excluding any contained source units.

4.435 source item: An identifier designated by a SOURCE clause that provides the value of a printable item.

4.436 source text manipulation statement: A statement beginning with the word COPY or the word REPLACE thatprovides the capability to insert and replace source program text as part of the compilation of the source program.

4.437 source unit: A sequence of statements beginning with an identification division and finishing with an endmarker or the end of the compilation group, including any contained source units.

4.438 special character word: A reserved word that is composed entirely of special characters.

4.439 special registers: Certain compiler generated storage areas whose primary use is to store informationproduced in conjunction with the use of specific COBOL features.

4.440 standard arithmetic: A mode of arithmetic in which the techniques used in handling arithmetic expressions,arithmetic statements, the SUM clause, and certain integer and numeric functions are specified in this standard.

4.441 standard data format: A concept used to describe data in a COBOL data division whereby the characteristicsor properties of data are expressed in terms of the appearance of graphic characters on a printed page, rather thanthe manner in which data is stored internally in the computer or on a particular external medium.

4.442 standard intermediate data item: A temporary decimal floating-point data item used to hold arithmeticoperands when standard arithmetic is in effect.

4.443 static data: The data described in the file or working-storage section of a source unit that is not an initialprogram.

4.444 static data item: A data item that is described as part of a static data record.

4.445 static data record: A logical record described in the file or working-storage section of a source unit that isnot an initial program.

4.446 strongly typed group: A group item that has restrictions on its use. These restrictions exist because thegroup item or a subordinate item contains a TYPE clause where the referenced type declaration contains the STRONGphrase or is of category object reference or class pointer.

4.447 subclass: A class that inherits from another class. When two classes in an inheritance relationship areconsidered together, the subclass is the inheritor or inheriting class; the superclass is the inheritee or inherited class.

NOTE — In the industry literature, the term derived class is also often used as an alternative to the term subclass. These termsare equivalent.

4.448 sub-queue: A logical hierarchical division of a queue.

4.449 subject of entry: The data item that is being defined by a data description entry.

4.450 subprogram; called program: See called program.

4.451 subscript: An occurrence number used to index a specific element of a table, or in the case of the subscript'ALL', all elements of a table.

Page 47: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

30 4: Definitions

4.452 subscripted data-name: An identifier that is composed of a data-name followed by one or more subscriptsenclosed in parentheses.

4.453 sum counter: A signed numeric intermediate data item corresponding to a report section entry with a SUMclause and used to total the values of the specified operands.

4.454 superclass: A class that is inherited by another class. See also subclass.

4.455 switch-name: A system-name that identifies an implementor-defined external switch.

4.456 switch-status condition: The proposition, for which a truth value can be determined, that animplementor-defined switch, capable of being set to an 'on' or 'off' status, has been set to a specific status.

4.457 symbolic-character: A user-defined word that specifies a user-defined figurative constant.

4.458 system-name: A COBOL word that is used to communicate with the operating environment.

4.459 table: A set of logically consecutive items of data that are defined in the data division of a COBOL programby means of the OCCURS clause.

4.460 table element: A data item that belongs to the set of items in a table.

4.461 terminal (in the screen section): A character addressable device that includes a display and a keyboard.

4.462 terminal (in the communications module): The originator of a transmission to a queue, or the receiver of atransmission from a queue.

4.463 termination key: Any function key or the enter key of a terminal.

4.464 text-name: A system-name that identifies library text.

4.465 top margin: An empty area that precedes the page body.

4.466 truth value: The representation of the result of the evaluation of a condition in terms of one of twovalues: true, false.

4.467 type (for type declaration): A template that contains all the characteristics of a data item and itssubordinates.

4.468 type-modifier: A phrase that indicates that a data item is to be treated as if it were described with thespecified characteristics or type-name.

4.469 unary operator: A '+' or a '–' sign preceding a variable or a left parenthesis in an arithmetic expression.

4.470 unit; reel; volume: See reel.

4.471 universal object reference: An object reference that is not restricted to a specific class or interface.

4.472 unprintable item: An elementary report item whose description contains no LINE NUMBER or COLUMNNUMBER clauses, which has no direct effect on the printed output but may be used indirectly to produce other reportitems.

4.473 unsuccessful execution: The attempted execution of a statement that does not result in the execution of allthe operations specified by that statement.

Page 48: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Definitions

4: Definitions 31

4.474 user-defined word: A COBOL word supplied by the user to satisfy the format of a clause or statement.

4.475 validation: A comprehensive set of facilities, accomplished through execution of a VALIDATE statement, inwhich a data item (group or elementary) is checked, made valid where necessary and moved to target data items,while the results of the checks are reported in separate data items specified in the program.

4.476 variable: A data item whose value may be changed by execution of the program.

4.477 variable-length record: A record associated with a file whose file description or sort-merge description entrypermits records to contain a varying number of character positions.

4.478 variable-occurrence data item: A table element that is repeated a variable number of times. Such an itemcontains an OCCURS clause with the DEPENDING phrase in its data description entry or is subordinate to such anitem.

4.479 volume; unit; reel: See reel.

Page 49: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Description techniques

32 5: Description techniques

5 Description techniques

The techniques used to describe standard COBOL are:

— General formats— Rules— Arithmetic expressions— Natural language text

5.1 General formats

General formats specify the syntax of the elements of standard COBOL and the sequence of arrangement of thoseelements.

The words, phrases, clauses, punctuation, and operands in each general format shall be written in the source programin the sequence given in the general format, unless otherwise specified by the rules of that format.

When more than one arrangement exists for a specific language construct, the general format is separated intomultiple formats that are numbered and named.

Elements used in depicting general formats are:

— Keywords— Optional words— Operands— Level numbers— Options

— Brackets— Braces— Choice indicators

— Ellipses— Punctuation— Special characters— Meta-terms that refer to other formats

5.1.1 Keywords

Keywords are reserved words or context-sensitive words. They are shown in uppercase and underlined in generalformats.

5.1.2 Optional words

Optional words are reserved words or context-sensitive words. They are shown in uppercase and not underlined ingeneral formats. They may be written to add clarity when the clause or phrase in which they are defined is writtenin the source unit.

5.1.3 Operands

An operand is an expression, a literal, or a reference to data. Operands are shown in lowercase and represent valuesor identification of items, conditions, or objects that the programmer supplies when writing the source unit.

The word 'integer' in a general format refers to an unsigned non-zero numeric literal.

Operands in general formats are suffixed with a number (–n) for unique reference in associated rules.

Page 50: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Level numbers

5: Description techniques 33

5.1.4 Level numbers

Specific level numbers appearing in general formats are required to be specified when the formats in which theyappear are written in the source unit. Level number forms 01, 02, ..., 09, and 1, 2, ..., 9, respectively, may bewritten interchangeably.

5.1.5 Options

Options are indicated in a general format by vertically stacking alternative possibilities within brackets, braces, orchoice indicators. An option is selected by specifying one of the possibilities from a stack of alternative possibilitiesor by specifying a unique combination of possibilities from a series of brackets, braces, or choice indicators.

5.1.5.1 Brackets

Brackets, [ ], enclosing a portion of a general format indicate that one of the alternatives contained within thebrackets may be explicitly specified or that portion of the general format may be omitted.

5.1.5.2 Braces

Braces, { }, enclosing a portion of a general format indicate that one of the alternatives contained within the bracesshall be explicitly specified or is implicitly selected. If one of the alternatives contains only optional words, thatalternative is the default and is selected unless another alternative is explicitly specified.

5.1.5.3 Choice indicators

Choice indicators, {| |}, enclosing a portion of a general format indicate that one or more of the alternatives containedwithin the choice indicators shall be specified, but a single alternative may be specified only once.

5.1.6 Ellipses

In the general formats, the ellipsis represents the position at which the user elects repetition of a portion of a format.The portion of the format that may be repeated is determined as follows:

Given an ellipsis in a format, scanning right to left, determine the right bracket or right brace delimiter immediatelyto the left of the ellipsis; continue scanning right to left and determine the logically matching left bracket or left bracedelimiter; the ellipsis applies to the portion of the format between the determined pair of delimiters.

In text other than general formats, the ellipsis ( ... ) shows omission of a word or words when such omission doesnot impair comprehension. This is the conventional meaning of the ellipsis, and the use becomes apparent in context.

5.1.7 Punctuation

The separators comma and semicolon may be used anywhere the separator space is used in the formats. In thesource program, these separators are interchangeable.

The separator period, when used in the formats, has the status of a required word.

5.1.8 Special characters

Special character words, punctuation characters, and separators that appear in formats, although not underlined, arerequired when such portions of the formats are used.

5.1.9 Meta-terms

Meta-terms appear in lowercase in general formats and are the names of subsections of general formats. Subsectionsare specified below the main format and are introduced by the phrase 'where x is:', with x replaced by the meta-term.

Page 51: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Rules

34 5: Description techniques

5.2 Rules

5.2.1 Syntax rules

Syntax rules supplement general formats and define or clarify the order in which words or elements are arranged toform larger elements such as phrases, clauses, or statements. Syntax rules may also either impose restrictions onindividual words or elements or relax restrictions implied by words or elements.

These rules are used to define or clarify how the statement shall be written, i.e., the order of the elements of thestatement and the restrictions or amplifications of what each element may represent.

5.2.2 General rules

A general rule defines or clarifies the meaning or relationship of meanings of an element or set of elements. It is usedto define or clarify the semantics of the statement and the effect that it has on either execution or compilation.

5.2.3 Arguments

Argument rules specify requirements, constraints, or defaults associated with arguments to intrinsic functions.

5.2.4 Returned values

Returned value rules specify the semantics of an intrinsic function.

5.3 Arithmetic expressions

Some rules contain arithmetic expressions that specify part or all of the results of the COBOL syntax. In presentingthe arithmetic expressions, the following additional notation, or different meaning for notation, is used.

5.3.1 Double subscripts

When a double subscript (term-jn) appears as an operand of an expression it refers to the n-th position/occurrenceof term-j. Term-j will be locally substituted by an appropriate element of syntax.

5.3.2 Ellipses

Ellipses show that the number of terms and operators is variable.

5.3.3 Parentheses

Some arithmetic expressions contain one or more pairs of parentheses that do not change the order of evaluation.They are included for clarity.

5.4 Natural language text

A substantial portion of the COBOL specification is described in natural language. Syntax rules and semanticrequirements may be included in the natural language description and are recognized by their context.

5.5 Hyphens in text

All hyphens appearing at the end of a line of text are the hyphens of meta-terms, keywords, optional words, oroperands and are included in the term; otherwise, hyphens are not used to divide words at the end of a line.

Page 52: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Reference format

6: Reference format 35

6 Reference format

Reference format specifies the conventions for writing COBOL source programs, COBOL library text, and compilerdirectives. COBOL provides two reference formats: free-form reference format and fixed-form reference format. Thetwo types of reference format may be mixed within and between source text and library text by use of SOURCEFORMAT compiler directives. (See 7.2.15, SOURCE FORMAT directive.)

The following rules apply to the indicated reference formats:

1) Free-form and fixed-form

a) Reference format is described in terms of character positions on a line on an input-output medium.

b) A COBOL compiler shall accept source programs written in reference format and, when a source listing isbeing produced, shall list the source program in reference format.

c) The implementor shall specify the meaning of lines and character positions.

NOTE — The previous COBOL standard did not state what kind of characters were used, but alphanumeric was generallyassumed.

2) Fixed-form

a) A COBOL compiler shall process fixed-form reference format lines as though the source program had beenlogically converted from fixed form to free form. (See 6.3, Logical conversion.)

b) After logical conversion, the equivalent free-form source program shall meet the requirements of free-formreference format, except that all characters of the computer's character set shall be retained in alphanumericliterals and comments. (See rule 3b.)

3) Free-form

a) The number of character positions on a line may vary from line to line, ranging from a minimum of 0 to amaximum of 255.

b) The implementor shall specify any control characters that terminate a free-form line, and whether suchcontrol characters may be specified in comments and the content of alphanumeric literals.

6.1 Fixed-form reference format

The format of a fixed-form reference format line is depicted in figure 1, Fixed-form source reference format.

Figure 1 — Fixed-form source reference format

Sequence Number Area Program-text AreaIndicator Area

MarginL

MarginC

MarginA

MarginR

1 2 3 4 5 6 7 8 9 10 11 12 13 .. .

Page 53: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Fixed-form reference format

36 6: Reference format

Margin L is immediately to the left of the leftmost character position of a line.

Margin C is between the 6th and 7th character positions of a line.

Margin A is between the 7th and 8th character positions of a line.

Margin R is immediately to the right of the rightmost character position of a line. The rightmost character position ofa line is a fixed number defined by the implementor.

The sequence number occupies six character positions (1-6), and is between margin L and margin C.

The indicator area is the 7th character position of a line.

The program-text area begins in character position 8 and terminates with the character position immediately to theleft of margin R.

6.1.1 Sequence numbers

The sequence number area may be used to label a source program line. The content of the sequence number area isdefined by the user and may consist of any character in the computer's character set. There is no requirement thatthe content of the sequence number area appears in any particular sequence or be unique.

6.1.2 Continuation of lines

Any sentence, entry, phrase, or clause may be continued by starting subsequent line(s) in the program-text area.These subsequent lines are called the continuation line(s). The line being continued is called the continued line. AnyCOBOL word, literal, or PICTURE character-string may be broken in such a way that part of it appears on acontinuation line. A compiler directive shall be contained entirely on one line. A compiler directive shall not bespecified between the lines of a continued character string.

NOTE 1 — Continuation of COBOL words is an archaic feature and its use should be avoided

A hyphen in the indicator area of a line indicates that the first nonblank character in the program-text area of thecurrent line is the successor of the last nonblank character of the preceding line, excluding intervening comment linesor blank lines without any intervening space. However, if the continued line contains an alphanumeric, boolean, ornational literal without a closing delimiter, the first nonblank character in the program-text area of the continuationline shall be a quotation symbol matching the quotation symbol used in the opening delimiter. The continuation startswith the character immediately after that quotation symbol. All spaces at the end of the continued line areconsidered part of the literal.

If there is no hyphen in the indicator area of a line, it is assumed that the first nonblank character in the line ispreceded by a space.

All characters composing any two-character or three-character separator shall be specified on the same line.

The implementor shall specify the rules for continuation of national literals in fixed-form reference format. The rulesmay include limits on the size of national literals and may specify that continuation is not supported.

NOTE 2 — Literals may be concatenated to achieve continuation.

Both characters composing the invocation operator, '::', shall be on the same line.

6.1.3 Blank lines

A blank line is one that is blank from margin C to margin R, inclusive. A blank line may appear anywhere in the sourceprogram. (See 6.1.2, Continuation of lines.)

Page 54: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Free-form reference format

6: Reference format 37

6.1.4 Comments

A comment may be a comment line or an in-line comment.

Any combination of characters from the computer’s character set may be included in a comment.

Comments shall be listed if a listing is being produced, but shall serve only as documentation and shall not be checkedsyntactically.

6.1.4.1 Comment lines

A comment line is any line with an asterisk or slant in the indicator area of the line. A comment line may be writtenas any line in a compilation-group or as any line in library text. The slant in the indicator area causes page ejectionprior to printing the comment line in the listing of the source program; an asterisk in the indicator area causes printingof the line at the next available line position in the listing.

6.1.4.2 In-line comments

The two contiguous COBOL characters ‘*>’ are a comment indicator. An in-line comment consists of a commentindicator followed by all successive character positions on the same line up to margin R, inclusive. An in-linecomment may be written in the program-text area on any line of a compilation-group or library text except on acompiler directive line, wherever a separator space may be written.

For purposes of evaluating library text, pseudo-text, and source text, an in-line comment shall have the value of aseparator space.

6.1.5 Debugging lines

A debugging line is any line with the debugging symbol, character 'D' or 'd', in the indicator area of the line. Anydebugging line that consists solely of spaces from margin A to margin R is considered the same as a blank line.Successive debugging lines may be specified.

A debugging line is permitted any place in the source unit after the SOURCE-COMPUTER paragraph.

Note — A debugging line is an obsolete element in this draft International Standard and is to be deleted from the next revisionof standard COBOL.

6.2 Free-form reference format

In free-form reference format, the text of the source program can be written anywhere on a line, except that thereare specific rules for comments, debugging lines, and continuation.

6.2.1 Continuation of lines

Any entry, sentence, statement, clause, phrase, or pseudo-text consisting of more than one character-string may becontinued by writing some of the character-strings and separators that constitute it on successive lines. The linebeing continued is called the continued line; subsequent lines are called continuation lines. The last nonblankcharacter of each line shall be treated as if it were followed by a space.

Alphanumeric literals, boolean literals, and national literals may be continued across lines. When such a literal isincomplete at the end of a line, the incomplete portion of the literal shall be terminated by a quotation symbolmatching the quotation symbol used in the opening delimiter, followed immediately by a hyphen. The hyphen mayoptionally be followed by one or more spaces, an in-line comment, or one or more spaces followed by an in-linecomment. The first nonblank character on the continuation line shall be a quotation symbol matching the quotationsymbol used in the opening delimiter; the first character after the quotation symbol shall be the beginning characterof the continuation of the literal. At least one character position in the content of the literal shall be specified on thecontinued line and each continuation line.

Page 55: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Free-form reference format

38 6: Reference format

All characters composing any two-character or three-character separator shall be specified on the same line. A pairof quotation symbols indicating a single quotation symbol within a literal shall be specified on the same line.

Comment lines and blank lines may be interspersed among lines containing the parts of a literal.

6.2.2 Blank lines

A blank line is one that contains nothing but space characters or is a line with zero character positions. A blank linemay appear anywhere in a compilation-group or library text.

Blank lines interspersed among lines containing the parts of a literal shall be listed if a listing is being produced, butshall have no effect on the meaning or compilation of the literal.

6.2.3 Comments

The two contiguous COBOL characters '*>' are a comment indicator. A comment consists of a comment indicatorfollowed by all successive character positions on the line. A comment terminates at the end of the line on which thecomment is written.

Any combination of characters from the computer's character set may be included in a comment, except as indicatedin 6, Reference format, rule 3b.

Comments shall be listed if a listing is being produced, but shall serve only as documentation and shall not be checkedsyntactically.

A comment may be a comment line or an in-line comment.

6.2.3.1 Comment lines

A comment preceded exclusively by zero, one, or more spaces on the line on which the comment is written is acomment line. A comment line may be written as any line in a compilation-group or as any line in library text.

Comment lines interspersed among lines containing the parts of a literal shall be listed if a listing is being produced,but shall have no effect on the meaning or compilation of the literal.

6.2.3.2 In-line comments

A comment preceded on a line by one or more COBOL words or character-strings immediately followed by one ormore separator spaces is an in-line comment. An in-line comment may be written wherever a separator space maybe written on any line of a compilation-group or library text except on a compiler directive line.

For purposes of evaluating library text, pseudo-text, and source text, an in-line comment shall have the value of aseparator space.

6.2.4 Debugging lines

The three contiguous COBOL characters '>>D' immediately followed by a space are a debugging indicator. Adebugging line consists of a debugging indicator, optionally preceded by one or more space characters, followed byall successive character positions on the line. A debugging line is terminated at the end of the line.

A debugging line may be written as any line in a source unit after the SOURCE-COMPUTER paragraph. Successivedebugging lines may be specified.

After all COPY and REPLACE statements have been processed, a debugging line shall have the characteristics of acomment line if the WITH DEBUGGING MODE clause is not specified in the SOURCE-COMPUTER paragraph.

The contents of a debugging line shall be such that a syntactically correct program is formed with or without thedebugging line.

Page 56: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Logical conversion

6: Reference format 39

Note — A debugging line is an obsolete element in this draft International Standard and is to be deleted from the next revisionof standard COBOL.

6.3 Logical conversion

Source text and library text in fixed-form reference format shall be logically converted at compile time to equivalentfree-form reference format, without the restriction of maximum line length.

NOTE — Fixed-form reference format is logically converted during compilation to free-form to simplify understanding of otherrules of the language, for example, the COPY statement with the REPLACING phrase and the REPLACE statement.

Logical conversion shall have the effect of taking place after the processing of the copy action of a COPY statementand before the replacing action of a COPY statement with the REPLACING phrase or of a REPLACE statement.

The rules given below shall be applied logically for each fixed-form line to produce a free-form line. For purposes ofthese rules, the character positions contained between margin A and margin R of a fixed-form source line aredesignated as "program-text" and retain this designation in the equivalent free-form source line.

1) If the indicator area of the fixed-form line contains a character 'D' or 'd', the equivalent free-form line shallcontain a debugging indicator in the first four character positions, followed by the program-text from thefixed-form line.

2) If the indicator area of the fixed-form line contains a hyphen, the equivalent free-form line shall contain a spacein character position one followed by the program-text from the fixed-form line. For purposes of this conversion,this free-form source line is a continuation line and the closest preceding free-form line that is not a commentline, a blank line, or a compiler directive is the continued line. Free-form continuation is completed as follows:

a) If the last character-string in the free-form continued line begins an alphanumeric, boolean, or national literalthat is not terminated by a closing delimiter, the free-form program-text in the continued line is appendedwith a closing delimiter, immediately followed by a hyphen.

b) Otherwise, the first character-string in the free-form continuation line is appended, with no interveningspace, to the last character-string in the program-text of the free-form continued line. The firstcharacter-string in the free-form continuation line is replaced with blanks.

3) If the indicator area of the fixed-form line contains an asterisk (*), the equivalent free-form line shall contain acomment indicator in the first two character positions followed by the program-text from the fixed-form line.

4) If the indicator area of the fixed-form line contains a slash (/), the equivalent free-form line shall contain a PAGEcompiler directive specifying as commentary the program-text from the fixed-form line.

5) Otherwise, the equivalent free-form line shall contain the program-text from the fixed-form line.

Thereafter, compilation continues with the logically equivalent free-form source.

The implementor shall define the effect on the source listing of the logical conversion of fixed-form source tofree-form source.

Page 57: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Compiler directing facility

40 7: Compiler directing facility

7 Compiler directing facility

The compiler directing facility controls the processing of a compilation group. It consists of compiler directingstatements for specifying source text manipulation and compiler directives for specifying compilation options.

7.1 Source text manipulation

Source text manipulation provides a facility to insert and replace source text as part of the compilation of acompilation group. Source text manipulation involves compiler directing statements and sentences, library textavailable to the compiler at compile time, and source text.

7.1.1 Source text manipulation elements

Language elements referenced and not defined in 7.1, Source text manipulation, have the meaning defined in 8,Language fundamentals.

7.1.1.1 Compiler directing statements and sentences

A compiler directing statement instructs the compiler to take a specific action during compilation. Compiler directingstatements in the source text manipulation facility are the COPY statement and the REPLACE statement.

A compiler directing sentence is a single compiler directing statement terminated by a separator period.

7.1.1.2 Source text and library text

Source text is the primary input to the compiler for a single compilation group. Library text is secondary input to thecompiler as a result of processing a COPY statement.

Source text manipulation processes source text and library text as a sequence of one or more character-strings,separators, and comments. Source text and library text enclosed within pseudo-text delimiters are processed aspseudo-text.

7.1.1.3 Pseudo-text

Pseudo-text may be any sequence of zero or more text-words, comments, and the separator space bounded by, butnot including, pseudo-text delimiters.

7.1.1.4 Text-words

A text-word is a character or a sequence of contiguous characters in COBOL source text, library text, or pseudo-textthat forms any of the following:

1) a separator, except for: a space; a pseudo-text delimiter; the opening and closing delimiters for alphanumeric,boolean, and national literals; and the right and left parentheses, regardless of their context; or

2) an alphanumeric, boolean, or national literal including the opening and closing delimiters that bound the literal; or

3) any other sequence of contiguous COBOL characters bounded by separators, except for: comments and theword 'COPY'.

Page 58: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)COPY statement

7: Compiler directing facility 41

7.1.2 COPY statement

The COPY statement incorporates library text into a COBOL compilation group.

7.1.2.1 General format

7.1.2.2 Syntax rules

1) A COPY statement may be specified anywhere in a compilation group that a character string or a separator, otherthan the closing delimiter of a literal, may appear except that a COPY statement shall not appear within a COPYstatement.

2) A COPY statement shall be preceded by a space except when it is the first statement in a compilation group.

3) A COPY statement shall be terminated by a separator period.

4) Within one COBOL library, each text-name shall be unique.

5) Literal-1 and literal-2 shall be alphanumeric literals and shall not be figurative constants. The allowable value ofliteral-1 and literal-2 is defined by the implementor.

6) Text-name-1 or literal-1 identifies the library text to be processed by the COPY statement.

7) Pseudo-text-1 shall contain one or more text-words.

8) Pseudo-text-2 shall contain zero, one, or more text-words.

9) Character-strings within pseudo-text-1 and pseudo-text-2 may be continued in accordance with the rules ofreference format.

10) Word-1 or word-2 may be any single COBOL word except 'COPY'.

11) The implementor shall allow a length from 1 through 322 character positions for a text-word within pseudo-textand within library text.

12) Pseudo-text-1 shall not consist entirely of a separator comma or a separator semicolon.

COPY literal-1text-name-1

OF

IN literal-2

library-name-1 [ SUPPRESS PRINTING ]

REPLACING

== pseudo-text-1 ==identifier-1literal-3word-1

BY

== pseudo-text-2 ==identifier-2literal-4word-2

LEADING

TRAILING

== partial-word-1 == BY == partial-word-2 ==

… .

Page 59: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)COPY statement

42 7: Compiler directing facility

13) Pseudo-text-1 and pseudo-text-2 may contain debugging lines. A debugging line is specified within pseudo-textif the debugging line begins in the source program after the opening pseudo-text delimiter but before thematching closing pseudo-text delimiter.

14) Compiler directive lines shall not be specified within pseudo-text-1, pseudo-text-2, partial-word-1, orpartial-word-2.

15) Partial-word-1 shall consist of one text-word.

16) Partial-word-2 shall consist of zero or one text-word.

17) An alphanumeric, boolean, or national literal shall not be specified as partial-word-1 or partial-word-2.

7.1.2.3 General rules

1) The compilation of a compilation group containing COPY statements is logically equivalent to processing allCOPY statements prior to the processing of the resultant compilation group.

2) If the SUPPRESS phrase is specified, library text incorporated as a result of COPY statement processing isnot listed. If a listing is being produced, the COPY statement itself is listed.

3) The syntactic correctness of library text cannot be independently determined. Except for COPY and REPLACEstatements, the syntactic correctness of a COBOL source unit cannot be determined until all applicable COPYand REPLACE statements have been completely processed.

4) Library text shall conform to the rules for COBOL reference format.

5) Debugging lines are permitted within library text.

6) The effect of processing a COPY statement is that the library text associated with text-name-1 or the value ofliteral-1 is copied into the source text, logically replacing the entire COPY statement beginning with the reservedword COPY and ending with the separator period, inclusive.

7) When library-name-1 or literal-2 is unspecified. The implementor shall define the rules for locating the librarytext referenced by text-name-1 or literal-1.

8) If the REPLACING phrase is not specified, the library text is copied unchanged.

9) If the REPLACING phrase is specified, the library text is copied and each matched occurrence of pseudo-text-1,identifier-1, word-1, literal-3, or partial-word-1 in the library text is replaced by the corresponding pseudo-text-2,identifier-2, word-2, literal-4, or partial-word-2.

10) For purposes of matching, identifier-1, word-1, and literal-3 are treated as pseudo-text containing onlyidentifier-1, word-1, or literal-3, respectively.

11) The comparison operation to determine text replacement occurs in the following manner:

a) The leftmost library text-word that is not a separator comma or a separator semicolon is the first text-wordused for comparison. Any text-word or space preceding this text-word is copied into the source text.Starting with the first text-word for comparison and first pseudo-text-1, identifier-1, word-1, literal-3, orpartial-word-1 that was specified in the REPLACING phrase, the entire REPLACING phrase operand thatprecedes the reserved word BY is compared to an equivalent number of contiguous library text-words.

b) Pseudo-text-1, identifier-1, word-1, or literal-3 match the library text only if the ordered sequence oftext-words that forms pseudo-text-1, identifier-1, word-1, or literal-3 is equal, character for character, to theordered sequence of library text-words. When the LEADING phrase is specified, partial-word-1 matches thelibrary text only if the contiguous sequence of characters that forms partial-word-1 is equal, character forcharacter, to the leading characters of the library text-word. When the TRAILING phrase is specified, partial-

Page 60: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)COPY statement

7: Compiler directing facility 43

word-1 matches the library text only if the contiguous sequence of characters that forms partial-word-1 isequal, character for character, to the trailing characters of the library text-word.

c) The following rules apply for the purpose of matching:

1. Each occurrence of a separator comma, semicolon, or space in pseudo-text-1 or in the library text isconsidered to be a single space. Each sequence of one or more space separators is considered to be asingle space.

2. Except for the content of literals, each alphanumeric character is equivalent to its corresponding nationalcharacter and each lowercase letter is equivalent to its corresponding uppercase letter, as specified forthe COBOL character set in 8.1.2, COBOL character set.

NOTE — A concatenation expression, for example "A" & "B", is recognized as three text-words for purposesof matching.

3. A compiler directive line in source text shall be considered a single text-word that does not match anytext-word within pseudo-text-1 or partial-word-1.

4. A debugging indicator shall be treated as if it did not appear in the line. Text-words within a debuggingline participate in the matching.

5. Comments or blank lines occurring in the source text and in pseudo-text-1 are ignored.

d) If no match occurs, the comparison is repeated with each next successive pseudo-text-1, identifier-1,word-1, literal-3, or partial-word-1, if any, in the REPLACING phrase until either a match is found or there isno next successive REPLACING operand.

e) When all the REPLACING phrase operands have been compared and no match has occurred, the leftmostlibrary text-word is copied into the source text. The next successive library text-word is then considered asthe leftmost library text-word, and the comparison cycle starts again with the first pseudo-text-1,identifier-1, word-1, literal-3, or partial-word-1 specified in the REPLACING phrase.

f) When a match occurs between pseudo-text-1, identifier-1, word-1, or literal-3 and the library text, thecorresponding pseudo-text-2, identifier-2, word-2, or literal-4 is placed into the source text. When a matchoccurs between partial-word-1 and the library text-word, the library text-word is placed into the source textwith the matched characters either replaced by partial-word-2 or deleted when partial-word-2 consists ofzero text-words. The library text-word immediately following the rightmost text-word that participated inthe match is then considered as the leftmost text-word. The comparison cycle starts again with the firstpseudo-text-1, identifier-1, word-1, literal-3, or partial-word-1 specified in the REPLACING phrase.

g) The comparison operation continues until the rightmost text-word in the library text has either participatedin a match or been considered as a leftmost library text-word and participated in a complete comparisoncycle.

12) If the REPLACING phrase is specified, the library text shall not contain a COPY statement and the source textthat results from processing the REPLACING phrase shall not contain a COPY statement.

13) The source text that results from the processing of a COPY statement shall be in logical free-form referenceformat. For purposes of compilation, text-words after replacement are placed in the resultant source text inaccordance with the rules of free-form reference format. When copying text-words of pseudo-text-2 into thesource text, additional spaces may be introduced only between text-words where there already exists a spaceor a space is assumed.

NOTE - A space is assumed at the end of a source line.

14) Comments or blank lines appearing in pseudo-text-2 are copied into the source text unchanged wheneverpseudo-text-2 is placed into the source text as a result of text replacement. Comments or blank lines appearingin library text are copied into the source text unchanged with the following exception: a comment or blank line

Page 61: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)COPY statement

44 7: Compiler directing facility

in library text is not copied if that comment or blank line appears within the sequence of text-words that matchpseudo-text-1.

15) If additional lines are introduced into the source text as a result of a COPY statement, each text-word introducedappears on a debugging line if the COPY statement begins on a debugging line or if the text-word beingintroduced appears on a debugging line in library text. When a text-word specified in the BY phrase is introduced,it appears on a debugging line if the first library text-word being replaced is specified on a debugging line. Exceptin the preceding cases, only those text-words that are specified on debugging lines where the debugging line iswithin pseudo-text-2 appear on debugging lines in the resultant source text. If any literal specified as literal-4or within pseudo-text-2 or library text is of a length too great to be accommodated on a single line withoutcontinuation to another line in the resultant source text and the literal is not being placed on a debugging line,additional continuation lines are introduced which contain the remainder of the literal. If replacement requiresthat the continued literal be continued on a debugging line, the program is in error.

16) If additional lines are introduced into the source text as the result of processing a REPLACING phrase of a COPYstatement, the indicator of the introduced lines shall be the same as the indicator appearing on the line at whichthe replaced text begins.

17) If the REPLACING phrase is not specified, the library text may contain a COPY statement that does not includea REPLACING phrase. The implementation shall support nesting of at least 5 levels, including the first COPYstatement in the sequence. Recursive copying of library text is not permitted; that is, the library text being copiedshall not cause the processing of a COPY statement that directly or indirectly copies itself.

Page 62: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)REPLACE statement

7: Compiler directing facility 45

7.1.3 REPLACE statement

The REPLACE statement is used to replace source text in a separately-compiled COBOL source unit.

7.1.3.1 General format

Format 1 (replacing):

Format 2 (off):

7.1.3.2 Syntax rules

1) A REPLACE statement may be specified anywhere in a compilation group that a character-string or a separator,other than a closing delimiter of a literal, may appear.

2) A REPLACE statement shall be preceded by a space except when it is the first statement in a compilation group.

3) A REPLACE statement shall be terminated by a separator period.

4) Pseudo-text-1 shall contain one or more text-words.

5) Pseudo-text-2 shall contain zero, one, or more text-words.

6) Partial-word-1 shall consist of one text-word.

7) Partial-word-2 shall consist of zero or one text-word.

8) An alphanumeric, boolean, or national literal shall not be specified as partial-word-1 or partial-word-2.

9) Character-strings within pseudo-text-1 and pseudo-text-2 may be continued in accordance with the rules ofreference format.

10) The implementor shall allow a length from 1 through 322 character positions for a text-word within pseudo-text.

11) Pseudo-text-1 shall not consist entirely of a separator comma or a separator semicolon.

12) Pseudo-text-1 and pseudo-text-2 may contain debugging lines.

13) Compiler directive lines shall not be specified within pseudo-text-1, pseudo-text-2, partial-word-1, orpartial-word-2.

7.1.3.3 General Rules

1) Except for COPY and REPLACE statements, the syntactic correctness of a source unit cannot be determined untilafter all applicable COPY and REPLACE statements have been completely processed.

2) Pseudo-text-1 specifies the source text to be replaced by pseudo-text-2.

REPLACE [ ALSO ]

== pseudo-text-1 == BY == pseudo-text-2 ==

LEADING

TRAILING

== partial-word-1 == BY == partial-word-2 ==

… .

REPLACE [ LAST ] OFF .

Page 63: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)REPLACE statement

46 7: Compiler directing facility

3) Partial-word-1 specifies the source text to be replaced by partial-word-2.

4) A given REPLACE statement is in effect from the point at which it is specified until the next occurrence of aREPLACE statement without the ALSO phrase or the end of the separately-compiled program is reached.

5) Any REPLACE statements contained in a source unit are processed after the processing of any COPY statementscontained in that source unit.

6) The comparison operation to determine text replacement occurs in the following manner:

a) Starting with the leftmost source text-word and the first pseudo-text-1 or partial-word-1, pseudo-text-1 orpartial-word-1 is compared to an equivalent number of contiguous source text-words.

b) Pseudo-text-1 matches the source text if, and only if, the ordered sequence of text-words that formspseudo-text-1 is equal, character for character, to the ordered sequence of source text-words. When theLEADING phrase or TRAILING phrase is specified, partial-word-1 matches the source text-word if, and onlyif, the contiguous sequence of characters that forms partial-word-1 is equal character for character to theleading or trailing characters, respectively, of that source text-word.

c) The following rules apply for the purpose of matching:

1. Each occurrence of a separator comma, semicolon, or space in pseudo-text-1 or in the source text isconsidered to be a single space. Each sequence of one or more space separators is considered to be asingle space.

2. Except for the content of literals, each alphanumeric character is equivalent to its corresponding nationalcharacter and each lowercase letter is equivalent to its corresponding uppercase letter, as specified forthe COBOL character set in 8.1.2, COBOL character set.

NOTE — A concatenation expression, for example "A" & "B", is recognized as three text-words for purposesof matching.

3. A compiler directive line in source text shall be considered a single text-word that does not match anytext-word within pseudo-text-1 or partial-word-1.

4. A debugging indicator shall be treated as if it did not appear in the line.

5. Comments or blank lines occurring in source text and in pseudo-text-1 are ignored.

d) If no match occurs, the comparison is repeated with each next successive occurrence of pseudo-text-1 orpartial-word-1, until either a match is found or there is no next successive occurrence of pseudo-text-1 orpartial-word-1.

e) When all occurrences of pseudo-text-1 or partial-word-1 have been compared and no match has occurred,the next successive source program text-word is then considered as the leftmost source program text-word,and the comparison cycle starts again with the first occurrence of pseudo-text-1 or partial-word-1.

f) When a match occurs between pseudo-text-1 and the source text, the corresponding pseudo-text-2 replacesthe matched text in the source text. When a match occurs between partial-word-1 and the sourcetext-word, the matched characters of that source text-word are either replaced by partial-word-2 or deletedwhen partial-word-2 consists of zero text-words. The source text-word immediately following the rightmosttext-word that participated in the match is then considered as the leftmost source text-word. Thecomparison cycle starts again with the first occurrence of pseudo-text-1 or partial-word-1.

g) The comparison operation continues until the rightmost text-word in the source text that is within the scopeof the REPLACE statement has either participated in a match or been considered as a leftmost sourcetext-word and participated in a complete comparison cycle.

Page 64: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)REPLACE statement

7: Compiler directing facility 47

7) The text produced as a result of the processing of a REPLACE statement shall contain neither a COPY statementnor a REPLACE statement.

8) The source text that results from the processing of a REPLACE statement shall be in logical free-form referenceformat. Text-words inserted into the source text as a result of processing a REPLACE statement are placed inaccordance with the rules of free-form reference format. When inserting text-words of pseudo-text-2 into thesource text, additional spaces may be introduced only between text-words where there already exists a spaceor a space is assumed.

NOTE — A space is assumed at the end of a source line.

9) Comments or blank lines in pseudo-text-2 are placed into the source text unchanged whenever pseudo-text-2 isplaced into the source text as a result of text replacement. A comment or a blank line in source text shall notbe placed into the resultant source text if that comment or blank line appears within the sequence of text-wordsthat match pseudo-text-1.

10) If a REPLACE statement is specified on a debugging line, the source text that is the result of processing theREPLACE statement shall be on a debugging line.

11) If any literal within pseudo-text-2 is of a length too great to be accommodated on a single line withoutcontinuation to another line in the resultant source text and the literal is not being placed on a debugging line,additional continuation lines are introduced which contain the remainder of the literal. If replacement requiresthe continued literal to be continued on a debugging line, the program is in error.

12) If the ALSO phrase is present in a format 1 REPLACE statement, the result is as follows:

a) If no REPLACE statement is in effect, the statement has the same result as one without the ALSO phrase.

b) If an earlier REPLACE statement is in effect, the result is the same as if a single REPLACE statement werewritten, without the ALSO phrase, having as its operands all the operands of the current REPLACE statementfollowed by all the operands of the earlier REPLACE statement.

13) The effect of a format 2 REPLACE statement without the LAST phrase is to cancel all format 1 REPLACEstatements currently in effect.

14) The effect of the LAST phrase in a format 2 REPLACE statement is to cancel the effect of the most recentuncancelled format 1 REPLACE statement, so that any text replacement that was in effect before the format 1REPLACE statement is restored. If there is no such format 1 REPLACE statement, the format 2 REPLACEstatement has no effect.

Page 65: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Compiler directives

48 7: Compiler directing facility

7.2 Compiler directives

A compiler directive specifies options or constants for use by the compiler.

7.2.1 General format

7.2.2 Syntax rules

1) A compiler directive shall be specified on one line, except for the EVALUATE and the IF directives for whichspecific rules are specified.

2) A compiler directive shall be preceded only by zero, one, or more space characters.

3) When the reference format is fixed form, a compiler directive shall be specified in the program-text area and maybe followed only by space characters.

4) When the reference format is free form, a compiler directive may be followed only by space characters and anoptional in-line comment.

5) A compiler directive is composed of the two contiguous COBOL characters >>, optionally followed by the COBOLcharacter space, followed by compiler-instruction.

6) Compiler-instruction is composed of the compiler-directive words defined in the specific syntax for eachdirective.

7) A compiler-directive word is reserved within the context of the compiler directive in which it is specified and maybe used elsewhere as any type of COBOL word.

8) A compiler directive may be specified anywhere in a compilation-group except

a) as restricted by the rules for the specific compiler directive,

b) within a source text manipulation statement,

c) between the lines of a continued character string,

d) on a debugging line.

9) Compiler directive lines may be specified within library text.

10) The compiler-directive word "IMP" shall be reserved for use by the implementor. If the implementor defines theIMP directive, the syntax rules for that directive shall be implementor-defined.

NOTE — >>IMP provides an optional place holder for all current and future implementor-defined directives. In this waythe implementor can optionally support the use of >>IMP to indicate the start of one or more implementor-defineddirectives.

7.2.3 General rules

1) A compiler directive shall be treated as a single blank line during the matching operation of a COPY or REPLACEstatement. A directive will not match any pseudo-text or partial-word and therefore will not be affected by thereplacing action.

2) A compiler directive shall be processed before, during, and after the processing of COPY and REPLACEstatements as indicated in the specific rules for each directive.

>>compiler-instruction

Page 66: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Conditional compilation

7: Compiler directing facility 49

3) If the implementor defines the IMP directive, the general rules for that directive shall be implementor-defined.

7.2.4 Conditional compilation

The use of certain compiler directives provides a means of including or omitting selected lines of source code. Thisis called conditional compilation. The compiler directives that are used for conditional compilation are the CONSTANTdirective, the EVALUATE directive, and the IF directive. The CONSTANT directive is used to define constants thatare referenced in the EVALUATE and IF directive in order to select lines of code that are to be compiled or are to beomitted during compilation.

7.2.5 Constant conditional expression

A constant conditional expression is a conditional expression in which all the operands are literals or arithmeticexpressions containing only literal terms. A special form of condition known as a defined condition may also be usedas part of a constant conditional expression.

7.2.5.1 Syntax rules

1) A constant conditional expression shall be one of the following:

a) A simple relation condition in which both sides are either literals or arithmetic expressions containing onlyliteral terms;

b) A defined condition;

c) A complex condition formed by combining the above two forms of simple conditions into complex conditionsas described in 8.8.4.2, Complex conditions. Abbreviated combined relation conditions are not allowed.

7.2.5.2 General rules

1) Any arithmetic expression specified in a constant conditional expression is evaluated following the normalprecedence rules. After each operation the result is truncated to the integer part of the value. The resultantvalue is considered to be an integer.

7.2.5.3 Defined condition

7.2.5.3.1 General format

7.2.5.3.2 General rules

1) A defined condition using the IS DEFINED syntax evaluates TRUE if constant-name-1 has previously been definedby a CONSTANT directive.

2) A defined condition using the IS NOT DEFINED syntax evaluates TRUE if constant-name-1 has not previouslybeen defined by a CONSTANT directive.

constant-name-1 IS [ NOT ] DEFINED

Page 67: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)CONSTANT directive

50 7: Compiler directing facility

7.2.6 CONSTANT directive

The CONSTANT directive specifies a symbolic name for a particular literal value. This name may then be used in aconstant conditional expression or an EVALUATE directive.

7.2.6.1 General format

7.2.6.2 Syntax rules

1) Literal-1 may be of any category and shall not be a figurative constant.

2) The operands of arithmetic-expression-1 shall be numeric literals or arithmetic expressions containing onlynumeric literals.

3) If a CONSTANT directive specifies neither the OFF nor the OVERRIDE phrase, then either

— constant-name-1 shall not have been declared previously within the same compilation group; or

— the last previous CONSTANT directive referring to constant-name-1 shall have been specified with the OFFphrase; or

— the last previous CONSTANT directive referring to constant-name-1 shall have specified the same value.

7.2.6.3 General rules

1) The CONSTANT directive is processed during the processing of COPY and REPLACE statements.

2) Arithmetic-expression-1 is evaluated in accordance with the order of precedence specified in 8.8.1.1, Nativeand standard arithmetic. After each operation, the result is truncated to the integer part of the value. Theresultant value is considered to be an integer.

3) Following the declaration of constant-name-1, constant-name-1 may be used in the compilation group in allcontexts where a literal of its class is permitted.

4) Following a CONSTANT directive in which the OFF phrase is used, constant-name-1 can no longer be used. Theeffect is as if the CONSTANT directive had not been specified for constant-name-1.

5) If the OVERRIDE phrase is specified, the effect is as if the following directives were specified:

>>CONSTANT constant-name-1 OFF>>CONSTANT constant-name-1 new-value

where constant-name-1 is the same constant-name specified in the directive with the OVERRIDE phrase andnew-value is the literal-1 or arithmetic-expression-1 specified in the directive with the OVERRIDE phrase.

>> CONSTANT constant-name-1 ISliteral-1arithmetic-expression-1

OVERRIDE [ ]

OFF

Page 68: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)EVALUATE directive

7: Compiler directing facility 51

7.2.7 EVALUATE directive

The EVALUATE directive provides for multi-branch conditional compilation.

7.2.7.1 General format

Format 1

Format 2

7.2.7.2 Syntax rules

ALL FORMATS

1) Source-lines-1, source-lines-2, and each pair of contiguous COBOL characters >> shall be specified on a new linepreceded only by zero, one or more space characters. The portion of the directive that follows shall be specifiedon that same line until source-lines-1, source-lines-2, or the next pair of contiguous COBOL characters >> areencountered, except that source-lines-1 and source-lines-2 may be specified on more than one line.

2) Source-lines-1 and source-lines-2 may be any kind of source lines, including directives.

FORMAT 1

3) The operands of arithmetic-expression-1, arithmetic-expression-2, and arithmetic-expression-3 shall be numericliterals or arithmetic expressions containing only numeric literals.

4) The words THROUGH and THRU are equivalent.

7.2.7.3 General rules

ALL FORMATS

1) The EVALUATE directive is processed during the processing of COPY and REPLACE statements.

>> EVALUATE literal-1arithmetic-expression-1

>> WHEN literal-2arithmetic-expression-2

THROUGH

THRU literal-3

arithmetic-expression-3 source-lines-1 [ ]

>> WHEN OTHER source-lines-2 [ ][ ]

>> END-EVALUATE

>> EVALUATE TRUE

{ >>WHEN constant-conditional-expression-1 [ source-lines-1 ] } ...

>> WHEN OTHER source-lines-2 [ ][ ]

>> END-EVALUATE

Page 69: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)EVALUATE directive

52 7: Compiler directing facility

FORMAT 1

2) Arithmetic-expression-1, arithmetic-expression-2, and arithmetic-expression-3 are evaluated in accordance withthe order of precedence specified in 8.8.1.1, native and standard arithmetic. After each operation, the result istruncated to the integer part of the value. The resultant value is considered to be an integer.

3) Literal-1 or arithmetic-expression-1, referred to as the selection subject, is compared against the values specifiedin each WHEN phrase in turn as follows:

If the THROUGH phrase is not specified, a TRUE result is returned if the selection subject is equal to literal-2 orarithmetic-expression-2.

If the THROUGH phrase is specified, a TRUE result is returned if the selection subject lies in the inclusive rangedetermined by literal-2 or arithmetic-expression-2 and literal-3 or arithmetic-expression-3.

As soon as a WHEN phrase is found that yields a TRUE result, the associated source-lines-1 are compiled andall remaining lines up to and including the >>END-EVALUATE line are ignored. If no WHEN phrase yields a TRUEresult, the source-lines-2 associated with the >>WHEN OTHER phrase, if specified, are compiled.

FORMAT 2

4) For each WHEN phrase in turn, the constant-conditional-expression is evaluated.

As soon as a WHEN phrase is found that yields a TRUE result, the associated source-lines-1 are compiled andall remaining lines up to and including the >>END-EVALUATE line are ignored. If no WHEN phrase yields a TRUEresult, the source-lines-2 associated with the >>WHEN OTHER phrase, if specified, are compiled.

Page 70: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)EXTENDED-LETTERS directive

7: Compiler directing facility 53

7.2.8 EXTENDED-LETTERS directive

The EXTENDED-LETTERS directive identifies a character set and instructs the compiler to include the letters of thatcharacter set, other than the basic letters, as extended letters of the COBOL character set. Extended letters may beused in forming user-defined words.

7.2.8.1 General format

7.2.8.2 Syntax rules

1) The EXTENDED-LETTERS directive may be specified only once for a compilation-group and, when specified, shallappear before the first statement of that compilation-group and before any COPY or REPLACE statements.

2) The implementor shall specify any names of character sets that may be specified as implementor-charset-1 inthe EXTENDED-LETTERS compiler directive.

NOTE — Use of this directive allows the programmer to use more meaningful names; however, the program may not beportable across implementations or countries.

7.2.8.3 General rules

1) The EXTENDED-LETTERS directive shall be processed before any COPY and REPLACE statements.

2) The EXTENDED-LETTERS directive shall apply to the entire text of the compilation-group for which theEXTENDED-LETTERS directive is specified, including any text generated or incorporated as the result ofprocessing any COPY or REPLACE statements.

3) Implementor-charset-1 identifies a character set specified by the implementor. The implementor shall specifythe characters that constitute letters in the character set referenced by implementor-charset-1, the uppercaseand lowercase attributes of letters, and the correspondence between uppercase and lowercase letters.

4) The letters from the specified character set, excluding the basic letters of the COBOL character set, shallconstitute the set of extended letters in the COBOL character set for the compilation-group for which theEXTENDED-LETTERS directive is specified.

5) If the EXTENDED-LETTERS directive is not specified, the set of extended letters in the COBOL character set shallbe empty.

>> EXTENDED-LETTERS cultural-repertoire-1implementor-charset-1

Page 71: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)FLAG-85 directive

54 7: Compiler directing facility

7.2.9 FLAG-85 directive

The FLAG-85 directive specifies options to flag syntax that might be incompatible between the previous COBOLstandard and the current COBOL standard.

7.2.9.1 General format

7.2.9.2 General rules

1) The FLAG-85 directive shall be processed after any COPY and REPLACE statements.

2) If ON is explicitly or implicitly specified, the implementor shall provide a warning mechanism that flags theincompatibilities potentially affecting existing programs for the selected option, where the incompatibility isbetween the specifications in ISO 1989:1985, including ISO 1989:1985/Amd.1:1992 and ISO 1989:1985/Amd2:1994, and this international standard. The warning mechanism is enabled for the next statement or clausethat follows the specification of this directive and remains enabled for all source text that follows until the endof the compilation group or until a FLAG-85 directive specifying ALL OFF or specifying an option that matchesthe option that is specified in this directive is encountered.

3) If OFF is specified, flagging for the selected option or options is disabled.

4) The word or words following FLAG-85 indicate the syntax to be diagnosed:

a) ALL: All of the options apply.

b) DIVIDE: In a DIVIDE statement with the REMAINDER phrase, if the quotient data item is not described witha sign (there is no S in the PICTURE clause) and either the divisor or dividend is described with a sign, theDIVIDE statement shall be flagged.

c) MOVE: If an alphanumeric literal or data item is moved to a numeric data item and the number of charactersin the alphanumeric literal or data item is greater than 31, the MOVE statement shall be flagged.

d) NOT SIZE: If a NOT SIZE ERROR phrase is specified for a statement and there is no SIZE ERROR phrase forthe same statement, the statement shall be flagged.

e) RECORD AREA: If the number of character positions in the largest record area described for a file is lessthan the maximum specified in the RECORD clause specified for the file, the RECORD clause shall be flagged.

5) If the FLAG-85 directive is not specified, the default for all options is off.

>> FLAG-85

ALL

DIVIDE

MOVE

NOT SIZE

RECORD AREA

ONOFF

Page 72: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)IF directive

7: Compiler directing facility 55

7.2.10 IF directive

The IF directive provides for 1 or 2-way conditional compilation.

7.2.10.1 General format

7.2.10.2 Syntax rules

1) Source-lines-1, source-lines-2, and each pair of contiguous COBOL characters >> shall be specified on a new linepreceded only by zero, one or more space characters. The portion of the directive that follows shall be specifiedon that same line until source-lines-1, source-lines-2, or the next pair of contiguous COBOL characters >> areencountered, except that source-lines-1 and source-lines-2 may be specified on more than one line.

2) Source-lines-1 and source-lines-2 may be any kind of source lines, including directives

7.2.10.3 General rules

1) The IF directive is processed during the processing of COPY and REPLACE statements.

2) If constant-conditional-expression-1 evaluates to TRUE, then source-lines-1 are compiled as part of the COBOLsource program, and source-lines-2 are ignored.

3) If constant-conditional-expression-1 evaluates to FALSE, the source-lines-1 are ignored and source-lines-2, ifspecified, are compiled as part of the COBOL source program.

>> IF constant-conditional-expression-1 source-lines-1 [ ]

>> ELSE source-lines-2 [ ][ ]

>> END-IF

Page 73: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)LISTING directive

56 7: Compiler directing facility

7.2.11 LISTING directive

The LISTING directive instructs the compiler to turn the source text listing on or off.

7.2.11.1 General Format

7.2.11.2 General Rules

1) Whether the compiler produces a source listing is implementor defined. If the compiler does not produce a sourcelisting, the LISTING directive shall be ignored. Otherwise, the following general rules apply.

2) LISTING directives shall be processed after the processing of COPY and REPLACE statements.

3) Each LISTING directive shall be listed, even if the listing is being suppressed by a LISTING directive.

4) If OFF is specified, source text lines, except another LISTING OFF directive, shall not be listed until a LISTINGdirective with ON specified or implied is processed.

5) If ON is specified or implied, source text lines shall be listed until either a LISTING directive specifying OFF isprocessed or the end of the sequence of source programs is reached.

>>LISTING ONOFF

Page 74: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)PAGE directive

7: Compiler directing facility 57

7.2.12 PAGE directive

The PAGE directive specifies page ejection and provides documentation for the source listing.

7.2.12.1 General format

7.2.12.2 Syntax rules

1) Comment-text-1 may contain any character in the computer's character set except for control characters asspecified in 6, Reference format, rule 3b.

2) Comment-text-1 is not checked syntactically.

7.2.12.3 General rules

1) Comment-text-1 shall serve only as documentation.

2) If a source listing is being produced, a PAGE directive shall cause page ejection followed by listing of the PAGEdirective.

3) If a source listing is not being produced, a PAGE directive shall have the characteristics of a blank line.

>>PAGE comment-text-1 [ ]

Page 75: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)PROPAGATE directive

58 7: Compiler directing facility

7.2.13 PROPAGATE directive

The PROPAGATE directive is used to cause propagation of exception conditions to a calling program or invokingmethod.

7.2.13.1 General format

7.2.13.2 Syntax rules

1) The PROPAGATE directive shall be specified before the first identification division of a separately-compiledsource unit.

7.2.13.3 General rules

1) When the ON phrase is specified or implied, automatic propagation of exception conditions becomes enabled forfunctions, methods, and programs that follow in the source text. Automatic propagation remains enabled untila PROPAGATE directive specifying the OFF phrase is encountered or the end of the compilation group is reached.

2) During execution of a source unit for which automatic propagation of exception conditions is enabled, anyexception condition raised and not handled by either an exception phrase or a declarative in that source unit shallbe propagated:

a) from a called program, as though an EXIT PROGRAM RAISING LAST statement were executed in adeclarative for that exception condition.

b) from an invoked method, as though an EXIT METHOD RAISING LAST statement were executed in adeclarative for that exception condition.

3) When the OFF phrase is specified, automatic propagation of exception conditions becomes disabled and remainsdisabled for subsequent source units that follow in the source text until a PROPAGATE directive specifying theON phrase is encountered.

4) The default for a compilation group is PROPAGATE OFF.REPOSITORY directiveREPOSITORY directive

>>PROPAGATE ONOFF

Page 76: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)REPOSITORY directive

7: Compiler directing facility 59

7.2.14 REPOSITORY directive

The REPOSITORY directive specifies whether information is added to the external repository. It also specifieswhether prototypes and definitions are checked against the interface information in the external repository .

7.2.14.1 General format

7.2.14.2 Syntax rules

1) The REPOSITORY directive shall be specified only before the first identification division of a compilation unit andshall not be specified within a compilation unit.

2) The REPOSITORY directive applies to the remainder of the compilation group or until another REPOSITORYdirective is encountered.

7.2.14.3 General rules

1) The default REPOSITORY directive is:

>>REPOSITORY UPDATE OFF WITH CHECKING.

2) If the ON phrase is specified explicitly or implicitly, the information for a compilation unit is added to the externalrepository before the next compilation unit is compiled or at the end of the compilation group if there is no nextcompilation unit.

3) If the OFF phrase is specified, the external repository is not updated by the compiler.

4) If the CHECKING phrase is specified, the implementor shall provide a warning mechanism that flags aprogram-prototype, function-prototype, program-definition, function-definition, class-definition, or interface-definition that differs from the information about that source unit in the external repository. Details on theinformation in the external repository are specified in 10.3, External repository.

>>REPOSITORY UPDATE ONOFF [ WITH CHECKING ]

Page 77: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)SOURCE FORMAT directive

60 7: Compiler directing facility

7.2.15 SOURCE FORMAT directive

The SOURCE FORMAT directive specifies whether the reference format of the source text that follows is fixed formor free form.

7.2.15.1 General format

7.2.15.2 General rules

1) The SOURCE FORMAT directive indicates that the source text or library text following the directive andcontinuing through a subsequent SOURCE FORMAT directive shall be treated as fixed form if FIXED is specified,or as free form if FREE is specified. (See 6.1, Fixed-form reference format, and 6.2, Free-form reference format.)

2) The default reference format of a compilation-group is fixed form.

3) The default reference format of library text is the reference format that was in effect for the terminating periodof the COPY statement that resulted in processing of this library text.

4) The first SOURCE FORMAT directive in source text or library text may be in either fixed form or free form.

5) If a SOURCE FORMAT directive is specified in library text, the specified format shall be in effect until anotherSOURCE FORMAT directive is encountered or the end of the library text is reached. When the processing of thatlibrary text is completed, the reference format shall revert to the format in effect for the terminating period ofthe COPY statement that resulted in processing of that library text.

>>SOURCE FORMAT ISFIXED

FREE

Page 78: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)TURN directive

7: Compiler directing facility 61

7.2.16 TURN directive

The TURN directive is used to turn checking for certain exception conditions on or off.

7.2.16.1 General format

7.2.16.2 Syntax rules

1) A TURN directive may be specified anywhere in a source program that a statement may be specified.

2) Exception-name-1 shall be one of the exception condition names listed in 14.7.9.2, Exception conditions.

NOTE — There is no verification that a user-defined exception-name or a file-name specified in a TURN directive is actuallyused within the range of the TURN directive. An exception object is always enabled.

3) No exception-name shall be specified more than once in one TURN directive.

4) No file-name shall be specified more than once for one exception condition.

7.2.16.3 General rules

1) The default TURN directive is '>>TURN EC-ALL CHECKING OFF'.

2) If exception-name-1 EC-ALL is specified, the effect is as if the same TURN directive were specified containingall exception-names.

3) If exception-name-1 is one of the level-2 exception-names, the effect is as if the same TURN directive werespecified containing all exception-names that are subordinate to that level-2 exception-name. If file-name-1 isspecified, the effect is as if file-name-1 were specified for each of these exception-names.

4) If the ON phrase is specified or implied, checking for the exception condition associated with exception-name-1is enabled for the source text that follows. It remains enabled until another TURN directive for exception-name-1with the OFF phrase is encountered in the source text. If file-name-1 is specified, checking is enabled only forexception conditions associated with that file-name.

5) If the LOCATION phrase is specified, all information necessary to identify a source statement for theEXCEPTION-LOCATION and EXCEPTION-STATEMENT functions is made available to the run unit. If theLOCATION phrase is not specified, the implementor shall specify whether this information is made available ornot.

6) If the OFF phrase is specified, checking for the exception condition associated with exception-name-1 is disabledfor the source text that follows. It remains disabled until another TURN directive for exception-name-1 with theON phrase is encountered. If file-name-1 is specified, checking is disabled only for exception conditionsassociated with that file-name.

>>TURN

exception-name-1

EC-I-O file-name-1 [ ] …

EC-I-O-AT-END file-name-1 [ ] …

EC-I-O-INVALID-KEY file-name-1 [ ] …

EC-I-O-PERMANENT-ERROR file-name-1 [ ] …

EC-I-O-LOGIC-ERROR file-name-1 [ ] …

EC-I-O-IMP file-name-1 [ ] …

… CHECKING ON WITH LOCATION[ ]

OFF

Page 79: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Language fundamentals

62 8: Language fundamentals

8 Language fundamentals

8.1 Character sets

The basic unit of the COBOL language specification is the character. COBOL syntax is described using the COBOLcharacter set, which is a set of characters independent of their encoding. Comments and the content of certainclasses of literals in the source program and the content of certain classes of data items are represented in a codedcharacter set -- the computer's character set. Additional coded character sets, called alphabets, may be defined ina source program for representation of data on external media.

8.1.1 Computer's character set

The computer's character set is used to represent comments and the content of alphanumeric and national literals inthe source program and to represent the content of alphabetic, alphanumeric, and national data items.

The computer's character set at execution time is also referred to as the native character set. A computer shall havea native alphanumeric character set and a native national character set. The implementor shall specify the supportednative character sets.

8.1.2 COBOL character set

The COBOL character set is used to represent COBOL words, separators, and the content of hexadecimal literals ina COBOL source program. The COBOL character set consists of the basic letters, basic digits, basic specialcharacters, and extended letters as shown in table 1, COBOL character set.

Table 1 — COBOL character set

Description Character Meaning

Basic letters A, B, ... Za, b, ... z

upper-case letters in ISO/IEC 646lower-case letters in ISO/IEC 646

Basic digits 0, 1, ... 9 digits

Basic special character +–*/

=$,;."'()

><&:_

spaceplus signminus sign (hyphen)asteriskslant (slash, solidus)equal signdollar signcommasemicolonperiod (decimal point, full stop)quotation markapostropheleft parenthesisright parenthesisgreater than less than ampersandcolonunderscore

Extended letters additional characters used to form user-defined words as specified by the EXTENDED-LETTERS compiler directive

Page 80: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Alphabets

8: Language fundamentals 63

8.1.2.1 General rules

1) The implementor shall define a mapping of the basic letters, basic digits, and basic special characters of theCOBOL character set to the coded character sets supported by the implementation for compilation of sourceunits. The implementor shall map the COBOL character set to at least one alphanumeric coded character setand one national coded character set, and shall define a correspondence between the basic letters, basic digits,and basic special characters of the alphanumeric and national coded character sets.

2) Within a compilation group, COBOL characters may be represented in either an alphanumeric coded characterset or a national coded character set or both. The following rules apply:

a) Except when used in some alphanumeric literal formats and except for some picture symbols, eachlowercase COBOL basic letter is equivalent to its corresponding uppercase COBOL basic letter, if any.

b) Each basic letter, basic digit, and basic special character represented in the alphanumeric character set isequivalent to its corresponding basic letter, basic digit, and basic special character represented in thenational character set, respectively.

3) Rules for extended letters are addressed in 7.2.8, EXTENDED-LETTERS directive.

4) When an implementation does not provide a graphic representation of all characters of the COBOL character set,substitute graphics may be specified by the implementor to replace the characters not represented.

8.1.3 Alphabets

Alphabets in COBOL are named specifications of coded character sets and collating sequences. TheSPECIAL-NAMES paragraph provides the means for naming alphabets and for specifying user-defined codedcharacter sets and collating sequences. A coded character set or collating sequence can be used by specifying itsalphabet-name in COBOL statements or entries that reference a coded character set or collating sequence as anoperand.

Page 81: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Locales

64 8: Language fundamentals

8.2 Locales

A locale provides a specification of cultural elements for use at run time. Cultural elements are grouped into namedlocale-categories that control specific aspects of run time behavior, as follows:

Locale-category name Behavior affected

LC_COLLATE Collation sequenceLC_CTYPE Character classification and case conversionLC_MESSAGES Formats of informative and diagnostic messages and interactive responsesLC_MONETARY Monetary formattingLC_NUMERIC Numeric formattingLC_TIME Date and time formatsLC_ALL Locale-categories LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY,

LC_NUMERIC, and LC_TIME, and any other categories included in the locale.

When the use of cultural elements from a locale is specified for a source unit, the specific values, formats, oralgorithms associated with the locale categories are determined at run time.

At the time a run unit is activated, the current runtime locale is set to the system default locale and remains in effectuntil another runtime locale is established. The SET statement provides the capability of establishing any locale asthe current runtime locale, as well as the ability to set the user default locale to any locale.

Execution of a SET statement specifying the USER-DEFAULT phrase sets the current runtime locale to the userdefault locale. The implementor shall specify the manner in which the user default locale is defined and shall provideat least one user default locale for use in computing environments that do not provide a user default locale.

Execution of a SET statement specifying the SYSTEM-DEFAULT phrase sets the current runtime locale to the currentsystem default locale. The implementor shall specify the manner in which the system default locale is defined andshall provide at least one system default locale for use in computing environments that do not provide a systemdefault locale.

NOTES

1. If the user has the capability of switching the user default locale or the system default locale during the execution of a rununit, the default obtained by the SET statement is the one in existence at the time of the execution of the SET statement. Achanged default locale is not utilized by COBOL unless a SET statement is executed to make it the current runtime locale.

2. The capability of setting the user default and system default locale from COBOL is not provided.

A single locale is current at any given time. The manner of identifying the current locale is specified in 14.7.4, Localeidentification.

The locale-category LC_MESSAGES is not used directly by COBOL; however, the ability to SET and query theLC_MESSAGES locale-category is provided so that applications may use it.

The set of cultural elements constituting LC_ALL may include categories and cultural elements not used by COBOL.The details of locale-categories are specified in ISO/IEC 9945-2. The implementor shall ensure that a mechanismexists for specifying the cultural elements used by COBOL in a locale.

Page 82: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Lexical elements

8: Language fundamentals 65

8.3 Lexical elements

The individual characters of the language are concatenated to form character-strings and separators. A separatormay be concatenated with another separator or with a character-string. A character-string may only be concatenatedwith a separator. The concatenation of character-strings and separators forms the text of a source program.

8.3.1 Character-strings

A character-string is a character or a sequence of contiguous characters that forms a COBOL word, a literal, or aPICTURE character-string. A character-string is delimited by separators.

8.3.1.1 COBOL words

A COBOL word is a character-string of not more than 31 characters that forms a compiler-directive word, acontext-sensitive word, an exception-name, an intrinsic-function-name, a reserved word, a system-name, or auser-defined word. Each character of a COBOL word that is not a special character word shall be selected from theset of basic letters, basic digits, extended letters, and the basic special characters hyphen and underscore. Thehyphen or underscore shall not appear as the first or last character in such words.

Within a source program the following apply:

1) For all COBOL words excluding the words INTEGER, LENGTH, RANDOM, and SUM:

a) Reserved words form disjoint sets with context-sensitive words, intrinsic-function-names, system-names,and user-defined words.

b) Compiler-directive words, context-sensitive words, exception-names, intrinsic-function-names,system-names, and user-defined words form intersecting sets. The same COBOL word may be used as acompiler-directive word, as a context-sensitive word, as an intrinsic-function-name, as a system-name, andas a user-defined word. The classification of a specific occurrence of such COBOL words is determined bythe context of the statement, clause, or phrase in which it occurs.

2) For the COBOL words INTEGER, LENGTH, RANDOM, and SUM:

a) The reserved words INTEGER, LENGTH, RANDOM, and SUM form an identical set with theintrinsic-function-names INTEGER, LENGTH, RANDOM, and SUM. The same COBOL word LENGTH,RANDOM, or SUM may be used as an intrinsic-function-name and as a reserved word. The classification ofa specific occurrence of such COBOL words is determined by the context in which it occurs.

b) The COBOL words INTEGER, LENGTH, RANDOM, and SUM form disjoint sets with user-defined words andsystem-names. The COBOL words INTEGER, LENGTH, RANDOM, and SUM may not be used as asystem-name or as a user-defined word regardless of context.

8.3.1.1.1 User-defined words

A user-defined word is a COBOL word that shall be supplied by the user to satisfy the format of a clause or statement.

The types of user-defined words are:

— alphabet-name— cd-name (obsolete element)— class-name (for object orientation)— class-name (for truth value proposition)— condition-name— constant-name— data-name— file-name— function-prototype-name

Page 83: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

66 8: Language fundamentals

— index-name— interface-name— level-number— method-name— mnemonic-name— paragraph-name— parameter-name— program-name— program-prototype-name— property-name— record-key-name— record-name— report-name— screen-name— section-name— symbolic-character— type-name— user-function-name

Within a given source element the user-defined words are grouped into the following disjoint sets:

— alphabet-names— cd-names (obsolete element)— class-names (for object orientation)— class-names (for truth value proposition)— condition-names, data-names, property-names, record-key-names, and record-names— constant-names— file-names— function-prototype-names— index-names— interface-names— method-names— mnemonic-names— paragraph-names— parameter-names— program-names— program-prototype-names— report-names— screen-names— section-names— symbolic-characters— type-names— user-function-names

Each user-defined word, except level-number, belongs to one of these disjoint sets. Further, all user-defined wordswithin a given disjoint set shall be unique, except as specified in 8.4.4, Uniqueness of reference.

With the exception of section-names, paragraph-names, and level-numbers, each user-defined word shall contain atleast one basic letter or extended letter. Level-numbers need not be unique; a given specification of a level-numbermay be identical to any other level-number.

The following user-defined words shall be externalized to the operating environment:

1) program-names of separately-compiled programs, class-names, function-prototype-names, interface-names,method-names, program-prototype-names, and user-function-names

2) data-names, file-names, and record-names of items described with the EXTERNAL attribute.

Page 84: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

8: Language fundamentals 67

The implementor shall specify whether extended letters may be specified in user-defined words externalized to theoperating environment.

The AS phrase specifies a literal to be used as the name that is externalized to the operating environment. Theimplementor shall specify which, if any, basic special characters may be specified in these literals, whether extendedletters may be specified in these literals, and how the literals are mapped to the external environment.

When two or more source elements identify something with the same externalized name, they refer to the sameinstance. No name that is externalized to the operating environment can identify more than one kind of instance.

8.3.1.1.1.1 Alphabet-name

An alphabet-name identifies a specific collating set and character sequence. This relationship is established in theSPECIAL-NAMES paragraph.

8.3.1.1.1.2 CD-name

A cd-name identifies an MCS interface area described in a communication description entry within the communicationsection of the data division.

8.3.1.1.1.3 Class-name (for object orientation)

A class-name identifies a class, the entity that defines common behavior and implementation for zero, one, or moreobjects. This relationship is established in the REPOSITORY paragraph or in the CLASS-ID paragraph.

8.3.1.1.1.4 Class-name (for truth value proposition)

A class-name identifies a proposition, for which a truth value can be determined, that the content of a data itemconsists exclusively of those characters listed in the definition of the class-name. This relationship is established inthe SPECIAL-NAMES paragraph.

8.3.1.1.1.5 Condition-name

A condition-name identifies a value, set of values, or range of values defined in the data division, or identifies an onor off status defined in the SPECIAL-NAMES paragraph.

8.3.1.1.1.6 Constant-name

A constant-name identifies a constant. There are two kinds of constant-names, those defined by a CONSTANTcompiler directive and those defined by a constant entry in the data division.

8.3.1.1.1.7 Data-name

A data-name identifies a data item described in a data description entry or a record described in a record descriptionentry.

8.3.1.1.1.8 File-name

A file-name identifies a file connector described in a file description entry or a sort-merge file description entry withinthe file section of the data division.

8.3.1.1.1.9 Function-prototype-name

A function-prototype-name identifies a function prototype.

8.3.1.1.1.10 Index-name

An index-name identifies an index associated with a specific table.

Page 85: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

68 8: Language fundamentals

8.3.1.1.1.11 Interface-name

An interface-name identifies an interface, a grouping of method prototypes. This relationship is established in theREPOSITORY paragraph or in the CLASS-ID paragraph.

8.3.1.1.1.12 Level-number

A level-number, expressed as a one-digit or two-digit number, indicates the hierarchical position of a data item or thespecial properties of a data description entry.

8.3.1.1.1.13 Method-name

A method-name identifies a method.

8.3.1.1.1.14 Mnemonic-name

A mnemonic-name identifies an implementor-named device-name, feature-name, or switch-name. This relationshipis established in the SPECIAL-NAMES paragraph.

8.3.1.1.1.15 Paragraph-name

A paragraph-name identifies a paragraph in the procedure division. Paragraph-names are equivalent if they arecomposed of the same sequence of the same number of COBOL characters.

8.3.1.1.1.16 Parameter-name

A parameter-name identifies a formal parameter of a parameterized class or a parameterized interface.

8.3.1.1.1.17 Program-name

A program-name identifies a program. For a COBOL program, program-name is the name specified in thePROGRAM-ID paragraph of the program's identification division. For a non-COBOL program, the rules for formationof the program-name are defined by the implementor.

8.3.1.1.1.18 Program-prototype-name

A program-prototype-name identifies a program prototype.

8.3.1.1.1.19 Property-name

A property-name identifies a means of getting information out of and passing information back into an object.

8.3.1.1.1.20 Record-key-name

A record-key-name identifies a key associated with an indexed file.

8.3.1.1.1.21 Record-name

A record-name identifies a record described in a record description entry. A record-name may be specified where adata-name is allowed unless specific rules for the format disallow it.

8.3.1.1.1.22 Report-name

A report-name identifies a report described in a report description entry within the report section of the data division.

8.3.1.1.1.23 Screen-name

A screen-name identifies a screen description entry in the screen section.

Page 86: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

8: Language fundamentals 69

8.3.1.1.1.24 Section-name

A section-name identifies a section in the procedure division.

8.3.1.1.1.25 Symbolic-character

A symbolic-character is a user-defined figurative constant that represents a value specified in the SPECIAL-NAMESparagraph.

8.3.1.1.1.26 Type-name

A type-name identifies a type declaration specified by a data description entry.

8.3.1.1.1.27 User-function-name

A user-function-name identifies a function.

8.3.1.1.2 System-names

A system-name is used to communicate with the operating environment. Rules for the formation of a system-nameare defined by the implementor, except that each character used in the formation of a system-name shall be selectedfrom the set of basic letters, basic digits, extended letters, and 'B', except that the 'B' shall not appear as the firstor last character.

The types of system-names are:

— call-convention-name— code-name— computer-name— device-name— feature-name— library-name— locale-name— report-attribute-name— Switch-name— text-name

Within a given implementation these types of system-names form disjoint sets; a given system-name may belong toone and only one of them.

8.3.1.1.2.1 Call-convention-name

A call-convention-name identifies attributes of the linkage mechanism for a function, method, or program, such asthe mechanism for passing arguments, stack management, and name case sensitivity.

8.3.1.1.2.2 Code-name

A code-name identifies a character code set and a collating sequence.

8.3.1.1.2.3 Computer-name

A computer-name may identify the computer upon which the program is to be compiled or run.

8.3.1.1.2.4 Device-name

A device-name identifies an input-output device.

Page 87: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

70 8: Language fundamentals

8.3.1.1.2.5 Feature-name

A feature-name identifies a feature of an input-output device.

8.3.1.1.2.6 Locale-name

A locale-name identifies a locale that specifies a set of cultural elements.

8.3.1.1.2.7 Library-name

A library-name identifies a COPY library.

8.3.1.1.2.8 Report-attribute-name

A report-attribute-name identifies a set of font attributes.

8.3.1.1.2.9 Switch-name

A switch-name identifies an implementor-defined external switch.

8.3.1.1.2.10 Text-name

A text-name identifies a library text.

8.3.1.1.3 Reserved words

A reserved word is one of a specified list of words that is be used in COBOL source program, but that shall not appearin the program as a user-defined word or a system-name. Reserved words shall only be used as specified in thegeneral formats. (See 8.9, Reserved words.)

Reserved words satisfy the following conditions:

1) Reserved words do not begin with the characters '0', ... , '9', 'X', 'Y', or 'Z' except for the reserved wordsZERO, ZEROES, and ZEROS.

2) Reserved words do not contain only one alphabetic character.

3) Reserved words do not start with 1 or 2 characters followed by '–' except for the reserved words I-O,I-O-CONTROL, and reserved words that begin with 'B–'.

4) Reserved words do not contain two or more contiguous hyphens.

There are three types of reserved words:

— required words— optional words— special purpose words

5) Reserved words, with the exception of LC_CURRENCY and locale-category names, do not contain underscores.

8.3.1.1.3.1 Required words

A required word is a word whose presence is required when the format in which the word appears is used in a sourceprogram.

Required words are of two types:

1) Key words. Within each format, such words are uppercase and underlined.

Page 88: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

8: Language fundamentals 71

2) Special character words. These are the arithmetic operators, the concatenation operator, the invocationoperator, and the relation characters.

8.3.1.1.3.2 Optional words

Within each format, uppercase words that are not underlined are called optional words and may be specified at theuser's option with no effect on the semantics of the format.

8.3.1.1.3.3 Special purpose words

The types of special purpose words are:

— figurative constants— predefined address— predefined object identifiers— special registers

8.3.1.1.3.3.1 Figurative constants

Certain reserved words are used to name and reference specific constant values. These reserved words are specifiedin 8.3.1.2.5, Figurative constant values.

8.3.1.1.3.3.2 Predefined address

The reserved word NULL is used as a predefined address. The NULL predefined address is specified in 8.4.2.12,Predefined-address.

8.3.1.1.3.3.3 Predefined object identifiers

Reserved words used as predefined object identifiers are:

— EXCEPTION-OBJECT— NULL— SELF— SUPER

Further specification of predefined object identifiers is given in 8.4.2, Identifiers.

8.3.1.1.3.3.4 Special registers

The following reserved words are used to name and reference special registers:

— LINAGE-COUNTER— LINE-COUNTER— PAGE-COUNTER

Further specification of special registers is given in 8.3.1.3, Special registers.

8.3.1.1.4 Context-sensitive words

A context-sensitive word is a COBOL word that is reserved only in the general formats in which it is specified. Thesame word may also be used as an exception-name, an intrinsic-function-name, a user-defined word, or asystem-name. Context-sensitive words and the contexts in which they are reserved are specified in 8.10,Context-sensitive words.

Page 89: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

72 8: Language fundamentals

8.3.1.1.5 Intrinsic-function-names

An intrinsic-function-name is a COBOL word that identifies a specific intrinsic function (see 15.5, Summary offunctions). With the exception of the words INTEGER, LENGTH, RANDOM, and SUM, a word that is anintrinsic-function-name may appear in a different context in a program as a context-sensitive word, anexception-name, a system-name, or a user-defined word.

8.3.1.1.6 Exception-names

An exception-name is a COBOL word that identifies an exception to be checked in a COBOL program. The sameword may appear in a different context in a program as a context-sensitive word, an intrinsic-function-name, areserved word, a system-name, or a user-defined word. The list of exception-names is given in 14.7.9.2, Exceptionconditions.

8.3.1.2 Literals

A literal is a character string representing a data value derived from the ordered set of characters of which the literalis composed or is defined by a reserved word that references a figurative constant. Each literal possesses a classand category: alphanumeric, boolean, national, or numeric.

The paired quotation symbols specified in the opening and closing delimiters of alphanumeric, boolean, and nationalliterals may be either apostrophes or quotation marks. Both forms may be used within a single source unit.

Hexadecimal digits are used to specify the value of the literal in the hexadecimal-alphanumeric, hexadecimal-boolean,and hexadecimal-national formats of literals. The hexadecimal digits are the basic digits '0' through '9' and the basicletters 'A' through 'F'. When used as hexadecimal digits, the lowercase letters 'a' through 'f' are equivalent to thecorresponding uppercase letters 'A' through 'F'.

8.3.1.2.1 Alphanumeric literals

Alphanumeric literals are of the class and category alphanumeric.

8.3.1.2.1.1 General format

Format 1 (alphanumeric):

Format 2 (mixed-text-alphanumeric):

Format 3 (hexadecimal-alphanumeric):

8.3.1.2.1.2 Syntax rules

ALL FORMATS

1) The length of an alphanumeric literal, excluding the separators that delimit the literal, shall be greater than zeroand less than or equal to 160 alphanumeric character positions.

″ {character-1} ... ″' {character-1} ... '

T″{character-1} ... ″T'{character-1} ... '

X"{hex-character-sequence-1} ..."X'{hex-character-sequence-1} ...'

Page 90: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

8: Language fundamentals 73

FORMATS 1 AND 2

2) Character-1 may be any character in the computer's character set.

3) If character-1 is to represent the quotation symbol used in the opening delimiter, two contiguous matchingquotation symbol characters shall be specified to represent a single occurrence of that character.

4) The two contiguous quotation symbols used to represent a single quotation symbol character shall be in the samecoded character set representation.

5) If character-1 is a COBOL basic letter, the lowercase and uppercase letters are distinct.

FORMAT 1

6) The implementor shall specify whether national characters represented in external media format shall bepermitted in a Format 1 alphanumeric literal and shall specify any associated syntax rules.

FORMAT 2

7) National characters in external media format shall be permitted in a format 2 alphanumeric literal.

FORMAT 3

8) Hex-character-sequence-1 shall be composed of hexadecimal digits.

9) Each hex-character-sequence-1 shall consist of the number of hexadecimal digits that the implementor hasspecified as the number of hexadecimal digits that map to an alphanumeric character.

10) The value of each hex-character-sequence-1, as specified in general rule 6, shall be less than the value that theimplementor has specified as the maximum value of the hexadecimal digits that map to an alphanumericcharacter.

8.3.1.2.1.3 General rules

ALL FORMATS

1) The separators that delimit the alphanumeric literal shall not be included in the value of the alphanumeric literal.

2) Alphanumeric literals are of the class and category alphanumeric.

3) The value of an alphanumeric literal at run time shall be the value represented by character-1.

4) When national characters in external media format appear in the value of the literal, control functions, if any,essential to the representation of the external media format of character-1 shall be included in the value of theliteral.

5) When national characters in external media format appear in the value of the literal, the value of the literal shallbe treated at execution time as a string of alphanumeric characters except for purposes of explicit conversionbetween classes as defined for the DISPLAY-OF and NATIONAL-OF functions.

FORMAT 3

6) The value of the literal at run time is the series of native characters specified by the series of hex-character-sequence-1. For each hex-character-sequence-1, the value resulting from the following expression is the ordinalposition of the character in the value of that native coded character set:

Page 91: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

74 8: Language fundamentals

where digit-value for a numeric digit is the value that digit has when specified as a numeric literal and digit-valuefor 'A' is 10, 'B' is 11, 'C' is 12, 'D' is 13, 'E' is 14, and 'F' is 15.

and where position-from-right is such that the rightmost digit is 1, the digit to the left of it is 2, etc.

8.3.1.2.2 Numeric literals

Numeric literals are of the class and category numeric.

8.3.1.2.2.1 Fixed-point numeric literals

A fixed-point numeric literal is a character-string whose characters are selected from the digits '0' through '9', theplus sign, the minus sign, and the decimal point. The implementor shall allow for fixed-point numeric literals of 1through 31 digits in length. The rules for the formation and value of fixed-point numeric literals are as follows:

1) A literal shall contain at least one digit.

2) A literal shall not contain more than one sign character. If a sign is used, it shall appear as the leftmost characterof the literal. If the literal is unsigned, the literal is nonnegative.

3) A literal shall not contain more than one decimal point. The decimal point is treated as an assumed decimal point,and may appear anywhere within the literal except as the rightmost character. If the literal contains no decimalpoint, the literal is an integer.

4) The value of a fixed-point numeric literal is the algebraic quantity represented by the characters in the fixed-pointnumeric literal. The size of a fixed-point numeric literal in standard data format characters is equal to the numberof digits in the string of characters as specified by the user.

8.3.1.2.2.2 Floating-point numeric literals

The rules for the formation and value of floating-point numeric literals are:

1) A floating-point numeric literal is formed from two fixed-point numeric literals separated by the letter 'E' withoutany spaces.

2) The literal to the left of the 'E' represents the significand. It may be signed and shall include a decimal point.The significand shall be 1 through 31 digits in length. If the significand is signed, the floating-point numericliteral is considered to be signed. If the significand is unsigned, the floating-point numeric literal is consideredto be positive.

3) The literal to the right of the 'E' represents the exponent. It may be signed and shall have a maximum of threedigits and no decimal point. The maximum permitted value of the exponent is implementor-defined.

4) If all the digits in the significand are zero, then all the digits of the exponent shall also be zero and neithersignificand nor exponent shall have a negative sign.

5) The value of a floating-point numeric literal is the algebraic product of the value of its significand and the quantityderived by raising ten to the power of the exponent.

8.3.1.2.3 Boolean literals

Boolean literals are of the class and category boolean.

1 digit-value * (16 ** (position-from-right – 1) )1

# digits

∑+

Page 92: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

8: Language fundamentals 75

8.3.1.2.3.1 General format

Format 1 (boolean)

Format 2 (hexadecimal-boolean)

8.3.1.2.3.2 Syntax rules

ALL FORMATS

1) The length of a boolean literal, excluding the separators that delimit the literal, shall be greater than zero and lessthan or equal to 160 boolean character positions.

FORMAT 1

2) Boolean-character-1 shall be a boolean character, '0' or '1', from the computer's character set.

FORMAT 2

3) Hexadecimal-digit-1 shall be a hexadecimal digit.

8.3.1.2.3.3 General rules

ALL FORMATS

1) The separators that delimit the boolean literal shall not be included in the value of the boolean literal.

2) Boolean literals are of the class and category boolean.

FORMAT 1

3) The value of a boolean literal at run time shall be the value represented by boolean-character-1.

FORMAT 2

4) Each hexadecimal digit has the following boolean equivalent value: '0' is B"0000", '1' is B"0001", '2' isB"0010", '3' is B"0011", '4' is B"0100", '5' is B"0101", '6' is B"0110", '7' is B"0111", '8' is B"1000", '9' isB"1001", 'A' is B"1010", 'B' is B"1011", 'C' is B"1100", 'D' is B"1101", 'E' is B"1110", 'F' is B"1111".

5) The value of the literal at run time shall be the value of an equivalent boolean literal formed by replacing eachhexadecimal digit by its boolean equivalent value, and replacing the leading BX" separator with the B" separator.

8.3.1.2.4 National literals

National literals are of the class and category national.

B"{boolean-character-1} ... "B'{boolean-character-1} ... '

BX"{hexadecimal-digit-1} ... "BX'{hexadecimal-digit-1} ... '

Page 93: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

76 8: Language fundamentals

8.3.1.2.4.1 General format

Format 1 (national)

Format 2 (hexadecimal-national)

8.3.1.2.4.2 Syntax rules

ALL FORMATS

1) If character-1 is to represent the quotation symbol used in the opening delimiter, two contiguous matchingquotation symbol characters shall be specified to represent a single occurrence of that character.

FORMAT 1

2) Character-1 shall be any character in the computer's national character set.

3) The length of a national literal, excluding the separators that delimit the literal, shall be greater than zero and lessthan or equal to 160 national character positions.

FORMAT 2

4) Hex-character-sequence-1 shall be composed of hexadecimal digits.

5) Each hex-character-sequence-1 shall consist of the number of hexadecimal digits that the implementor hasspecified as the number of hexadecimal digits that map to a national character.

6) The value of each hex-character-sequence-1, as specified in general rule 4, shall be less than the value that theimplementor has specified as the maximum value of the hexadecimal digits that map to a national character.

8.3.1.2.4.3 General rules

ALL FORMATS

1) The separators that delimit the national literal shall not be included in the value of the national literal.

2) National literals are of the class and category national.

FORMAT 1

3) The value of a national literal at run time shall be the value represented by character-1.

FORMAT 2

4) The value of the literal at run time is the series of national characters specified by the series ofhex-character-sequence-1. For each hex-character-sequence-1, the value resulting from the followingexpression is the ordinal position of the character in the national coded character set:

N"{character-1} ... "N'{character-1} ... '

NX"{hex-character-sequence-1} ... "NX'{hex-character-sequence-1} ... '

Page 94: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

8: Language fundamentals 77

where digit-value for a numeric digit is the value that digit has when specified as a numeric literal and digit-valuefor 'A' is 10, 'B' is 11, 'C' is 12, 'D' is 13, 'E' is 14, and 'F' is 15, and where position-from-right is such thatthe rightmost digit is 1, the digit to the left of it is 2, etc.

8.3.1.2.5 Figurative constant values

Figurative constant values are generated by the compiler and referenced through the use of the reserved words givenbelow. When used as figurative constants, these words shall not be bounded by the opening and closing delimitersof literals. The singular and plural forms of figurative constants are equivalent and may be used interchangeably.

The figurative constant value and the reserved words used to reference them are as follows:

1) [ALL] ZERO, [ALL] ZEROS, [ALL] ZEROES: Represents the numeric value '0', one or more of the booleancharacter '0', or one or more of the character '0' from the computer's character set, depending on context.

2) [ALL] SPACE, [ALL] SPACES: Represents one or more of the character space from the computer's character set.

3) [ALL] HIGH-VALUE, [ALL] HIGH-VALUES: Except in the SPECIAL-NAMES paragraph, represents one or more ofthe character that has the highest ordinal position in the program collating sequence.

4) [ALL] LOW-VALUE, [ALL] LOW-VALUES: Except in the SPECIAL-NAMES paragraph, represents one or more ofthe character that has the lowest ordinal position in the program collating sequence.

5) [ALL] QUOTE, [ALL] QUOTES: Represents one or more of the character '"' in the computer's character set.The word QUOTE or QUOTES may not be used in place of a quotation symbol in a source program to bound aliteral.

6) ALL literal: Represents all or part of the string generated by successive concatenations of the characterscomprising the literal. The literal shall be an alphanumeric, boolean, or national literal, any of which may be aconcatenation expression. The literal shall not be a figurative constant.

7) [ALL] symbolic-character: Represents one or more of the character specified as the value of thissymbolic-character in the SYMBOLIC CHARACTERS clause of the SPECIAL-NAMES paragraph.

When a figurative constant is used in a context requiring national characters, the figurative constant shall representa national character value. Otherwise, when a figurative constant represents a character value, the figurativeconstant represents an alphanumeric character value. In both cases, the character value representation of thefigurative constant ZERO (ZEROS, ZEROES), SPACE (SPACES), and QUOTE (QUOTES) shall be the value of thecharacter '0', space, and '"', respectively, in the computer's character set. The implementor shall define a mappingof the characters '0', space, and '"' associated with figurative constants to one character representation for eachfigurative constant in each supported computer's character set.

When a figurative constant represents a string of one or more characters, the length of the string is determineddetermined from context by applying the following rules in order:

1) When a figurative constant is specified in a VALUE clause, or when a figurative constant is associated withanother data item, the string of characters specified by the figurative constant is repeated character by characteron the right until the size of the resultant string is greater than or equal to the number of character positions inthe associated data item. This resultant string is then truncated from the right until the number of characterpositions remaining is equal either to 1 or to the number of character positions in the associated data item,whichever is greater. This is done prior to and independent of the application of any JUSTIFIED clause that maybe associated with the data item.

1 digit-value * (16 ** (position-from-right – 1) )1

# digits

∑+

Page 95: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Character-strings

78 8: Language fundamentals

NOTE — A figurative constant is associated with a data item when, for example the figurative constant is moved to orcompared with that data item.

2) When a figurative constant, other than ALL literal, is not associated with a VALUE clause or another data item,the length of the string is one character.

NOTE — For example, when the figurative constant appears in a DISPLAY, STOP, STRING, or UNSTRING statement, itis one character.

3) When a figurative constant ALL literal is not associated with a VALUE clause or another data item, the length ofthe string is the length of the literal.

A figurative constant may be used whenever 'literal' appears in a format with the following exceptions:

1) When a figurative constant is specified in a concatenation expression, the length of the string is one character.

2) If the literal is restricted to a numeric literal, the only figurative constant permitted is ZERO (ZEROS, ZEROES)without the word ALL.

3) The figurative constant ALL literal, when the length of the literal is greater than one, is not permitted to beassociated with a numeric or numeric-edited item.

4) When a figurative constant other than ALL literal is used, the word ALL is redundant and is used for readabilityonly.

5) A figurative constant shall not be specified where an alphanumeric literal is used to identify a method.

Except in the SPECIAL-NAMES paragraph, when the figurative constants HIGH-VALUE(S) or LOW-VALUE(S) are usedin the source program, the actual characters associated with each figurative constant depend upon the programcollating sequence specified. When LOW-VALUE and HIGH-VALUE are used in a context requiring nationalcharacters, the character represented shall be from the national program collating sequence; otherwise, the characterrepresented shall be from the alphanumeric program collating sequence.

8.3.1.3 Special registers

Special registers are certain compiler-generated storage areas whose primary use is to store information produced inconjunction with the use of specific COBOL features. Unless specified otherwise in these specifications, one specialregister of each type is allocated for each program. In the general formats of this specification, a special registermay be used, unless otherwise restricted, wherever data-name or identifier is specified provided that the specialregister is the same category as the data-name or identifier. If qualification is allowed special registers may bequalified as necessary to provide uniqueness. (See 8.4.4, Uniqueness of reference.)

8.3.1.3.1 LINAGE-COUNTER

The reserved word LINAGE-COUNTER is a name for a line counter generated by the presence of a LINAGE clause ina file description entry. The implicit description is that of an unsigned integer whose size is equal to the size ofinteger-1 or the data item referenced by data-name-1 in the LINAGE clause. LINAGE-COUNTER may be referencedonly in procedure division statements; however, only the input-output control system may change the value ofLINAGE-COUNTER.

8.3.1.3.2 PAGE-COUNTER

The PAGE-COUNTER special register is specified in 13.13.4, Report writer special registers.

8.3.1.3.3 LINE-COUNTER

The LINE-COUNTER special register is specified in 13.13.4, Report writer special registers.

Page 96: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Punctuation characters

8: Language fundamentals 79

8.3.1.4 PICTURE character-strings

A PICTURE character-string consists of certain symbols that are composed of the currency symbol and certaincombinations of characters in the COBOL character set. An explanation of the PICTURE character-string and therules that govern its use are given in 13.17.36, PICTURE clause.

8.3.2 Punctuation characters

Punctuation characters are characters used in the formation of separators. The following are punctuation characters:

Character Meaning

, comma; semicolon: colon. period (full stop)" quotation mark' apostrophe( left parenthesis) right parenthesis

space= equal sign

8.3.3 Separators

A separator is one, two, or three contiguous characters formed according to the following rules:

1) The punctuation character space is a separator. Anywhere a space is used as a separator or as part of aseparator, more than one space may be used. All spaces immediately following the separators comma,semicolon, or period are considered part of that separator and are not considered to be the separator space.

2) Except when the comma is used in a PICTURE character-string, the punctuation characters comma andsemicolon, immediately followed by a space, are separators that may be used anywhere the separator space isused. They may be used to improve program readability.

3) The punctuation character period, when followed by a space is a separator. It shall be used only to indicate theend of a sentence, or as shown in formats.

4) The punctuation characters right and left parentheses are separators. Except in pseudo-text, parentheses mayappear only in balanced pairs of left and right parentheses delimiting subscripts, a list of function arguments,reference modifiers, arithmetic expressions, or conditions.

5) The opening delimiters and closing delimiters of literals are separators. Either an apostrophe or a quotation markmay be used as the quotation symbol character in opening and closing delimiters.

The opening delimiters of literals are

— a quotation symbol— the two contiguous characters B", B', N", N', T", and T'— the three contiguous characters BX", BX', NX", and NX'

The closing delimiters of literals are:

— a quotation mark when the opening delimiter uses a quotation mark— an apostrophe when the opening delimiter uses an apostrophe

Page 97: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Separators

80 8: Language fundamentals

The opening delimiter shall be immediately preceded by a space, left parentheses, or opening pseudo-textdelimiter. The closing delimiter shall be immediately followed by one of the separators space, comma, semicolon,period, right parenthesis, or closing pseudo-text delimiter. Separators immediately preceding the openingdelimiter are not part of the opening delimiter. Separators immediately following the closing delimiter are notpart of the closing delimiter.

6) Pseudo-text delimiters are separators. An opening pseudo-text delimiter shall be immediately preceded by aspace; a closing pseudo-text delimiter shall be immediately followed by one of the separators space, comma,semicolon, or period. Pseudo-text delimiters may appear only in balanced pairs delimiting pseudo-text.

7) The punctuation character colon is a separator and is required when shown in the general formats.

8) The separator space may optionally immediately precede all separators except:

a) As specified by reference format rules (see 6, Reference format.)

b) The closing delimiter of a literal.

c) The opening pseudo-text delimiter, where the preceding space is required.

9) The separator space may optionally immediately follow any separator except the opening delimiter of a literal.A space following the opening delimiter of a literal shall be part of the literal and not a separator.

Any punctuation character that appears as part of the specification of a PICTURE character-string or numeric literalis not considered as a punctuation character, but rather as a symbol used in the specification of that PICTUREcharacter-string or numeric literal. PICTURE character-strings are delimited only by the separators space, comma,semicolon, or period.

The rules established for the formation of separators do not apply to the content of alphanumeric, boolean, or nationalliterals or comments.

Page 98: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)References

8: Language fundamentals 81

8.4 References

References identify elements referred to during compilation of source unit or execution of a run unit. The reservedwords and types of names specified in 8.3, Lexical elements, are forms of reference. Additional forms of referenceare condition-names and identifiers.

8.4.1 Condition-name

A condition-name identifies a specific value, set of values, or range of values, within a complete set of values that adata item may assume. The data item itself is called a conditional variable.

Condition-names may be defined in the data division or in the SPECIAL-NAMES paragraph within the environmentdivision where a condition-name shall be assigned to the on status or off status, or both, of implementor-definedswitches.

A condition-name is used in conditions as an abbreviation for the relation condition; this relation condition posits thatthe associated conditional variable is equal to one of the set of values to which that condition-name is assigned. Acondition-name is also used in a SET statement, indicating either that a value is moved to the associated conditionalvariable that makes the condition-name either 'true' or 'false', depending on the format of the SET statement, or thatan implementor-defined switch is set to an 'on' or 'off' status.

8.4.1.1 General format

Format 1 (switch-status-condition-name):

Format 2 (qualified-condition-name-with-subscripts):

8.4.1.2 Syntax rules

FORMAT 1

1) Condition-name-1 shall be associated with a switch-name in the SPECIAL-NAMES paragraph.

FORMAT 2

2) If the conditional variable associated with condition-name-2 requires subscripting, condition-name-2 shall besubscripted with the same number of subscripts required for the conditional variable.

8.4.2 Identifiers

8.4.2.1 Identifier

An identifier is a sequence of character-strings and separators used to reference data uniquely.

8.4.2.1.1 General format

Format 1 (function-identifier):

condition-name-1

condition-name-2 IN

OF

data-name-2 … IN

OF cd-name-1

file-name-1report-name-1

[ ( { subscript-1 } ... ) ]

function-identifier-1

Page 99: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Identifiers

82 8: Language fundamentals

Format 2 (qualified-data-name-with-subscripts):

Format 3 (reference-modification):

Format 4 (in-line-method-invocation):

Format 5 (object-modifier):

Format 6 (predefined-object):

Format 7 (object-property):

Format 8 (type-modifier):

Format 9 (predefined-address)

Format 10 (address-identifier)

8.4.2.1.2 Syntax rules

ALL FORMATS

1) Identifier is defined recursively: whenever the format for an identifier allows another identifier to be specified,that other identifier may be any of the formats for an identifier, including the one being defined provided the rulesfor each format are followed.

data-name-1 IN

OF

data-name-2 … IN

OF cd-name-1

file-name-1report-name-1

[ ( { subscript-1 } ... ) ]

identifier-1 reference-modifier-1

in-line-invocation-1

identifier-2 object-modifier-1

EXCEPTION-OBJECT

NULL

SELF

[ class-name-1 OF ] SUPER

object-property-1 OF identifier-3

identifier-4 type-modifier-1

NULL

data-address-identifier-1program-address-identifier-1

Page 100: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Identifiers

8: Language fundamentals 83

FORMAT 1

2) Function-identifier-1 is defined by 8.4.2.2, Function-identifier.

FORMAT 2

3) The words IN and OF are equivalent.

4) If data-name-1 is not unique in the scope of names of the current source element, then it shall be followed by acombination of qualifiers and subscripts necessary for uniqueness of reference in accordance with 8.4.6, Scopeof names.

5) Subscripts are defined by 8.4.2.4, Subscripts.

FORMAT 3

6) Reference-modifier-1 is defined by 8.4.2.3, Reference-modifier.

FORMAT 4

7) In-line-invocation-1 is defined by 8.4.2.5, In-line method invocation.

FORMAT 5

8) Object-modifier-1 is defined by 8.4.2.6, Object-modifier.

FORMAT 6

9) Predefined-object identifiers are defined by 8.4.2.7, EXCEPTION-OBJECT; 8.4.2.8, NULL; and 8.4.2.9, SELF andSUPER.

FORMAT 7

10) Object-property-1 is defined by 8.4.2.10, Object property.

FORMAT 8

11) Type-modifier-1 is defined by 8.4.2.11, Type-modifier.

FORMAT 9

12) Predefined-address NULL is defined in 8.4.2.12, Predefined-address.

FORMAT 10

13) Address-identifiers are defined by 8.4.2.13, Data-address-identifier and 8.4.2.14, Program-address-identifier.

8.4.2.1.3 General rules

1) The order in which the various components of an identifier are applied is as follows, with the first to be appliedlisted first:

a) predefined-object identifiers are considered elementary identifiers

b) OF or IN for data-name qualification, qualifies the (possibly already qualified) data-name on the left with thecd-name, file-name, report-name or data-name on the right

Page 101: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Identifiers

84 8: Language fundamentals

c) a subscript applies to the fully qualified data-name on the left

d) the object-modifier applies to the object identifier on the left

e) OF for object properties applies the property name on the left to the object identifier on the right

f) the invocation operator for in-line invocation of a method, applies the literal method-name with optionalparameters enclosed in parenthesis on the right to the object identifier on the left

g) the function identifier, if specified without arguments, is considered an elementary identifier; if specifiedwith arguments, applies a function name to a list of arguments enclosed in parentheses

h) reference modification applies to the identifier on the left.

i) the type-modifier applies the type-name on the right to the identifier on the left.

8.4.2.2 Function-identifier

A function-identifier references the unique data item that results from the evaluation of a function.

8.4.2.2.1 General format

8.4.2.2.2 Syntax rules

1) A function-identifier shall not be specified as a receiving operand.

2) If intrinsic-function-name-1 is specified in the repository paragraph or if function-prototype-name-1 is specified,the word FUNCTION may be omitted from the function-identifier; otherwise the word FUNCTION is required.

3) Function-prototype-name-1 shall be a function prototype specified in the repository paragraph.

4) If a function may optionally have zero arguments, a left parenthesis immediately following function-name-1 shallbe the left delimiter of that function's argument list.

NOTE — Putting such a function in parentheses separates the function from the next item starting with a left parenthesisin the list of arguments and subscripts. For example:

FUNCTION MAX ((FUNCTION RANDOM) (A) B)

5) Argument-1 shall be an identifier, a literal, a boolean expression, an arithmetic expression, or the word OMITTED.Specific rules governing the number, class, and category of argument-1 are given for intrinsic functions in thedefinition of that intrinsic function in 15, Intrinsic functions, and for user-defined functions in 14.9, Conformancefor parameters and returning items. If the word Omitted is specified, the OPTIONAL phrase shall be specifiedfor the corresponding formal parameter.

6) If function-prototype-name-1 is specified and the formal parameter corresponding to argument-1 is specified witha BY VALUE phrase, argument-1 shall be of class numeric, object, or pointer.

7) A numeric function shall not be specified where an integer operand is required, even though a particular referenceof the numeric function might yield an integer value.

8) An integer function other than the integer form of the ABS function shall not be specified where an unsignedinteger is required.

[ FUNCTION ] function-prototype-name-1intrinsic-function-name-1

[ ( argument-1 ... ) ]

Page 102: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Identifiers

8: Language fundamentals 85

9) If function-prototype-name-1 is specified, the rules for conformance specified in 14.9, Conformance forparameters and returning items, shall apply.

10) If function-prototype-name-1 is specified and the formal parameter corresponding to argument-1 is specified withthe BY REFERENCE phrase in the USING phrase of the procedure division header and argument-1 is describedwith the USAGE BIT clause, argument-1 shall be described such that its alignment is on the leftmost bit positionof a character boundary.

8.4.2.2.3 General rules

1) At the time reference is made to a function, its arguments are evaluated individually in the order specified in thelist of arguments, from left to right. An argument being evaluated may itself be a function-identifier or may bean expression containing function-identifiers. There is no restriction preventing the function referenced inevaluating an argument from being the same function as that for which the argument is specified. Additionalrules for intrinsic functions are given in 15, Intrinsic functions, for user-defined functions in 14.3, General rulesof the procedure division and in 14.9, Conformance for parameters and returning items.

2) A function is a temporary data item whose value is determined when the function is referenced at run time.

If intrinsic-function-name-1 is specified, the temporary data item is an elementary data item whose descriptionand category are specified by the definition of that intrinsic function in 15, Intrinsic functions.

If function-prototype-name-1 is specified, the description, class, and category of the temporary data item is thatspecified by the description of the linkage section of the item specified in the RETURNING phrase of theprocedure division header of the function prototype identified by function-prototype-name-1.

3) The implementor is not required to maintain any synchronization between argument-1 and the correspondinglinkage section data item.

NOTE — The user is responsible for insuring that the data item alignment in the activating run time entity matches thatin the activated function.

4) If function-prototype-name-1 is specified, the function to be activated is identified by function-prototype-name-1in accordance with the rules specified in 12.2.7, REPOSITORY paragraph, and function-prototype-name-1 is usedto determine the characteristics of the activated function.

5) If function-prototype-name-1 is specified, the manner used for passing each argument is determined as follows:

a) BY REFERENCE is assumed when the BY REFERENCE phrase is specified or implied for the correspondingformal parameter and argument-1 is an identifier that is permitted as a receiving operand, other than anobject property.

b) BY CONTENT is assumed when the BY REFERENCE phrase is specified or implied for the correspondingformal parameter and argument-1 is a literal, an arithmetic expression, a boolean expression, an objectproperty, or any other identifier that is not permitted as a receiving operand.

c) BY VALUE is assumed when the BY VALUE phrase is specified for the corresponding formal parameter.

6) Evaluation of the function-identifier proceeds as follows:

a) Each argument-1 is evaluated at the beginning of the evaluation of the function-identifier. If an exceptioncondition exists, no function is activated and execution proceeds as specified in general rule 6g. If anexception condition does not exist, the values of argument-1 are made available to the activated function atthe time control is transferred to that function.

b) The runtime system attempts to locate the function being activated. If function-prototype-name-1 isspecified, the rules are specified in 8.4.6, Scope of names and 8.4.6.6, Conventions forfunction-prototype-names and program-prototype-names. Additional rules are given in 12.2.7, REPOSITORY

Page 103: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Identifiers

86 8: Language fundamentals

paragraph. If the function cannot be located, the EC-PROGRAM-NOT-FOUND exception condition exists,the function is not activated, and execution continues as specified in general rule 6g.

c) If the function is located but the resources necessary to execute the function are not available, the EC-PROGRAM-RESOURCES exception condition exists, the function is not activated, and execution continuesas specified in general rule 6g. The runtime resources that are checked in order to determine the availabilityof the function for execution are defined by the implementor.

d) If function-prototype-name-1 is specified and the function being activated is a COBOL function , the rulesfor conformance specified in 14.9, Conformance for parameters and returning items, shall apply. If aviolation of these rules is detected, the EC-PROGRAM-ARG-MISMATCH exception condition exists ifchecking for it is enabled in both the activated function and activating runtime entity, the function is notcalled, and execution continues as specified in general rule 6g.

e) The function specified by the function-identifier is made available for execution and control is transferred tothe activated function in a manner consistent with the call convention specified for the function. If function-prototype-name-1 is specified and the function to be activated is a COBOL function, its execution isdescribed in 14.3, General rules of the procedure division; if intrinsic-function-name-1 is specified, itsexecution is described in 15, Intrinsic functions; if function-prototype-name-1 is specified and the functionto be activated is not a COBOL function, the execution is defined by the implementor.

f) After control is returned from the activated function, if an exception condition is propagated from theactivated function, execution continues as specified in general rule 6g.

g) If an exception condition exists, any declarative that is associated with that exception condition is executed.Execution then proceeds as defined for the exception condition and execution of the declarative.

7) If the word OMITTED is specified or a trailing argument is omitted, the omitted-argument condition for thatparameter shall be TRUE in the activated function. (See 8.8.4.1.7, Omitted-argument condition.)

8) If a parameter for which the omitted-argument condition is true is referenced in an activated function, except inthe omitted-argument condition, the EC-PROGRAM-ARG-OMITTED exception condition exists and the results ofthe execution of the function are undefined.

8.4.2.3 Reference-modifier

Reference modification defines a unique data item by specifying an identifier, a leftmost position, and a length.

8.4.2.3.1 General format

8.4.2.3.2 Syntax rules

1) Identifier-1 shall reference a data item that is one of the following:

— an elementary item of category alphanumeric, boolean, or national,— a numeric item of usage display that is not subordinate to a strongly typed item,— a group item that is not strongly typed.

Identifier-1 shall not include a type-modifier with the type-name-1 phrase.

2) If identifier-1 is a function-identifier it shall reference an alphanumeric, boolean, or national function.

3) Leftmost-position and length shall be arithmetic expressions.

4) Unless otherwise specified, reference modification is allowed anywhere an identifier referencing a data item ofclass alphanumeric, boolean, or national is permitted.

identifier-1( leftmost-position : [ length ] )

Page 104: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Identifiers

8: Language fundamentals 87

8.4.2.3.3 General rules

1) Leftmost-position shall represent a boolean position, alphanumeric position, or national position when identifier-1references a boolean, alphanumeric, or national data item, respectively.

2) If the data item referenced by identifier-1 is explicitly or implicitly described as usage DISPLAY and its categoryis other than alphanumeric, it shall be operated upon for purposes of reference modification as if it were redefinedas a data item of class and category alphanumeric of the same size as the data item referenced by identifier-1.

3) If the data item referenced by identifier-1 is explicitly or implicitly described as usage NATIONAL and its categoryis other than national, it shall be operated upon for purposes of reference modification as if it were redefined asa data item of class and category national of the same size as the data item referenced by identifier-1.

4) Each position of a data item referenced by identifier-1 is assigned an ordinal number incrementing by one fromthe leftmost position to the rightmost position. The leftmost position is assigned the ordinal number one. If thedata description entry for identifier-1 contains a SIGN IS SEPARATE clause, the sign position is assigned anordinal number within that data item.

5) Reference modification creates a unique data item that is a subset of the data item referenced by identifier-1.This unique data item is defined as follows:

a) If the usage of identifier-1 is bit, positions used in evaluation are bit positions; otherwise, positions used inevaluation are character positions.

b) The evaluation of leftmost-position specifies the ordinal position of the leftmost bit or character of theunique data item in relation to the leftmost bit or character of the data item referenced by identifier-1.Evaluation of leftmost-position shall result in a positive nonzero integer less than or equal to the number ofpositions in the data item referenced by identifier-1.

c) The evaluation of length specifies the number of bit positions or character positions of the data item to beused in the operation. The evaluation of length shall result in a positive nonzero integer. The sum ofleftmost-position and length minus the value one shall be less than or equal to the number of positions inthe data item referenced by identifier-1. If length is not specified, the unique data item extends from andincludes the position identified by leftmost-position up to and including the rightmost position of the dataitem referenced by identifier-1.

If the evaluation of leftmost-position or length results in a non-integer value or a value that references a positionoutside the area of identifier-1, the EC-BOUND-REF-MOD exception condition exists.

6) The unique data item is considered to be an elementary data item without the JUSTIFIED clause. The uniquedata item has the same class, category, and usage as that defined for identifier-1, except that the categoriesnumeric, numeric-edited, and alphanumeric-edited are considered class and category alphanumeric.

8.4.2.4 Subscripts

Subscripts are used when reference is made to an individual element within a table of like elements.

8.4.2.4.1 General format

condition-name-1data-name-1

(

ALL

arithmetic-expression-1

index-name-1 +-

integer-1

… )

Page 105: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Identifiers

88 8: Language fundamentals

NOTE - Condition-name-1 and data-name-1 are shown for context and are not part of the subscript general format.

8.4.2.4.2 Syntax rules

1) The data description entry containing data-name-1 or the data-name associated with condition-name-1 shallcontain an OCCURS clause or shall be subordinate to a data description entry that contains an OCCURS clause.

2) Except as defined in syntax rule 4, when a reference is made to a table element, the number of subscripts shallequal the number of OCCURS clauses in the description of the table element being referenced. This allows amaximum of seven subscripts to be specified. When more than one subscript is required, the subscripts arewritten in the order of successively less inclusive dimensions of the table.

3) Index-name-1 shall correspond to a data description entry in the hierarchy of the table being referenced thatcontains an INDEXED BY phrase specifying that index-name.

4) Each table element reference shall be subscripted except when such reference appears:

a) As the subject of a SEARCH statement.

b) In a REDEFINES clause.

c) In the KEY IS phrase of an OCCURS clause.

d) In a SORT statement that references a table.

e) In the FROM, TO, or USING clauses of a screen description entry when the subject of the entry has anOCCURS clause.

5) The subscript ALL may be used only when the subscripted identifier is used as a function argument and may notbe used when condition-name-1 is specified. (See 15.2, Arguments.)

6) In the report section, neither a sum counter nor the special registers LINE-COUNTER and PAGE-COUNTER maybe used as a subscript.

8.4.2.4.3 General rules

1) A subscript is determined as follows:

a) If ALL is specified, the subscript is all of the possible values of a subscript for the associated table asspecified in the rules for the statements for which ALL is allowed.

b) If arithmetic-expression-1 is specified, the subscript is the result of the evaluation of arithmetic-expression-1.If the evaluation of arithmetic-expression-1 does not result in an integer, the EC-BOUND-SUBSCRIPTexception condition exists.

c) If index-name-1 is specified, the subscript is the occurrence number represented by the value of the indexreferenced by index-name-1 modified by integer-1. The mapping of the value of the index referenced byindex-name-1 to an occurrence number is defined by the implementor. If integer-1 is specified, thesubscript is the occurrence number derived from the index incremented by the value of integer-1 (when theoperator + is used) or decremented by the value of integer-1 (when the operator B is used).

2) The value of a subscript shall be a positive integer. The lowest possible occurrence number represented by asubscript is 1, which identifies the first element of any given dimension of a table. Each successive elementwithin that dimension of the table is referenced by occurrence numbers of 2, 3, ... . The highest permissibleoccurrence number for any given dimension of the table is the maximum number of occurrences of the item asspecified in the associated OCCURS clause. If the value of the subscript is less than one or greater than thehighest permissible occurrence number, the EC-BOUND-SUBSCRIPT exception condition exists.

Page 106: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Identifiers

8: Language fundamentals 89

8.4.2.5 In-line method invocation

In-line method invocation references a value returned from invocation of a method.

8.4.2.5.1 General format

8.4.2.5.2 Syntax rules

1) This format may be used anywhere an identifier may be used such that it is not a receiving item. When it is used,the behavior is the same as if a data item declared in the same way as the returning parameter of the methodspecified by identifier-1 and literal-1 had been used.

2) Identifier-1 shall be an object identifier such that the class or interface for objects referenced by it is known.

3) Literal-1 shall be an alphanumeric literal such that its value is a method-name specified for identifier-1.

4) If identifier-1 is not a universal object reference and the formal parameter corresponding to identifier-2 isspecified with a BY VALUE phrase, identifier-2 shall be of class numeric, object or pointer.

5) If identifier-1 is not a universal object reference, the rules for conformance specified in 14.9, Conformance forparameters and returning items, shall apply.

6) If identifier-1 is not a universal object reference and the formal parameter corresponding to identifier-2 isspecified with the BY REFERENCE phrase in the USING phrase of the procedure division header and identifier-2is described with the USAGE BIT clause, identifier-2 shall be described such that its alignment is on the leftmostbit position of a character boundary.

7) If identifier-1 is a universal object reference and identifier-2 is described with the USAGE BIT clause, identifier-2 shall be described such that its alignment is on the leftmost bit position of a character boundary.

8) If the OMITTED phrase is specified, the OPTIONAL phrase shall be specified for the corresponding formalparameter.

8.4.2.5.3 General rules

1) Literal-1 is the name of a method.

2) Identifier-1 is the object on which the method is invoked.

3) When an in-line invocation of a method is used, the behavior is the same as if temp-identifier had been used afterone of the following statements:

INVOKE identifier-1 literal-1 USING parameters RETURNING temp-identifierINVOKE identifier-1 literal-1 RETURNING temp-identifier

where:

a) parameters are the parameter(s) specified for the in-line invocation, if any;

identifier-1 :: literal-1 (

arithmetic-expression-1boolean-expression-1identifier-2literal-2OMITTED

… )

Page 107: ISO/IEC CD 1.1 1989 : yyyy(E) · ISO/IEC CD 1.1 1989 : yyyy(E) i Contents

ISO/IEC CD 1.1 1989 : yyyy(E)Identifiers

90 8: Language fundamentals

b) temp-identifier has the same description, class, and category as the RETURNING parameter in thespecification of the method identified by identifier-1 and literal-1;

c) temp-identifier is a temporary item that exists for the purpose of effecting the in-line invocation in this wayand for no other purpose.

4) If an exception occurs during the execution of a statement containing this format, the resumption point is thenext executable statement.

5) The implementor is not required to maintain any synchronization between the arguments and the linkage sectiondata items.

NOTE — The user is responsible for insuring that the data item alignment in the invoking run time entity matches that inthe invoked method.

8.4.2.6 Object-modifier

The object-modifier is a syntactically correct combination of character-strings and separators that uniquely referencethe object reference resulting from the evaluation of the object-modifier.

8.4.2.6.1 General format

8.4.2.6.2 Syntax rules

1) Identifier-1 shall be an object reference identifier, but not the predefined object identifier SUPER.

2) Identifier-1 shall not be referenced as a receiving data item.

8.4.2.6.3 General rules

1) An object-modifier returns an object reference that references the object identified by identifier-1 presuming theinterface specified by the AS phrase.

2) If class-name-1 is specified without either of the optional phrases, the implicit description of the result is USAGEIS OBJECT REFERENCE class-name-1. If the object identified by identifier-1 is not an object of class-name-1, ofa subclass of class-name-1, or NULL, the exception EC-OO-CONFORMANCE is raised.

3) If FACTORY OF class-name-1 is specified, the implicit description of the result is USAGE OBJECT REFERENCEFACTORY OF class-name-1. If the object identified by identifier-1 is not the factory object of class-name-1, ofa subclass of class-name-1, or NULL, the exception EC-OO-CONFORMANCE is raised.

4) If class-name-1 ONLY is specified, the implicit description of the result is USAGE OBJECT REFERENCEclass-name-1 ONLY. If the object identified by identifier-1 is not an object of class-name-1 the exceptionEC-OO-CONFORMANCE is raised.

5) If FACTORY OF class-name-1 ONLY is specified, the implicit description of the result is USAGE OBJECTREFERENCE FACTORY OF class-name-1 ONLY. If the object identified by identifier-1 is not the factory object ofclass-name-1 the exception EC-OO-CONFORMANCE is raised.

6) If interface-name-1 is specified, the implicit description of the result is USAGE OBJECT REFERENCEinterface-name-1. If the object identified by identifier-1 does not conform to interface-name-1 the exceptionEC-OO-CONFORMANCE is raised.

identifier-1 AS[ FACTORY OF ] class-name-1 [ ONLY ]

interface-name-1UNIVERSAL