0% found this document useful (0 votes)
288 views463 pages

GNUCobol 4 Grammar

Uploaded by

PaoloR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
288 views463 pages

GNUCobol 4 Grammar

Uploaded by

PaoloR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 463

The GnuCOBOL 4.

0-early-dev
Grammar
FOR R3716

Edward Hart
[email protected]

July 19, 2020


COBOL is an industry language and is not the property of any company or group of
companies, or of any organisation or group of organisations.
No warranty, expressed or implied, is made by any contributor, or by the CODASYL
COBOL Committee,1 as to the accuracy and functioning of the programming system
and language. Moreover, no responsibility is assumed by any contributor, or by the com-
mittee, in connection therewith.
The authors and copyright holders of the copyrighted materials used herein are:

• FLOW-MATIC [trademark of Sperry Rand Corporation] Programming for the UNI-


VAC ® I and II Data Automation Systems, copyrighted 1958, 1959 by Sperry Rand
Corporation,2

• IBM Commercial Translator, Form No. F28-8013, copyrighted 1959 by IBM, and

• FACT, DSI 27A5260-2760, copyrighted 1960 by Minneapolis-Honeywell.

They have specially authorised the use of this material, in whole or in part, in the
COBOL specifications. Such authorisation extends to the reproduction and use of COBOL
specifications in programming manuals or similar publications.

This work is typeset in Roboto.

Copyright © 2020 Edward Hart


Permission is granted to copy, distribute and/or modify this document under the terms
of the GNU Free Documentation License, Version 1.3 or any later version published by
the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no
Back-Cover Texts. Your attention is drawn to the copy of the license in Appendix A.
The moral rights of the author have been asserted.

1
The CODASYL COBOL committee was dissolved in 1992. Its work was continued by ANSI X3J4 and then
INCITS PL22.4, which was itself dissolved in 2015.
2
Sperry Rand’s computer business is now part of Unisys.

ii
Contents

Foreword xiv

Changelog xvi
1. GnuCOBOL 4.0-early-dev . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
2. GnuCOBOL 3.1-dev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
3. GnuCOBOL 2.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi

1. Key 3

2. Language fundamentals 5
2.1. Lexical elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.1. COBOL words . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.2. User-defined words . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.3. Reserved words . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.4. Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2. References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3. Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.1. Arithmetic expressions . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.2. Concatenation expressions . . . . . . . . . . . . . . . . . . . . 13
2.3.3. Conditional expressions . . . . . . . . . . . . . . . . . . . . . . 13
2.4. Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4.1. Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4.2. Locales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4.3. Screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4.4. User-defined functions . . . . . . . . . . . . . . . . . . . . . . . 15

3. Compiler directives 17
3.1. CALL-CONVENTION directive . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.2. *CONTROL statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.3. COPY statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.4. D directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.5. DEFINE directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.6. DISPLAY directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.7. EJECT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.8. IF directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.9. LEAP-SECOND directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.10. LISTING directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

iv
Contents

3.11. @OPTIONS directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27


3.12. PAGE directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.13. PROCESS statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.14. REPLACE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.15. SET directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.16. SKIP1 statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.17. SKIP2 statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.18. SKIP3 statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.19. SOURCE directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.20. TITLE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.21. TURN directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.22. Micro Focus directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.22.1. ADDRSV directive . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.22.2. ADDSYN directive . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.22.3. ASSIGN directive . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.22.4. BOUND directive . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.22.5. CALLFH directive . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.22.6. COMP1 directive . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.22.7. FOLDCOPYNAME directive . . . . . . . . . . . . . . . . . . . . . 44
3.22.8. MAKESYN directive . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.22.9. OVERRIDE directive . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.22.10. REMOVE directive . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.22.11. SOURCEFORMAT directive . . . . . . . . . . . . . . . . . . . . . 48
3.22.12. SSRANGE directive . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.23. Predefined compilation variables . . . . . . . . . . . . . . . . . . . . . . 50

4. Compilation group 53

5. Identification division 56
5.1. PROGRAM-ID paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.2. FUNCTION-ID paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
5.3. OPTIONS paragraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

6. Environment division 61
6.1. Configuration section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.1.1. SOURCE-COMPUTER paragraph . . . . . . . . . . . . . . . . . . 62
6.1.2. OBJECT-COMPUTER paragraph . . . . . . . . . . . . . . . . . . 63
6.1.3. SPECIAL-NAMES paragraph . . . . . . . . . . . . . . . . . . . . 64
6.1.4. REPOSITORY paragraph . . . . . . . . . . . . . . . . . . . . . . 66
6.2. Input-output section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.2.1. FILE-CONTROL paragraph . . . . . . . . . . . . . . . . . . . . . 67
6.2.2. I-O-CONTROL paragraph . . . . . . . . . . . . . . . . . . . . . . 72

v
Contents

7. Data division 74
7.1. File section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.1.1. File description entry . . . . . . . . . . . . . . . . . . . . . . . . 75
7.2. Working-storage section . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
7.3. Communication section . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.3.1. Communication description entry . . . . . . . . . . . . . . . . . 77
7.4. Local-storage section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
7.5. Linkage section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
7.6. Report section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.6.1. Report description . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.7. Screen section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.7.1. Screen description . . . . . . . . . . . . . . . . . . . . . . . . . 86
7.8. Record description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
7.9. Constant definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
7.10. Data division clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
7.10.1. ANY LENGTH clause . . . . . . . . . . . . . . . . . . . . . . . . 93
7.10.2. AUTO clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
7.10.3. BACKGROUND-COLOR clause . . . . . . . . . . . . . . . . . . . 95
7.10.4. BACKGROUND-HIGH clause . . . . . . . . . . . . . . . . . . . . 96
7.10.5. BACKGROUND-LOW clause . . . . . . . . . . . . . . . . . . . . 97
7.10.6. BACKGROUND-STANDARD clause . . . . . . . . . . . . . . . . 98
7.10.7. BELL clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
7.10.8. BLANK clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
7.10.9. BLANK WHEN ZERO clause . . . . . . . . . . . . . . . . . . . . 101
7.10.10. BLINK clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
7.10.11. BLOCK clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
7.10.12. COLOR clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
7.10.13. COLUMN clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
7.10.14. CCOL clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
7.10.15. CLINE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
7.10.16. CSIZE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
7.10.17. DATA RECORDS clause . . . . . . . . . . . . . . . . . . . . . . . 109
7.10.18. DESTINATION clause . . . . . . . . . . . . . . . . . . . . . . . . 110
7.10.19. DESTINATION COUNT clause . . . . . . . . . . . . . . . . . . . 111
7.10.20. DESTINATION TABLE OCCURS clause . . . . . . . . . . . . . . 112
7.10.21. END KEY clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
7.10.22. Entry name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
7.10.23. ERASE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
7.10.24. ERROR KEY clause . . . . . . . . . . . . . . . . . . . . . . . . . 116
7.10.25. EXTERNAL clause . . . . . . . . . . . . . . . . . . . . . . . . . . 117
7.10.26. EXTERNAL-FORM clause . . . . . . . . . . . . . . . . . . . . . . 118
7.10.27. FOREGROUND-COLOR clause . . . . . . . . . . . . . . . . . . . 119
7.10.28. FROM clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
7.10.29. FULL clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

vi
Contents

7.10.30. GLOBAL clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 122


7.10.31. GRID clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
7.10.32. HIGHLIGHT clause . . . . . . . . . . . . . . . . . . . . . . . . . 124
7.10.33. INITIAL clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
7.10.34. JUSTIFIED clause . . . . . . . . . . . . . . . . . . . . . . . . . . 126
7.10.35. LABEL RECORDS clause . . . . . . . . . . . . . . . . . . . . . . 127
7.10.36. LEFTLINE clause . . . . . . . . . . . . . . . . . . . . . . . . . . 128
7.10.37. Level-number . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
7.10.38. LIKE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
7.10.39. LINAGE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.10.40. LINE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.10.41. LOWLIGHT clause . . . . . . . . . . . . . . . . . . . . . . . . . . 133
7.10.42. MESSAGE COUNT clause . . . . . . . . . . . . . . . . . . . . . 134
7.10.43. MESSAGE DATE clause . . . . . . . . . . . . . . . . . . . . . . . 135
7.10.44. MESSAGE TIME clause . . . . . . . . . . . . . . . . . . . . . . . 136
7.10.45. NEXT GROUP clause . . . . . . . . . . . . . . . . . . . . . . . . 137
7.10.46. NO ECHO clause . . . . . . . . . . . . . . . . . . . . . . . . . . 138
7.10.47. OCCURS clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
7.10.48. OVERLINE clause . . . . . . . . . . . . . . . . . . . . . . . . . . 141
7.10.49. PICTURE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
7.10.50. PRESENT WHEN clause . . . . . . . . . . . . . . . . . . . . . . 143
7.10.51. PROMPT clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
7.10.52. RECORD clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
7.10.53. RECORDING MODE clause . . . . . . . . . . . . . . . . . . . . . 146
7.10.54. REDEFINES clause . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.10.55. REPORT clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
7.10.56. REQUIRED clause . . . . . . . . . . . . . . . . . . . . . . . . . . 149
7.10.57. REVERSE-VIDEO clause . . . . . . . . . . . . . . . . . . . . . . . 150
7.10.58. SAME AS clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.10.59. SECURE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
7.10.60. STATUS KEY clause . . . . . . . . . . . . . . . . . . . . . . . . . 153
7.10.61. SIGN clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
7.10.62. SIZE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
7.10.63. SOURCE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
7.10.64. SPECIAL-NAMES clause . . . . . . . . . . . . . . . . . . . . . . 157
7.10.65. STANDARD clause . . . . . . . . . . . . . . . . . . . . . . . . . 158
7.10.66. SUM clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
7.10.67. SYMBOLIC DESTINATION clause . . . . . . . . . . . . . . . . . 160
7.10.68. SYMBOLIC QUEUE clause . . . . . . . . . . . . . . . . . . . . . 161
7.10.69. SYMBOLIC SOURCE clause . . . . . . . . . . . . . . . . . . . . 162
7.10.70. SYMBOLIC SUB-QUEUE-1 clause . . . . . . . . . . . . . . . . . . 163
7.10.71. SYMBOLIC SUB-QUEUE-2 clause . . . . . . . . . . . . . . . . . 164
7.10.72. SYMBOLIC SUB-QUEUE-3 clause . . . . . . . . . . . . . . . . . 165
7.10.73. SYMBOLIC TERMINAL clause . . . . . . . . . . . . . . . . . . . 166

vii
Contents

7.10.74. SYNCHRONIZED clause . . . . . . . . . . . . . . . . . . . . . . 167


7.10.75. TEXT LENGTH clause . . . . . . . . . . . . . . . . . . . . . . . . 168
7.10.76. TO clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
7.10.77. TYPE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
7.10.78. UNDERLINE clause . . . . . . . . . . . . . . . . . . . . . . . . . 172
7.10.79. USAGE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
7.10.80. USING clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
7.10.81. VALUE clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
7.10.82. VALUE OF clause . . . . . . . . . . . . . . . . . . . . . . . . . . 178
7.10.83. VARYING clause . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
7.10.84. VOLATILE clause . . . . . . . . . . . . . . . . . . . . . . . . . . 180

8. Procedure division 182


8.1. Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
8.1.1. Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
8.2. Procedure division header . . . . . . . . . . . . . . . . . . . . . . . . . . 187
8.3. Common phrases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
8.3.1. Call-convention phrase . . . . . . . . . . . . . . . . . . . . . . . 188
8.3.2. LINKAGE phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
8.3.3. RETRY phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
8.3.4. ROUNDED phrase . . . . . . . . . . . . . . . . . . . . . . . . . . 191
8.3.5. SIZE phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
8.4. ACCEPT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
8.5. ADD statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
8.6. ALLOCATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
8.7. ALTER statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
8.8. CALL statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
8.9. CANCEL statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
8.10. CLOSE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
8.11. COMMIT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
8.12. COMPUTE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
8.13. CONTINUE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
8.14. DELETE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
8.15. DESTROY statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
8.16. DISABLE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
8.17. DISPLAY statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
8.18. DIVIDE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
8.19. ENABLE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
8.20. ENTRY statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
8.21. EVALUATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
8.22. EXHIBIT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
8.23. EXIT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
8.24. FREE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
8.25. GENERATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

viii
Contents

8.26. GO TO statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227


8.27. GOBACK statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
8.28. IF statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
8.29. INITIALIZE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
8.30. INITIATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
8.31. INQUIRE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
8.32. INSPECT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
8.33. JSON GENERATE statement . . . . . . . . . . . . . . . . . . . . . . . . . 234
8.34. JSON PARSE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
8.35. MERGE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
8.36. MODIFY statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
8.37. MOVE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
8.38. MULTIPLY statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
8.39. NEXT SENTENCE statement . . . . . . . . . . . . . . . . . . . . . . . . . 240
8.40. OPEN statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
8.41. PERFORM statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
8.42. PURGE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
8.43. RAISE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
8.44. READ statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
8.45. READY statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
8.46. RECEIVE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
8.47. RELEASE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
8.48. RESET statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
8.49. RETURN statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
8.50. REWRITE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
8.51. ROLLBACK statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
8.52. SEARCH statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
8.53. SEND statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
8.54. SET statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
8.55. SORT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
8.56. START statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
8.57. STOP statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
8.58. STRING statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
8.59. SUBTRACT statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
8.60. SUPPRESS statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
8.61. TERMINATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
8.62. TRANSFORM statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
8.63. UNLOCK statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
8.64. UNSTRING statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
8.65. USE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
8.66. VALIDATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
8.67. WRITE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
8.68. XML GENERATE statement . . . . . . . . . . . . . . . . . . . . . . . . . . 276
8.69. XML PARSE statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278

ix
Contents

9. Intrinsic functions 280


9.1. ABS function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
9.2. ACOS function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
9.3. ANNUITY function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
9.4. ASIN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
9.5. ATAN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
9.6. BOOLEAN-OF-INTEGER function . . . . . . . . . . . . . . . . . . . . . . . 285
9.7. BYTE-LENGTH function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
9.8. CHAR function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
9.9. CHAR-NATIONAL function . . . . . . . . . . . . . . . . . . . . . . . . . . 288
9.10. COMBINED-DATETIME function . . . . . . . . . . . . . . . . . . . . . . . 289
9.11. CONCAT function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
9.12. CONTENT-LENGTH function . . . . . . . . . . . . . . . . . . . . . . . . . 291
9.13. CONTENT-OF function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
9.14. COS function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
9.15. CURRENCY-SYMBOL function . . . . . . . . . . . . . . . . . . . . . . . . 294
9.16. CURRENT-DATE function . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
9.17. DATE-OF-INTEGER function . . . . . . . . . . . . . . . . . . . . . . . . . . 296
9.18. DATE-TO-YYYYMMDD function . . . . . . . . . . . . . . . . . . . . . . . . 297
9.19. DAY-OF-INTEGER function . . . . . . . . . . . . . . . . . . . . . . . . . . 298
9.20. DAY-TO-YYYYDDD function . . . . . . . . . . . . . . . . . . . . . . . . . . 299
9.21. DISPLAY-OF function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
9.22. E function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
9.23. EXCEPTION-FILE function . . . . . . . . . . . . . . . . . . . . . . . . . . 302
9.24. EXCEPTION-FILE-N function . . . . . . . . . . . . . . . . . . . . . . . . . 303
9.25. EXCEPTION-LOCATION function . . . . . . . . . . . . . . . . . . . . . . . 304
9.26. EXCEPTION-LOCATION-N function . . . . . . . . . . . . . . . . . . . . . . 305
9.27. EXCEPTION-STATEMENT function . . . . . . . . . . . . . . . . . . . . . . 306
9.28. EXCEPTION-STATUS function . . . . . . . . . . . . . . . . . . . . . . . . 307
9.29. EXP function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
9.30. EXP10 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
9.31. FACTORIAL function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
9.32. FORMATTED-CURRENT-DATE function . . . . . . . . . . . . . . . . . . . 311
9.33. FORMATTED-DATE function . . . . . . . . . . . . . . . . . . . . . . . . . 312
9.34. FORMATTED-DATETIME function . . . . . . . . . . . . . . . . . . . . . . 313
9.35. FORMATTED-TIME function . . . . . . . . . . . . . . . . . . . . . . . . . 314
9.36. FRACTION-PART function . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
9.37. HIGHEST-ALGEBRAIC function . . . . . . . . . . . . . . . . . . . . . . . . 316
9.38. INTEGER function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
9.39. INTEGER-OF-BOOLEAN function . . . . . . . . . . . . . . . . . . . . . . . 318
9.40. INTEGER-OF-DATE function . . . . . . . . . . . . . . . . . . . . . . . . . . 319
9.41. INTEGER-OF-DAY function . . . . . . . . . . . . . . . . . . . . . . . . . . 320
9.42. INTEGER-OF-FORMATTED-DATE function . . . . . . . . . . . . . . . . . . 321
9.43. INTEGER-PART function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322

x
Contents

9.44. LENGTH function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323


9.45. LENGTH-AN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
9.46. LOCALE-COMPARE function . . . . . . . . . . . . . . . . . . . . . . . . . 325
9.47. LOCALE-DATE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
9.48. LOCALE-TIME function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
9.49. LOCALE-TIME-FROM-SECONDS function . . . . . . . . . . . . . . . . . . 328
9.50. LOG function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
9.51. LOG10 function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
9.52. LOWER-CASE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
9.53. LOWEST-ALGEBRAIC function . . . . . . . . . . . . . . . . . . . . . . . . 332
9.54. MAX function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
9.55. MEAN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
9.56. MEDIAN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
9.57. MIDRANGE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
9.58. MIN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
9.59. MOD function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
9.60. MODULE-CALLER-ID function . . . . . . . . . . . . . . . . . . . . . . . . 339
9.61. MODULE-DATE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
9.62. MODULE-FORMATTED-DATE function . . . . . . . . . . . . . . . . . . . . 341
9.63. MODULE-ID function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
9.64. MODULE-PATH function . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
9.65. MODULE-SOURCE function . . . . . . . . . . . . . . . . . . . . . . . . . . 344
9.66. MODULE-TIME function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
9.67. MONETARY-DECIMAL-POINT function . . . . . . . . . . . . . . . . . . . 346
9.68. MONETARY-THOUSANDS-SEPARATOR function . . . . . . . . . . . . . . 347
9.69. NATIONAL-OF function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
9.70. NUMERIC-DECIMAL-POINT function . . . . . . . . . . . . . . . . . . . . . 349
9.71. NUMERIC-THOUSANDS-SEPARATOR function . . . . . . . . . . . . . . . 350
9.72. NUMVAL function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
9.73. NUMVAL-C function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
9.74. NUMVAL-F function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
9.75. ORD function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
9.76. ORD-MAX function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
9.77. ORD-MIN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
9.78. PI function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
9.79. PRESENT-VALUE function . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
9.80. RANDOM function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
9.81. RANGE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
9.82. REM function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
9.83. REVERSE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
9.84. SECONDS-FROM-FORMATTED-TIME function . . . . . . . . . . . . . . . 363
9.85. SECONDS-PAST-MIDNIGHT function . . . . . . . . . . . . . . . . . . . . 364
9.86. SIGN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
9.87. SIN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366

xi
Contents

9.88. SQRT function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367


9.89. STANDARD-COMPARE function . . . . . . . . . . . . . . . . . . . . . . . 368
9.90. STANDARD-DEVIATION function . . . . . . . . . . . . . . . . . . . . . . . 369
9.91. STORED-CHAR-LENGTH function . . . . . . . . . . . . . . . . . . . . . . 370
9.92. SUBSTITUTE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
9.93. SUBSTITUTE-CASE function . . . . . . . . . . . . . . . . . . . . . . . . . 372
9.94. SUM function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
9.95. TAN function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
9.96. TEST-DATE-YYYYMMDD function . . . . . . . . . . . . . . . . . . . . . . 375
9.97. TEST-DAY-YYYYDDD function . . . . . . . . . . . . . . . . . . . . . . . . 376
9.98. TEST-FORMATTED-DATETIME function . . . . . . . . . . . . . . . . . . . 377
9.99. TEST-NUMVAL function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
9.100. TEST-NUMVAL-C function . . . . . . . . . . . . . . . . . . . . . . . . . . 379
9.101. TEST-NUMVAL-F function . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
9.102. TRIM function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
9.103. UPPER-CASE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
9.104. VARIANCE function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
9.105. WHEN-COMPILED function . . . . . . . . . . . . . . . . . . . . . . . . . . 384
9.106. YEAR-TO-YYYY function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385

Appendices 389

A. GNU Free Documentation License 391


A.1. Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
A.2. Applicability and definitions . . . . . . . . . . . . . . . . . . . . . . . . . 392
A.3. Verbatim copying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
A.4. Copying in quantity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
A.5. Modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
A.6. Combining documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
A.7. Collections of documents . . . . . . . . . . . . . . . . . . . . . . . . . . 399
A.8. Aggregation with independent works . . . . . . . . . . . . . . . . . . . . 400
A.9. Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
A.10. Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
A.11. Future revisions of this license . . . . . . . . . . . . . . . . . . . . . . . . 403
A.12. Relicensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
A.13. Addendum: How to use this License for your documents . . . . . . . . . 405

B. Language element lists 407


B.1. Implementor-defined language element list . . . . . . . . . . . . . . . . . 407
B.2. Optional language element list . . . . . . . . . . . . . . . . . . . . . . . . 418
B.3. Non-standard extension list . . . . . . . . . . . . . . . . . . . . . . . . . 419

xii
Foreword
This document describes the syntax of COBOL as supported by GnuCOBOL. It is hoped it
will complement Gary Cutler and Vincent Coen’s GnuCOBOL Programmer’s Guide which
(currently) does not document recent features added to GnuCOBOL. This document is
also formatted in LATEX, so that everything looks a bit prettier.
The syntax diagrams were transcribed from GnuCOBOL’s parsers. It thus replicates
some unusual syntax rules and misses some syntax rules implemented outside the
parser. For example, the obsolete identification division comment paragraphs are al-
lowed in any order and the syntax of a file-control entry does not distinguish between
SEQUENTIAL, INDEXED and RELATIVE organisations.
This is a draft and so has many flaws. If people find this document useful, I will try to
fix these shortcomings.

xiv
Changelog
1. GnuCOBOL 4.0-early-dev
General

• Bison: dropped support for building with versions < 3.

• C API: removed cob_set_num_params.

• cobc command-line options: added option -fno-fast-math to disable integer arithemtic


optimisations.

• cobc command-line options: removed -fif-cutoff.

• cobc command-line options: added -G for experimental GDB use.

• configure: fixed unwanted flags not being removed completely (bug #627).

• EXTFH: added support for the external file handler (EXTFH) interface, letting users
provide a custom file handler.

• EXTFH: the old OpenCOBOL EXTFH interface (built into GnuCOBOL with the --with-
seqra-extfh and --with-index-extfh build options) has been marked as obsolete.

• Jobs (-j compilation flag): fixed bug #618.

• libcob: internal library number increased from 4 to 5.

• help2man documentation: fixed error when building.

Configuration options

• Deleted compiler configuration options: select-working (see bug #421).

• New compiler configuration options: align-opt, align-record, assign-variable, assign-


using-variable, assign-ext-dyn, assign-disk-from, dpc-in-data, implicit-assign-dynamic-
var, reference-bounds-check, same-as-clause, sync-left-right and vsam-status.

• New runtime configuration options:


– bdb_byteorder (whether BDB should use native, big endian or little endian
byte order).

xvi
Changelog

– create_table (whether the ODBC/OCI file handler should create a DDL file from
an XFD file if no DDL exists).
– mf_ls_instab (whether to replace tabs by spaces which fill up to the next tab
stop (tab stops set 8 spaces apart)).
– keycheck (check whether INDEXED file keys match the SELECT specification
exactly).

• New runtime configuration environment variables: IO_OPTIONS, IX_OPTIONS,


LA_OPTIONS, LS_OPTIONS, RL_OPTIONS, SQ_OPTIONS and IO_x, where x is any
ASSIGN EXTERNAL name used in a program.

Compiler directives

• New Micro Focus directives: DPC-IN-DATA.

• >>SET directive: added XFD phrase.

Identification division

• FUNCTION-ID clause: added recognition of PROTOTYPE phrase.

• PROGRAM-ID clause: added recognition of PROTOTYPE and RESIDENT phrases.

Environment division

• ALTERNATE RECORD KEY clause: allow literal in SUPPRESS WHEN clause.

• ASSIGN clause: allow pipe syntax in literals.

Data division

• SYNCHRONIZED clause: LEFT phrase is now marked as unimplemented (see bug #512).

Procedure division

• ACCEPT statement (screen): fixed some issues with mice.

• COMMIT statement: added optional word TRANSACTION.

• DELETE statement (file): added ON EXCEPTION handlers.

• File I-O: added support for multiple simultaneous file handlers.

• File I-O: allow file-handler to be configured for individual files or organizations us-
ing environment variables (or dictionary files).

xvii
Changelog

• File I-O: added support for INDEXED files based on LMDB.

• File I-O: added initial support for ODBC and OCI as file-handlers.

• File I-O: changed file status for detecting bad data in line sequential files from 34
to 71.

• File I-O: fixed issues with LINE SEQUENTIAL and OPEN I-O on platforms that re-
quire output to be flushed between read and write of a file.

• INSPECT statement: fixed multiple TALLYING phrases being rejected (see bug #47)

• Procedure division header: fixed error when a variable-length parameter was not
referenced (bug #648).

• Procedure division header: added recognition of z/OS-PARM-style main program


parameter (feature request #357).

• REWRITE statement: enabled for LINE SEQUENTIAL files.

• ROLLBACK statement: added optional word TRANSACTION.

• SET statement: added support for FH--FCD and FH--KEYDEF (feature request #349).

• START statement (transaction): added recognition of.

• STRING statement: strengthened syntax checks (bugs #653 and #488).

• Tracing: fixed line numbers when tracing inside RECURSIVE programs (bug #611).

• UNSTRING statement: strengthened syntax checks (bugs #653 and #488).

• WRITE statement (indexed): fixed bug involving file status 21.

2. GnuCOBOL 3.1-dev
NB: Some changes have been made to 3.1-dev which have not yet been merged up to
4.0-early-dev. They have been marked with an asterisk (*).

General

• C API (configuration): added cob_set_runtime_option and cob_get_runtime_option


for specifying the file handle which printer output or trace output should go to.

• C API (environment)*: added function cob_getenv_direct.

xviii
Changelog

• C API (fields)*: added functions cob_get_dbl_param, cob_get_field_constant, cob_get_field_digits,


cob_get_field_scale, cob_get_field_sign, cob_get_field_size, cob_get_field_str, cob_get_field_str_buffe
cob_get_field_type, cob_get_param_field, cob_get_param_str, cob_get_param_str_bufffered,
cob_put_dbl_param, cob_put_field_str, cob_put_field_str, explain_field_type (feature
requests #383 and #384).

• cobc command-line options: added -fcallfh (and COBOL-IT alias -use-extfh).

• cobc command-line options: added -fdump to dump data of all modules on abend
of program.

• cobc command-line options: disabled -fif-cutoff pending removal.

• cobc command-line options: added -fno-remove-unreachable to disable removal


of unreachable code.

• cobc command-line options: -debug no longer implies -ftrace (bug #449).

• cobc command-line options: added -O0 for disabling optimisations (feature re-
quest #255).

• cobc command-line options: replaced -tsymbols by -f(no-)tsysmbols.

• cobc command-line options: added -fno-theader, -fno-tmessages and -fno-tsource


to suppress parts of listings.

• cobc command-line options*: added -Wadditional to enable any messages not


enabled by -Wall.

• cobc command-line options*: added -Wextra as alias for -W.

• cobc command-line options*: added -Wno-error.

• cobc command-line options: added -Wno-dialect to suppress dialect-specific warn-


ings.

• cobc command-line options: added -Wother to enable miscellaneous warnings.

• cobc command-line options: added -fgen-c-line-directives and -fgen-c-labels to en-


able generation of labels and directives indicating where generated C code came
from in the original COBOL source.

• cobc command-line options: honour POSIXLY_CORRECT environment variable.

• cobc command-line options: added -fec and -fno-ec to enable and disable excep-
tion checks.

• cobcrun: allow redirection of cobcrun’s output (bug #616).

• cobcrun command-line options: renamed -runtime-conf to -runtime-config.

xix
Changelog

• cobcrun command-line options: added –verbose.

• cobcrun command-line options: expanded information in –info about the used


curses library (feature request #385).

• COBOL-85 NIST testsuite: tests can now be downloaded from Sourceforge when
the NIST website is unavailable (bug #563).

• COBOL-85 NIST testsuite: tests can now be performed individually by running


make in the test module directory.

• Copyfiles: fixed segfault when GnuCOBOL tried and failed to open a copyfile (bug #458).

• Copyfiles: GnuCOBOL now checks for recursive copyfiles (bug #467).

• Debugging: Added debug logging for compiler developers (--enable-debug-log ./con-


figure option).

• Dependencies: GnuCOBOL now (optionally) depends on libxml2 and cJSON (for


XML and JSON I-O).

• Dependencies: moved documentation of GnuCOBOL’s requirements from README


to new file DEPENDENCIES.

• Documentation: added Markdown versions of README and DEPENDENCIES.

• DJGGP support: added minimal support for DJGGP.

• Error messages: runtime error messages now use translated versions (depending
on a user’s language).

• Error messages: added checks for version control conflict markers in source code.

• Error messages: increased default maximum number of error messages to 128


from 100.

• Expressions: fixed bug #431, where decimal constants were not initialised in INI-
TIAL programs.

• IBM i support: fixed segfault involving filepaths

• Listings: fixed the substitution of tokens in quotes in copyfiles (bug #494).

• Listings: fixed some cases of cross-reference listings containing wrong line num-
bers.

• Listings: now require the size of a listing page to be at least 20 lines.

• Listings: fixed segfault in listing programs with large REPLACE arguments (bug #515).

• Listings: fixed stack overflow in listing programs long literals (bug #569).

xx
Changelog

• Mac OS support: some build issues fixed (see bug #644).

• MinGW support: added script for generating binaries using MinGW.

• Modules: enabled running of modules generated with older versions of GnuCOBOL


(feature request #239).

• MPIR support: added as an alternative to GMP for GnuCOBOL’s maths library.

• National literals: added Fujitsu NC national character literals (feature request #352).

• National literals: fixed NX type literals being treated as alphanumeric (bug #658).

• Nested programs: fixed bug #435, where identifiers in the containing program
where not propagated to the contained program, causing a segfault.

• Nested programs: fixed bug #587, where a memory error occurred when a pro-
gram was nested inside a program with the same name.

• Numeric literals: added support for HP COBOL octal literals (%. . . ).

• OrangeC support: added minimal support for OrangeC.

• Recursion: fixed bug #222, where the return value was lost when returning from a
recursive call.

• Reserved words: allow users to make default reserved words aliases for other
words.

• Screen section testsuite: added a manual testsuite for screen section functional-
ity (patch #26).

• Signals: added error message for SIGFPE (see bug #434).

• Solaris support: fixed errors and warnings when compiling in Solaris 10.

• Tracing: added new options for controlling tracing (see feature request #242).

• User-defined words: increased default maximum user-defined length to 63 char-


acters (per COBOL 202X draft standard).

• Windows support: renamed makedist.bat to makedist.cmd.

• Windows support: fixed cjson.dll not being included in distributions.

• Windows support: makedist.cmd now uses VCPKG_EXPORT_DIR if set.

xxi
Changelog

Configuration options
• assign-clause compiler configuration option: added options external (equivalent
to ibm) and dynamic (equivalent to mf).
• IBM dialect: reserved words updated to Enterprise COBOL V6.2.
• incorrect-conf-sec-order option: changed to “ok” from “error” in mf and default
dialects.
• MF dialect: added ARGUMENT-NUMBER and ARGUMENT-VALUE as reserved words.
• New compiler configurations: realia for CA Realia II.
• New compiler configuration options: assign-disk-from, assign-ext-dyn, assign-using-
variable, assign-variable, binary-comp-1, call-convention-mnemonic, call-convention-
linkage, continue-after, display-special-fig-consts, free-redefines-position (feature
request #211), hp-octal-literals, implicit-assign-dynamic-var, goto-entry, line-col-zero-
default, national-character-literals move-figurative-space-to-numeric, move-non-numeric-
lit-to-numeric-is-zero, missing-statement, numeric-pointer, perform-without-varying-
by, record-delimiter, record-delim-with-fixed-recs, records-mismatch-record-clause,
report-column-plus, screen-section-rules, sequential-delimiters, symbolic-constant,
type-to-clause*, usage-type*, xml-generate-extra-phrases, zero-length-literals.
• New runtime configuration options:
– col_just_lrc (for enabling/disabling the LEFT/RIGHT/CENTER phrases of the
report COLUMN clause),
– printer and display_print_pipe (for specifying what command should be exe-
cuted before DISPLAY UPON PRINTER; similar to Micro Focus’ COBPRINTER
option);
– display_print_file (name of file which DISPLAY UPON PRINTER will append
its output to), display_punch_file (name of file to created upon first DISPLAY
UPON SYSPUNCH),
– mouse_flags (to let mouse clicks move the cursor in ACCEPT),
– mouse_interval (maximum time between mouse press and mouse release
events for them to recognised as a click),
– trace_format,
– dump_file and
– dump_width.
• Registers: disabling a register also removes the reserved word with the same
name, if it exists (feature request #278).
• Registers: added COL and LIN.
• Runtime configuration options: use the system’s file path separator instead of
always using : (so the path separator is now ; on Windows). (See bug #610.)

xxii
Changelog

Compiler directives

• COPY statement: added support for copybook and library names containing pe-
riods as text-names. For example, “COPY copybook.cpy.” is now accepted. See
feature request #344.

• DISPLAY directives: allow a wider range of characters.

• @OPTIONS directive: added recognition of.

• New Micro Focus directives: ADDRSV, ADDSYN, MAKESYN, OVERRIDE and RE-
MOVE (feature request #210); ASSIGN, BOUND*, CALLFH, COMP1 and SSRANGE*.

• >>TURN directive*: added experimental implementation.

Identification division

• OPTIONS paragraph: added support for ARITHMETIC clause.

Environment division

• ALTERNATE RECORD KEY clause: implemented split keys (SOURCE IS; feature
request #23) and sparse keys (SUPPRESS WHEN; feature request #281).

• ALPHABET clause: added recognition of more pre-defined alphabets.

• ASSIGN clause: re-enabled use of linkage section or BASED items (bug #421).

• ASSIGN clause: added SYSPCH and SYSPUNCH device-names for writing to a


punch file (this is not related to CARD-PUNCH).

• ASSIGN clause: added device-names S01 through to S05.

• ASSIGN clause: allow “ASSIGN VARYING . . . ”.

• ASSIGN clause: strengthened syntax checks (bug #553).

• ASSIGN clause: fixed bug #571 involving external-file-names.

• ASSIGN clause: added Micro Focus’ DISK FROM phrase.

• CALL-CONVENTION phrase: added C and PASCAL (see feature request #311).

• CLASS phrase: added recognition of ALPHANUMERIC/NATIONAL and alphabet


phrases.

• CLASS phrase: fixed bug #566, where class-names were not inherited by nested
subprograms.

• CRT STATUS phrase: improved syntax checks.

xxiii
Changelog

• CURRENCY phrase: changed to emit error when CURRENCY SIGN other than “$”
is entered.

• CURRENCY phrase: improved error messages for invalid currency signs.

• CURSOR phrase: fixed bug #579, where the CURSOR data item was not used for
the initially positioning the cursor in an ACCEPT statement.

• CURSOR phrase: fixed for data items of length 4 characters.

• EXTERN clause: improved error messages (bug #446).

• FILE-CONTROL entries: added detection of the OS/VS-era phrases ACTUAL KEY,


FILE-LIMIT, NOMINAL KEY, TRACK-AREA and TRACK-LIMIT.

• FILE STATUS clause: added detection of VSAM secondary status identifier (fea-
ture request #51).

• FILE STATUS clause: strengthened syntax checks (bug #656).

• I-O-CONTROL paragraph: added detection of APPLY COMMIT clause (from the


COBOL 202X draft standard).

• I-O-CONTROL paragraph: added detection of the OS/VS-era clauses CORE-INDEX,


CYL-INDEX, CYL-OVERFLOW, EXTENDED-SEARCH, LOCK-HOLDING, MASTER-INDEX,
PRINT-CONTROL, RECORD OVERFLOW, REORG-CRITERIA, WRITE-ONLY and WRITE-
VERIFY.

• OBJECT-COMPUTER paragraph: added recognition of NATIONAL collating sequences.

• OCCURS clause: correctly implemented nested OCCURS DEPENDING tables (ODOSLIDE).

• PASSWORD clause: added detection of.

• RECORD clause: fixed behaviour in the IBM dialect when the maximum record
length does not match the length in the RECORD clause.

• RECORD DELIMITER phrase: added support for BINARY-SEQUENTIAL and LINE-


SEQUENTIAL phrases.

• RECORD DELIMITER phrase: improved syntax checks (see bug #442).

• RECORD KEY clause: implemented sparse keys (SOURCE IS; feature request #23).

• RERUN clause: added detection of.

• SELECT entry: fixed bug #619.

• TOP phrase: added as mnemonic for ADVANCING PAGE.

xxiv
Changelog

Data division
• 88-level items: improved error messages when used in the wrong places.

• ANY LENGTH clause: fixed bug #487, where literals moved to ANY LENGTH items
were incorrectly truncated.

• ANY LENGTH clause: fixed bug #511, where comparisons treated ANY LENGTH
items as having just one character.

• ANY LENGTH clause: fixed segfault when referencing linkage-section ANY LENGTH
items in the first compiled program.

• COLUMN clause: “COL +1” and similar clauses are no longer allowed; there must
now be a space between the sign and the number.

• COLUMN clause (screen): added POS as synonym for COLUMN.

• errno: can now access the C global variable errno by declaring a variable as EX-
TERNAL AS "errno" (feature request #49).

• LIKE clause*: added recognition of (see feature request #193).

• LINE clause: “LINE +1” and similar clauses are no longer allowed; there must now
be a space between the sign and the number.

• LINE clause (report): allow LINES instead of LINE.

• PICTURE clause: added recognition of PIC 1(n).

• PICTURE clause: improved error messages.

• PICTURE clause: added recognition of LOCALE phrase.

• PICTURE clause*: fixed compiler crash with malformed picture-string (bug #659).

• RECORD VARYING clause: fixed bug #441, where an FD could be declared as


RECORD VARYING, but have records of only one size.

• RENAMES clause: strengthened syntax checks.

• RENAMES clause: fixed bug #623, where RENAMES items had a LENGTH OF zero.

• SAME AS clause: implemented (feature request #193).

• Screen section: made some COBOL words context-sensitive to screen section.

• Screen description: the rules on which clauses must be specified when now de-
pend on the dialect (see bug #382).

• SYNCHRONIZED clause: deactivated RIGHT phrase, pending correct implementa-


tion (previously SYNCHRONIZED RIGHT was the same as SYNCHRONIZED LEFT).

xxv
Changelog

• TYPE clause*: added type-name format.

• TYPEDEF clause*: implemented (feature request #193).

• USAGE clause: added option to make COMP-1 mean a 16-bit signed integer (fea-
ture request #272).

• USAGE clause: added recognition of BIT and COMP-0.

• USAGE clause: added COMP-N.

• USAGE clause: added experimental support for ACUCOBOL’s numeric POINTER


(feature request #376).

• USAGE clause*: added type-names.

• VOLATILE clause: added recognition of.

Procedure division
• ACCEPT statement (environment): added recognition of INPUT STATUS and TERMINAL-
INFO and SYSTEM-INFO phrases.

• ACCEPT statement (screen): fixed ACCEPT WITH UPDATE and not working (bug #423).

• ACCEPT statement (screen): fixed bug #426, where backspacing at the start of a
field moved the cursor to the second-to-last character of the preceding field.

• ACCEPT statement (screen): added detection of CONTROL KEY clause.

• ACCEPT statement (screen): allow numeric-edited fields to contain spaces (see


bug #491).

• ACCEPT statement (screen): fixed error when filling in a one character field with
insert mode on (bug #498).

• ACCEPT statement (screen): pressing the home key, or end key, now toggles be-
tween going to the start of, or end of, the field and the cursor’s original position.

• ACCEPT statement (screen): added WITH NO BELL clause.

• ACCEPT statement (screen): added support for Microsoft COBOL position speci-
fiers.

• ACCEPT statement (screen): removed silent minimum of 500 ms from TIME-OUT


phrase (feature request #196).

• ACCEPT statement (screen): added recognition of CURSOR clause.

• ACCEPT statement (temporal): fixed bug #469, where ACCEPT FROM DAY was
off by −1.

xxvi
Changelog

• ALLOCATE statement: added recognition of LOC clause.

• CALL statement: fixed ON EXCEPTION not working properly with -fstatic (bug #462).

• CALL statement: added LINKAGE phrase (feature request #311).

• CALL statement*: fixed RETURN-CODE being set with RETURNING field (bug #651).

• CANCEL statement: fixed segfault in recursive programs (bug #98).

• Conditions: strengthened syntax checks for abbreviated conditions.

• Conditions: improved error messages (bug #567).

• Conditions: fixed LESS OR EQUAL being accepted, but LESS OR EQUALS being
rejected (bug #663).

• CONTINUE (after): added support for (from COBOL 202X draft standard). See
feature request #354.

• DISPLAY statement (printer): allow for redirecting DISPLAY UPON PRINTER(-1) to


files based on the runtime configuration.

• DISPLAY statement (screen): fixed DISPLAY LOW-VALUE not setting position of


cursor for next DISPLAY statement (bug #423).

• DISPLAY statement (screen): added configuration option to disable Micro Focus’


special behaviour with some figurative constants (see bug #423).

• DISPLAY statement (screen): fixed bug #428, where DISPLAY ALL “x” WITH SIZE
only displayed “x” once.

• DISPLAY statement (screen): added support for Microsoft COBOL’s position spec-
ifiers and ERASE phrase.

• ENTRY statement: added LINKAGE phrase (feature request #311).

• Error messages: runtime error messages now include “error: ” after the filename
and before the actual error message.

• Error messages: fixed incorrect use of “parameter” where “argument” was meant.

• Error messages: fixed bug #586, where GnuCOBOL would cause a buffer overflow
when outputting an error message with a very long literal.

• EVALUATE statement: added partial support for WHEN clauses not containing any
statements, which transfer control to the next WHEN clause containing a state-
ment, if any (so the behaviour is like C’s switch statement).

• Exceptions: the exception status is now only reset by SET LAST EXCEPTION TO
OFF.

xxvii
Changelog

• Exceptions: fixed EC-SIZE-OVERFLOW being raised when EC-SIZE-ZERO-DIVIDE is


active (bug #223).

• EXHIBIT statement*: added.

• File I-O: fixed bug #457, where file status 30 was set instead of the correct perma-
nent error status (34, 35 or 37).

• File I-O: added support for VBISAM 2.1.1.

• File I-O: error messages from libcob now include the file I-O statement that caused
them, when known.

• File I-O (BDB): fixed file status after OPEN OUTPUT on an OPTIONAL file.

• File I-O (ISAM): fixed bug involving START . . . LESS EQUAL followed by READ PRE-
VIOUS.

• File I-O (ISAM): fixed bug #589, where READ would skip records with duplicate
keys after a DELETE.

• Floating-point arithmetic: fixed incorrect SIZE ERROR exceptions (see bug #470).

• Floating-point arithmetic: fixed bug #478, where calculations with the SIZE ERROR
phrase have different results to calculations without it.

• Floating-point arithmetic: now activate the SIZE ERROR handler when a floating-
point variable is set to a non-finite value (see bug #122).

• GO TO statement: added non-standard ENTRY phrase extension.

• INQUIRE statement: added recognition of.

• JSON GENERATE statement: added (patch #45).

• JSON PARSE statement: added recognition of.

• LENGTH OF phrase: fixed error message when used on group fields (bug #175).

• LENGTH OF phrase: allow non-numeric literals.

• MODIFY statement: added recognition of.

• MOVE statement: added options to interpret moving non-numeric values to nu-


meric items as moving zero to numeric items.

• MOVE statement: improved detection of overlapping MOVEs when using refer-


ence modification.

• MOVE statement: fixed remaining cases of bug #220, involving numeric-edited


items.

xxviii
Changelog

• MOVE statement: fixed incorrect truncation of COMP-4 items.

• PERFORM statement: added check for non-zero item in BY phrase (feature re-
quest #268).

• PERFORM statement: allow the BY phrase to be omitted, which is the same as


specifying BY 1 (feature request #158).

• PERFORM statement (inline): added partial support for inline PERFORM state-
ments not containing any statements.

• Procedure division header: added recognition of MEMORY SIZE phrase.

• Procedure division header: added LINKAGE phrase (feature request #311).

• Procedure division header: error if two USING BY REFERENCE parameters are the
same (bug #635).

• Procedure division header*: fixed use of variable-length RETURNING item (bug #641).

• Procedure division header*: disabled RETURNING in programs, pending fix of


bug #650.

• RAISE statement: added recognition of.

• READ statement (relative): fixed file status on end of file.

• Reference modification: improved out-of-bounds error message (bug #445).

• SORT statement: added sorting of tables without keys (patch #42).

• SORT statement: added recognition of more COLLATING SEQUENCE phrases.

• OPEN statement: fail with file status 39 when the first record of an indexed file is
larger than specified in the FD.

• OPEN statement: fixed segfault when attempting to open a file in a non-existent


folder (bug #520).

• OPEN statement: added ACUCOBOL locking clauses.

• OPEN statement: added detection of OS/VS-era input mode phrases.

• READ statement (indexed): fail with file status 43 when the read record is larger
than specified in the FD.

• Reference modification: added warnings for invalid reference modifications in-


volving variables.

• Report writer: implemented, including features from COBOL 2002 and the IBM
Report Writer.

xxix
Changelog

• REWRITE statement (indexed): now sets file status to 02 when duplicate key is
detected.

• SET statement: fixed bug #225, where an invalid SET statement caused an error
saying “invalid MOVE statement”.

• STRING statement: fixed bug #543.

• STRING statement: strengthened syntax checks (bug #653).

• SUBTRACT statement: fixed bug #603, where subtracting an integer from a floating-
point variable lead to incorrect results.

• STOP statement: fixed the NORMAL phrase causing a compilation error (bug #433).

• UNSTRING statement: strengthened syntax checks (bug #653).

• USE statement (exception): improved recognition of.

• VALIDATE statement: added recognition of.

• WRITE statement: fixed compilation error when writing to a GLOBAL file in a sub-
program (bug #87).

• WRITE statement (indexed): now sets file status to 02 when duplicate key is de-
tected.

• XML GENERATE statement: added (patch #41).

• XML PARSE statement: added recognition of.

Intrinsic functions

• CONCAT function: added.

• CONTENT-OF function: added.

• CONTENT-LENGTH function: added.

• LENGTH, BYTE-LENGTH and LENGTH-AN functions: now forbid numeric argu-


ments.

• MOD function: fixed EC-SIZE-ZERO-DIVIDE being raised instead of EC-ARGUMENT-


FUNCTION when zero was provided as an argument.

• REM function: fixed EC-SIZE-ZERO-DIVIDE being raised instead of EC-ARGUMENT-


FUNCTION when zero was provided as an argument.

• WHEN-COMPILED function: fixed timezone, which was missing its sign and con-
tained nonsense when negative (bug #436).

xxx
Changelog

Built-in subprograms

• C$GETPID: fixed wrong process ID being returned after forking (bug #451).

• C$SLEEP: if the requested time is too large, sleep for the maximum possible time
instead of not at all.

• CBL_GET_CSR_POS: fixed wrong position being returned after ACCEPT statement


(bug #483).

• CBL_READ_KBD_CHAR: this now works (bug #500).

• SYSTEM: added workaround of buggy system() implementation on Windows, which


removes leading and trailing quotes.

• X"91": corrected number of arguments from 2 to 3 (bug #527).

3. GnuCOBOL 2.2
This list tracks changes made from 23 November 2013. This excludes many changes
made in 2009–2013 which would be pertinent to those upgrading from a 2009 build of
OpenCOBOL 1.1 found in many package repositories.

General

• 64-bit numbers: fixed bugs in handling of 64-bit numbers (e.g. bug #229).

• ACUCOBOL windows: added detection of ACUCOBOL’s window/message box GUI


syntax.

• C API (data): added several functions for getting and setting cob_field items.

• C API (files): added cob_file_external_addr, cob_file_malloc and cob_file_free.

• C API (screen): added several functions from Micro Focus’ C to COBOL API: cob_display_text,
cob_sys_get_char, cob_get_char, cob_get_text, cob_display_formatted_text, cob_sys_get_csr_pos,
cob_sys_set_csr_pos, cobmove, cobaddstrc, cobprintf and cobgetch (feature re-
quests #148 and #187).

• C API (signals): added cob_raise to send signal to signal handlers.

• C compiler support: fixed errors in compilers without designated initializers.

• cobc command-line options: added -O3 to enable more optimisations.

• cobc command-line options: added -Wfatal-error to make the compiler abort on


the first error.

xxxi
Changelog

• cobc command-line options: added -Wpossible-overlap to warn items that may


overlap (-Woverlap only warns if items definitely overlap).

• cobc command-line options: added -fmax-errors to set number of errors at which


the compiler aborts.

• cobc command-line options: added -fwinmain to output WinMain instead of main


(feature request #194).

• cobc command-line options: added -t and -T for complete listing support (-t for
80-characters wide listings and -T for 132-characters wide) which includes cross-
references (thanks to Dave Pitts).

• cobc command-line options: added -vvv (like -vv but passes verbose option to the
linker as well) and -### (like -v but commands are not executed).

• cobc command-line options: allow -, i.e. stdin, as a source file.

• COBOL-85 NIST testsuite: tests now refer to $COBC, $COBCRUN and $COBCRUN_DIRECT
environment variables instead of directly calling cobc and cobcrun, allowing the
testsuite to run in conjunction with tools like valgrind.

• COBOL-85 NIST testsuite: tests for obsolete feature flagging are now executed,
if possible.

• Comments: added ACUCOBOL comments: $ as synonym for * in indicator area


and | as synonym for floating comment indicator *>.

• Communication facility: added detection of communication facility syntax.

• configure: added useful error message when help2man, bison and flex are miss-
ing when they are needed.

• curses: fixed compilation errors when configured without curses (bug #90).

• Error messages: error messages are now lowercase, in line with the GNU Coding
Standards (bug #198).

• Error messages: segfaults in the compiler now cause an error message to be dis-
played.

• Error messages: replaced instances of “ODO” by the clearer “OCCURS DEPENDING


ON”.

• Expressions: resolve constant expressions and optimise constant decimals at


compile time.

• Expressions: added support for IBM OS/VS COBOL’s arithmetic.

• Expressions: improved error messages for malformed expressions.

xxxii
Changelog

• Indicators: invalid indicators no longer cause compilation to immediately termi-


nate (feature request #126).
• Information: output compiler version used to build GnuCOBOL and any mathemat-
ical libraries used (feature request #169).
• Information: output what a reserved word is an alias for in the --list-reserved output
(feature request #214).
• Manpage: added manpage generation and installation.
• Nested programs: Nested programs no longer need to have END PROGRAM.
• National literals: added basic support for national literals.
• Numeric literals: added ACUCOBOL numeric literals: B#. . . for binary, O#. . . for
octal, and X#. . . and H#. . . for hexadecimal.
• Literals: fixed heap corruptions caused by uncommon literals (bug #195).
• Literals: allow concatenation of literal and Boolean literals.
• Memory management: all memory belonging to the parsers and lexers is freed
upon a compiler abend.
• Memory management: fixed memory leaks due to recursive CALLs.
• Microsoft Visual C++: output when compiling with cl.exe is now filtered and tem-
porary files are deleted.
• MinGW: fixed use of wrong directory separator.
• Signals: removed error message on SIGPIPE.
• Signals: added error message for SIGBUS.
• Translations: updated, with new support for German and Italian.
• User-defined functions: function definitions must now end with END FUNCTION.
• User-defined functions: function definitions may no longer be nested in programs
(bug #255).
• Windows support: allow linking with asm files.
• Windows support: added support for DISAM in the batch file which creates dis-
tributables.
• Windows support: fixed environment-setting batch files not working with Microsoft
Visual Studio 2017.
• Windows support: fixed 64-bit environment-setting batch files not checking the
correct directories for binaries and libraries.

xxxiii
Changelog

Configuration options

• Deleted compiler configuration options: eject-statement, cobol85-reserved.

• New compiler configurations: all dialects have been split into standard and strict
dialects, with strict dialects maintaining source compatibility with the dialect’s
compiler(s).

• New compiler configurations: acu for ACUCOBOL, cobol2014 for COBOL 2014, rm
for RM-COBOL, xopen for X/Open.

• New compiler configuration options: accept-display-extensions, accept-update,


accept-auto, acu-literals, arithmetic-osvs, call-overflow, console-is-crt, constant-
01, constant-78, constant-folding, define-constant-directive, hexadecimal-boolean,
hexadecimal-national-literals, incorrect-conf-sec-order, intrinsic-function, listing-statements,
literal-length, move-figurative-constant-to-numeric, move-figurative-quote-to-numeric,
move-ibm, national-literals, no-echo-means-secure, not-exception-before-exception,
numeric-boolean, numeric-literal-length, numeric-value-for-edited-item, pic-length,
program-name-redefinition, program-prototypes, reference-out-of-declaratives (fea-
ture request #179), register, renames-uncommon-levels, reserved, reserved-words,
stop-identifier, system-name, title-statement, use-for-debugging, word-length (fea-
ture request #43).

• Registers: compiler configurations can now specify all the registers to generate.

• Registers: added registers not yet implemented by GnuCOBOL as reserved words.

• Renamed compiler configuration options: debugging-line to debugging-mode, relaxed-


syntax-check to relax-syntax-checks.

• Reserved words: compiler configurations can now specify all the reserved words
and context-sensitive words permitted.

• Reserved words: compiler configurations can now specify whether a reserved


word is an alias for another reserved word.

• Runtime configuration: added ability to configure some libcob features at runtime.

• Support options: options which specify if a feature is supported can now take a “+”
before their argument to indicate it takes effect only if the current level of support
is less strict than “ok”.

Compiler directives

• $ indicator character: added $ as an indicator for compiler directive lines.

• >>IF directive: fixed bug #263, where nested >>IF directives were not handled cor-
rectly.

xxxiv
Changelog

• New constants: GCCOMP, GNUCOBOL.

• New directives: >>CALL-CONVENTION, >>LISTING, >>PAGE.

• New directives (detection only): *CBL, *CONTROL, TITLE.

• New >>SET phrase: SOURCEFORMAT.

Identification division

• Comment paragraphs: fixed invalid parsing of quote characters inside comment


paragraphs (bug #297).

• FUNCTION-ID: added checks for redefinition of function-names.

• INITIAL phrase: fixed premature deallocation of INITIAL programs (bug #52).

• OPTIONS paragraph: added with implementation of DEFAULT ROUNDED MODE


and ENTRY-CONVENTION phrases and recognition of INTERMEDIATE ROUNDING
phrase.

• PROGRAM-ID: added checks for redefinition of program-names.

• PROGRAM-ID phrases: permit INITIAL or RECURSIVE before COMMON (bug #244).

• Program/function-names: warn if program/function-names contain spaces.

Environment division

• ASSIGN clause: missing ASSIGN clauses are now detected at compile-time.

• ASSIGN clause: added PRINTER and PRINTER-1 device-names for writing to a


printer.

• ASSIGN clause: added CARD-PUNCH, CARD-READER, CASSETTE, INPUT, INPUT-


OUTPUT, MAGNETIC-TAPE and OUTPUT device-names for line sequential devices.

• ASSIGN clause: temporarily prohibit BASED and linkage items in ASSIGN USING
due to bug #421.

• CALL-CONVENTION phrase: statically calling functions with CALL-CONVENTION


74 no longer causes linker errors (bug #316).

• CURRENCY phrase: fixed bug #182, where a preceding SWITCH phrase caused an
incorrect duplicate CURRENCY clause error.

• File-control entry: fixed bug #71, where referring to a global constant caused an
internal error.

xxxv
Changelog

• File-control entry: fixed bug #331, where using an identifier in a file record qualified
with the file’s name caused an error.

• FUNCTION phrase: added checks for redefinition of function-(prototype-)names.

• FUNCTION phrase: compiler will no longer stop when it encounters a syntax error.

• LOCK MODE clause: fixed combination of LOCK MODE IS AUTOMATIC/MANUAL


with LOCK ON MULTIPLE.

• PROGRAM phrase: added support for program-prototype-names.

• SIGN clause: improved syntax checks.

• SWITCH phrase: added check for duplicate on/off clauses (bug #136).

• SWITCH phrase: added new switch names: SWITCH-16 through to SWITCH-36


(feature request #65), “SWITCH 1” to “SWITCH 26” (and their aliases “SWITCH A”
to “SWITCH Z”), UPSI-0 to UPSI-8 (equivalent to “SWITCH 0” to “SWITCH 8”) and
USW-0 to USW-31 (equivalent to “SWITCH 0” to “SWITCH 31”).

Data division

• 78-level items: strengthened syntax checks.

• 88-level items: strengthened syntax checks.

• ANY NUMERIC clause: ANY NUMERIC items must now have PIC 9.

• ANY LENGTH clause: ANY LENGTH items may no longer be BY VALUE parameters
(see bug #219).

• ANY LENGTH clause: ANY LENGTH items must now have PIC X or PIC N.

• BLANK clause: fixed bug #143, where BLANK LINE/SCREEN did not colour line/
screen.

• BLANK WHEN ZERO clause: added checks that BLANK WHEN ZERO is not speci-
fied with PICTURE clauses containing S.

• Constant items: expressions in VALUE clauses now permitted.

• Data description: added a maximum record length.

• Data description: increased maximum size of non-indexed file record to 64 MiB


(maximum size of an indexed file record is 65535 bytes).

• ERASE clause: fixed bug #186, where ERASE EOL and ERASE EOS could be speci-
fied simultaneously.

xxxvi
Changelog

• FULL clause: added warning for useless FULL clauses on numeric items (feature
request #209).

• HIGHLIGHT and LOWLIGHT clauses: added checks that HIGHLIGHT and LOW-
LIGHT are not specified simultaneously.

• Local-storage section: fixed bug #78, where local-storage items where initialised
after file section items.

• LOWLIGHT clause: implemented.

• OCCURS clause: fixed internal compiler when used with SYNC (bug #155).

• OCCURS clause: allow KEY phrase and INDEXED phrase in any order.

• OCCURS clause: fixed bug #167, where overly large numeric literals where ac-
cepted in the OCCURS clause.

• OCCURS clause (depending): require the minimum length to be less than the max-
imum length (feature request #99).

• OCCURS clause (depending): disabled nested OCCURS DEPENDING tables due to


bugs.

• OCCURS clause (screen-section): require relative LINE/COLUMN clauses in OC-


CURS entries (bug #83).

• OCCURS clause (unbounded): added by Frank Swarbrick (patch #50).

• PICTURE clause: restricted number of permitted PICTURE strings (bug #232).

• PICTURE clause: improved checks of constant-names referenced in PICTURE strings.

• RENAMES items: strengthened syntax checks.

• RESERVE clause: allow the optional word AREAS.

• Screen description: permit figurative constants in screen items (bug #108).

• TALLY special register: added.

• USAGE clause: added ACUCOBOL’s HANDLE phrases (see feature request #77).

• VALUE clause: VALUE clauses in REDEFINES entries now cause warnings, not
errors, for compatibility.

• Variable records: added checks that the minimum size of a variable record is large
enough to contain the record key.

xxxvii
Changelog

Procedure division

• ACCEPT statement: added ESCAPE as synonym for EXCEPTION.

• ACCEPT statement: permit clauses in any order.

• ACCEPT statement: allow WITH before every screen attribute clause.

• ACCEPT statement: entering control-C now terminates the program.

• ACCEPT statement (screen): fixed failed ACCEPTs caused by a buffer overflow.

• ACCEPT statement (screen): enhanced support for special keys (insert, tab, delete,
alt-delete, etc.).

• ACCEPT statement (screen): fixed bug #161 where screens terminated after en-
tering a few characters in a field.

• ACCEPT statement (screen): added DEFAULT as synonym for UPDATE.

• ACCEPT statement (screen): ERASE and BLANK clauses in screens are now ig-
nored (bug #192).

• ACCEPT statement (screen): fixed bug #160 where ACCEPT statement LINE/COLUMN
clauses did not work.

• ACCEPT statement (screen): fixed segfault on ACCEPT OMITTED (bug #300).

• ACCEPT statement (screen): added checks that screen attributes are not speci-
fied multiple times or after conflicting attributes.

• ACCEPT statement (screen): fixed some phrases not being recognised without
being preceded by WITH (bug #402).

• ACCEPT statement (screen): fixed the backspace and delete keys not working
and the insert key not toggling between insertion and overwriting.

• ACCEPT statement (screen): cursor now changes with insertion/overwrite mode


(if supported by the terminal).

• ACCEPT statement (screen): a beep is emitted on attempts to insert data into a


full field.

• ADD statement (corresponding): restricted to numeric items (bug #235).

• ADD statement (table): added detection of ADD TABLE.

• Addition of COMP-3 numbers: fixed bug where COMP-3 addition failed.

• Addition of floating-point numbers: fixed incorrect addition of floating-point num-


bers.

xxxviii
Changelog

• CALL statement: implemented feature request #101, allowing more arguments to


be provided.

• CALL statement: fixed behaviour when calling cancelled modules.

• CALL statement: added RETURNING NOTHING.

• CALL statement: the generation of C function declarations for static CALLs can
now be disabled.

• CALL statement: added checks for static CALLs referring to C macros.

• CALL statement: warn if a literal containing the program-name contains spaces.

• CALL statement: added detection of NESTED phrase.

• CANCEL statement: fixed crash caused by cancelling a cancelled module.

• Conditions: restricted use of IS (bug #321).

• Conditions: added warnings for always true/false conditions (including the reason
why it is always true/false).

• DESTROY statement: added detection of DESTROY.

• DISPLAY statement: permit clauses in any order.

• DISPLAY statement: allow WITH before every screen attribute clause.

• DISPLAY statement (screen): fixed bug where EC-SCREEN exceptions did not trig-
ger ON EXCEPTION handler (bug #243).

• DISPLAY statement (screen): fixed bugs in DISPLAY SPACES/ALL X“02”/ALL X“07”.

• DISPLAY statement (screen): added checks that screen attributes are not speci-
fied multiple times or after conflicting attributes.

• DISPLAY statement (screen): DISPLAY OMITTED marked as unfinished; currently


equivalent to DISPLAY LOW-VALUE.

• DISPLAY statement (screen): fixed some phrases not being recognised without
being preceded by WITH (bug #402).

• END DECLARATIVES phrase: fixed bug #88, where an erroneous unreachable code
warning was emitted for code without a main procedure.

• ENTRY statement: suppress incorrect unreachable code warnings.

• Exception handlers: permit NOT ON EXCEPTION/END-OF-PAGE/etc. before ON


EXCEPTION/END-OF-PAGE/etc.

xxxix
Changelog

• EXIT statement: added extension RETURNING/GIVING clause for PROGRAM phrase.

• File I-O: added detection of and handling for error when no disc space is available
for output files.

• File I-O: added RETRY and ADVANCING ON LOCK as pending features.

• File I-O: fixed detection of DISAM file handler.

• FREE statement: NULL addresses no longer cause an exception.

• GOBACK statement: added extension RETURNING/GIVING clause.

• INITIALIZE statement: fixed bug #84, where literals could be passed to INITIALIZE.

• INITIALIZE statement: fixed bug #287, where reference-modified group items were
not treated like elementary items.

• INSPECT statement: fixed bug #47, where clauses were permitted in invalid or-
ders.

• LENGTH OF phrase: fixed bug #89, where the length of REDEFINES item where
calculated incorrectly.

• LENGTH OF phrase: fixed bug #110, where LENGTH OF was not allowed in the
UNTIL phrase of a PERFORM statement or in a VALUE clause.

• MERGE statement: added recognition of more COLLATING SEQUENCE phrases.

• MOVE statement: added more checks for overlapping MOVE statements.

• MOVE statement: fixed truncation of COMP numbers not conforming to the binary-
truncate setting (bug #69).

• MOVE statement: fixed bug #344, where trying to MOVE to a procedure-name


caused a segfault.

• MOVE statement: added support for IBM’s character-by-character MOVE.

• PERFORM statement: fixed bug #368, where the compiler segfaulted when there
was a PERFORM statement with an empty body and DEBUGGING MODE was spec-
ified.

• Procedure division header: fixed bug #55, where a user-defined function without
parameters failed to compile.

• Procedure division header: disabled the BY VALUE phrase, pending a working im-
plementation.

xl
Changelog

• Procedure division header: fixed bug #349, where BY VALUE pointer parameters
lead to code that couldn’t be compiled by older versions of Microsoft Visual C++
(patched by Mario Matos).

• Procedure division header: RETURNING items must now be declared in the link-
age section.

• Procedure division header: added RETURNING OMITTED.

• Procedure division header: added entry-convention specifiers.

• Procedure division header: now mandatory in function definitions (see bug #271).

• Procedure division header: CHAINING programs may no longer be called by other


programs (bug #354), per the ACUCOBOL implementation.

• Reference modification: fixed bug #146, where the length of reference-modified


item in an OCCURS DEPENDING table was too long because it was assumed the
OCCURS DEPENDING table was at its maximum size.

• READ statement: a failed second READ of a missing OPTIONAL file now results
in a file status of 46, not 23.

• REWRITE statement: added REWRITE FILE (feature request #170).

• Screen I-O: added detection of situations which raise EC-SCREEN-LINE-NUMBER,


EC-SCREEN-STARTING-COLUMN and EC-SCREEN-ITEM-TRUNCATED.

• Screen I-O: added support for the LINE 0 and COL 0 extensions.

• Screen I-O: added some ACUCOBOL synonyms (NO ECHO, OFF, REVERSED, RE-
VERSE, etc.).

• Screen I-O: added detection of ACUCOBOL’s non-standard clauses like TAB, NO-
ECHO, STANDARD, BACKGROUND-HIGH, BACKGROUND-LOW, BACKGROUND-STANDARD
and SIZE.

• SEARCH statement (ALL): fixed bug #314, where SEARCH ALL with an empty OC-
CURS DEPENDING table did not exit as soon as possible.

• Segment numbers: added syntax checks.

• SET statement (address): disallowed changing address of non-01/77-level item


(bug #366).

• SET statement (attribute): made HIGHLIGHT ON imply LOWLIGHT OFF and vice
versa.

• SET statement (exception): added.

xli
Changelog

• SET statement (thread): added detection of ACUCOBOL extension.

• STOP statement (identifier): added (see bug #320).

• STOP statement (literal): fixed segfault.

• STOP statement (thread): added detection of ACUCOBOL extension.

• STRING statement: strengthened syntax checks (bug #259).

• SUBTRACT statement (corresponding): restricted to numeric items (bug #235).

• SUBTRACT statement (table): added detection of SUBTRACT TABLE.

• Tracing: fixed bug #216, where a segfault occurred with a program made from
modules some of which had been compiled with tracing and physical CANCEL
enabled and some of which hadn’t.

• UNSTRING statement: fixed bug #54, where the POINTER value was calculated
incorrectly when the delimiter was longer than one character.

• UNSTRING statement: allow a literal to be the subject of an UNSTRING.

• WRITE statement: added WRITE FILE (feature request #170).

Intrinsic functions

• New functions (ACUCOBOL): ABSOLUTE-VALUE (synonym for ABS).

• New functions (COBOL 2014): FORMATTED-CURRENT-DATE, FORMATTED-DATE,


FORMATTED-DATETIME, FORMATTED-TIME, INTEGER-OF-FORMATTED-DATE, TEST-
FORMATTED-DATETIME.

• ISO-8601-date-handling functions: added extension SYSTEM-OFFSET as replace-


ment for last optional argument.

• ISO-8601-date-handling functions: added EC-IMP-UTC-UNKNOWN if a time for-


mat ending in Z is provided but the timezone cannot be found.

• LENGTH function: added detection of PHYSICAL phrase.

• RANDOM function: fixed non-random number generation.

Built-in subprograms

• CBL_GC_FORK: added.

• CBL_GC_PRINTABLE: renamed from C$PRINTABLE.

• CBL_GC_WAITPID: added.

xlii
Changelog

• CBL_SET_CSR_POS: added (feature requests #148 and #187).

• CBL_READ_KBD_CHAR: added (feature requests #148 and #187).

xliii
Changelog

1
1. Key

Element Notes
Braces, { } One element within the braces must be se-
lected.
Brackets, One or zero elements within the brackets


must be selected.
Vertical lines, | | Each element may be selected once and in
any order; if within braces, at least one ele-
ment must be selected.
Ellipsis, . . . The preceding element may be repeated any
number of times.
OPTIONAL-RESERVED-WORD
MANDATORY-RESERVED-WORD Mandatory reserved words in brackets are
often used instead of optional reserved
words to indicate an optional feature.
Deleted element These elements were previously in the
COBOL standard but have since been
deleted. Their use is strongly discouraged.
Archaic element These elements remain in the standard, but
their use is considered poor style and is
strongly discouraged.
Obsolete element These elements are slated to be deleted
from the standard. Their use is strongly dis-
couraged.
X/Open extension
GnuCOBOL-only extension
Miscellaneous extension An extension which may have come from
COBOL dialects by AcuCorp, CA, Fujitsu,
HP, IBM, Micro Focus, Microsoft or Ryan-
McFarland.
Unimplemented element These elements are recognised by Gnu-
COBOL, but are non-functional.

3
2. Language fundamentals
2.1. Lexical elements
2.1.1. COBOL words
2.1.2. User-defined words
2.1.3. Reserved words
2.1.4. Literals
Alphanumeric literals

Format 1 (standard)

h i 
' character-1 . . . ' 
h i
" character-2 . . . "

Format 2 (hexadecimal)

 h i 
X' hex-character-1 . . . ' 
h i
X" hex-character-2 . . . "

Format 3 (null-terminated)

 h i 
Z' character-3 . . . ' 
h i
Z" character-4 . . . "

5
2. Language fundamentals

Format 4 (raw-C-string)

 h i 
L' character-5 . . . ' 
h i
L" character-6 . . . "

Numeric literals

Format 5 (integer)

 
0

 

1 

 
 

2

 
 

 
3

 

 

" #
 
+ 4
 
...
- 

5

6

 

 

7

 


 

 
8

 


 

 
9
 

Format 6 (fixed-point)

   
0 

 0

1  1
  
 

 

2 2
  
 


 

   
3 3
  
 

  
 

" #  () 
+ 4 . 4

 

 . . . ...

- 
5
 , 

 5

6 6 
  
 
 

7  7
  
 


 

   
8 8
  
 


 
  
9 9

 

Format 7 (floating-point)

6
2. Language fundamentals

     
0 0 

0

1  1  1
    
 


 

2 2 2
    
 


 

     
3 3 3
    
 

 
" #  ()  " # 
 

+ 4 . 4 + 4
    
 
. . . , 5. . . E - 5. . .
   
5
-    
 

6 6 6
    
 


 

7  7  7
    
 


 
     
8 8 8
    
 

    
 

 
9 9 9

 

Format 8 (binary)

( )
0
B# ...
1

Format 9 (octal)

 

 0
1

 


 

 
2

 


 

( ) 
O# 3

 
...
% 4 

 

5 

 
 

6 

 
 

 
7
 
 

Format 10 (hexadecimal-number)

7
2. Language fundamentals

 

 0
1

 


 

 
2

 


 
( )  
H# 3
 
...
X# 
4 



5 

 

 
6

  

 


 
7
 

Format 11 (hexadecimal-string)

 h i 
H' character-7 . . . ' 
h i
H" character-8 . . . "

Boolean literals

Format 12 (standard)

 h i 
B' character-9 . . . ' 
h i
B" character-10 . . . "

Format 13 (hexadecimal)

 h i 
BX' hex-character-3 . . . ' 
h i
BX" hex-character-4 . . . "

National literals

Format 14 (standard)

8
2. Language fundamentals

 h i 


 N' character-11 ...' 


 h i 
N" character-12 . . . "

 


 


h i

 NC' character-13 ...' 


 

 h i 
 NC" character-14 . . . "

 

 

Format 15 (hexadecimal)

 h i 
NX' hex-character-5 . . . ' 
h i
NX" hex-character-6 . . . "

Figurative constants

Format 16 (zero)

 
ZERO 
 
ALL ZEROES
ZEROS

 

Format 17 (space)

( )
SPACE
ALL
SPACES

Format 18 (high-value)

( )
HIGH-VALUE
ALL
HIGH-VALUES

9
2. Language fundamentals

Format 19 (low-value)

( )
LOW-VALUE
ALL
LOW-VALUES

Format 20 (quote)

( )
QUOTE
ALL
QUOTES

Format 21 (null)

( )
NULL
ALL
NULLS

Format 22 (literal)

ALL literal-1

Format 23 (symbolic-character)

ALL symbolic-character-1

10
2. Language fundamentals

2.2. References

11
2. Language fundamentals

2.3. Expressions
2.3.1. Arithmetic expressions
Arithmetic expressions may contain the following operators:

Binary operators Purpose Precedence


+ addition 1
– subtraction 1
* multiplication 2
/ division 2
** exponentiation 3
ˆ exponentiation 3

Unary operators
+ no effect 4
– multiplication by −1 4

Binary operators must have a numeric item or expression to both their left and right.
Unary operators must have a numeric item or expression to their right only.
Operators with greatest precedence are evaluated first. If an expression contains mul-
tiple operators of equal precedence, they are evaluated from left to right.
Arithmetic expressions may contain arithmetic expressions surrounded by parenthe-
ses. These nested expressions are evaluated first, before any of the operators of the
outer expression.

Second symbol
First symbol
Identifier or literal Binary operator Unary operator ( )
Identifier or literal 3 3
Binary operator 3 3 3
Unary operator 3 3
( 3 3 3
) 3 3

12
2. Language fundamentals

2.3.2. Concatenation expressions


( )
literal-1
& literal-2
concatenation-expression-1

2.3.3. Conditional expressions

Binary operators Purpose Precedence


AND logical and 1
OR logical or 2
Unary operator
NOT logical not 3

13
2. Language fundamentals

2.4. Concepts
2.4.1. Files
I-O status

Successful completion of an operation

00 Success

02 Success – duplicate

04 Success – incomplete

05 Success – optional

07 Success – no unit

Implementor-defined successful completion

End of file

10 End of file

14 Out of key range

21 Key invalid

22 Key exists

23 Key does not exist

24 Key boundary

30 Permanent I-O error

31 Inconsistent filename

34 Boundary violation

35 File does not exist

37 Permission denied

38 Closed with lock

39 Conflict attribute

14
2. Language fundamentals

41 File already open

42 File not open

43 Read not done

44 Record overflow

46 Read error

47 Input denied

48 Output denied

49 I-O denied

51 Record locked

57 I-O linage

61 File sharing

71 Bad character

91 Not available

Organizations

Locking

2.4.2. Locales
2.4.3. Screens
2.4.4. User-defined functions

15
3. Compiler directives
3.1. CALL-CONVENTION directive

COBOL 
 

 
EXTERN 
 
>>CALL-CONVENTION


 STDCALL


STATIC
 

Syntax rules

General rules

17
3. Compiler directives

3.2. *CONTROL statement

SOURCE 
 

 
NOSOURCE

 
 

( ) 
*CBL LIST

 

*CONTROL 

NOLIST 


MAP

 

 

NOMAP

 

Syntax rules

General rules

18
3. Compiler directives

3.3. COPY statement


( )( ) "( ) ( )#
COPY literal-1 IN literal-2
INCLUDE text-name-1 OF library-name-1
h i
SUPPRESS PRINTING
     
== pseudo-text-1 == == pseudo-text-2 ==


    

 identifier-1 BY identifier-2
 
 
 
  

  
REPLACING literal-3 literal-4 ...
.
  
 
 
 
 ( )
LEADING
 
 
 

 TRAILING == partial-word-1 == BY == partial-word-2 ==
  


  

Syntax rules

General rules

19
3. Compiler directives

3.4. D directive
>>D source-text-1

Syntax rules

General rules

20
3. Compiler directives

3.5. DEFINE directive


( ) 
( ) literal-1 h i
>> OVERRIDE 
h i 

DEFINE CONSTANT compilation-variable-1 AS PARAMETER
$
OFF

 

Syntax rules

General rules

21
3. Compiler directives

3.6. DISPLAY directive


Format 1 (general)

( )
>>
DISPLAY source-text-1
$

Format 2 (vcs)

$DISPLAY VCS = version-string

Syntax rules

General rules

22
3. Compiler directives

3.7. EJECT statement

EJECT

Syntax rules

General rules

23
3. Compiler directives

3.8. IF directive

DEFINED
 
( )  

>> SET
 

IF compilation-variable-1 IS NOT
$ relation
 

 
compilation-variable-2
 

source-text-1
"( )( ) #
>> ELIF
condition-1 source-text-2 . . .
$ ELSE-IF

"( ) #
>>
ELSE source-text-3
$
" #
>>END-IF
$END

Syntax rules

General rules

24
3. Compiler directives

3.9. LEAP-SECOND directive

>>LEAP-SECOND

Syntax rules

General rules

25
3. Compiler directives

3.10. LISTING directive


( )
ON
>>LISTING
OFF

Syntax rules

General rules

26
3. Compiler directives

3.11. @OPTIONS directive


h i
@OPTIONS options-text

Syntax rules

General rules

27
3. Compiler directives

3.12. PAGE directive


h i
>>PAGE comment-text

Syntax rules

General rules

28
3. Compiler directives

3.13. PROCESS statement

PROCESS

Syntax rules

General rules

29
3. Compiler directives

3.14. REPLACE statement


Format 1 (on)

( ) ( ) 
== pseudo-text-1 == == pseudo-text-2 ==
BY

 

 
h  identifier-1
i identifier-2


REPLACE ALSO ( ) ....
LEADING
 TRAILING == partial-word-1 == BY == partial-word-2 ==

 


 

Format 2 (off)

h i
REPLACE LAST OFF.

Syntax rules

General rules

30
3. Compiler directives

3.15. SET directive

CONSTANT compilation-variable-1 literal-1


 

 

 
 XFD literal-2
( )  
>>
 

SET h i
$ 

 compilation-variable-2 literal-3 



 

micro-focus-directive
 

Syntax rules

General rules

31
3. Compiler directives

3.16. SKIP1 statement

SKIP1

Syntax rules

General rules

32
3. Compiler directives

3.17. SKIP2 statement

SKIP2

Syntax rules

General rules

33
3. Compiler directives

3.18. SKIP3 statement

SKIP3

Syntax rules

General rules

34
3. Compiler directives

3.19. SOURCE directive



FIXED

 

>>SOURCE FORMAT IS FREE
 VARIABLE
 

Syntax rules

General rules

35
3. Compiler directives

3.20. TITLE statement


TITLE literal-1

Syntax rules

General rules

36
3. Compiler directives

3.21. TURN directive


( h i)
n o ON WITH LOCATION
>>TURN exception-name-1 . . . CHECKING
OFF

Syntax rules

General rules

37
3. Compiler directives

3.22. Micro Focus directives


3.22.1. ADDRSV directive
( )
ADDRSV
literal-1 . . .
ADD-RSV

Syntax rules

General rules

38
3. Compiler directives

3.22.2. ADDSYN directive


( )
ADDSYN
literal-1 = literal-2
ADD-SYN

Syntax rules

General rules

39
3. Compiler directives

3.22.3. ASSIGN directive


( )
"EXTERNAL"
ASSIGN
"DYNAMIC"

Syntax rules

General rules

40
3. Compiler directives

3.22.4. BOUND directive


Format 1 (enable)

BOUND

Format 2 (disable)

( )
NOBOUND
NO-BOUND

Syntax rules

General rules

41
3. Compiler directives

3.22.5. CALLFH directive


h i
CALLFH literal-1

Syntax rules

General rules

42
3. Compiler directives

3.22.6. COMP1 directive


( )( )
COMP1 "BINARY"
COMP-1 "FLOAT"

Syntax rules

General rules

43
3. Compiler directives

3.22.7. FOLDCOPYNAME directive


Format 1 (enable)

( ) ( )
FOLDCOPYNAME "UPPER"
AS
FOLD-COPY-NAME "LOWER"

Format 2 (disable)

 
NOFOLDCOPYNAME 
 
NOFOLD-COPY-NAME
NO-FOLD-COPY-NAME

 

Syntax rules

General rules

44
3. Compiler directives

3.22.8. MAKESYN directive


( )
MAKESYN
literal-1 = literal-2
MAKE-SYN

Syntax rules

General rules

45
3. Compiler directives

3.22.9. OVERRIDE directive


n o
OVERRIDE literal-1 = literal-2 . . .

Syntax rules

General rules

46
3. Compiler directives

3.22.10. REMOVE directive


REMOVE literal-1 . . .

Syntax rules

General rules

47
3. Compiler directives

3.22.11. SOURCEFORMAT directive


 
( ) "FIXED"
SOURCEFORMAT  

"FREE"
SOURCE-FORMAT 
"VARIABLE"
 

Syntax rules

General rules

48
3. Compiler directives

3.22.12. SSRANGE directive


Format 1 (enable)

"1"
 

SSRANGE "2" 
 

"3"

Format 2 (disable)

( )
NOSSRANGE
NO-SSRANGE

Syntax rules

General rules

49
3. Compiler directives

3.23. Predefined compilation variables


GnuCOBOL defines compilation variables when certain conditions are true. If the condi-
tion associated with a variable is false, the variable is not defined.

Name Condition
DEBUG The -d debug flag is specified.
EXECUTABLE The module being compiled contains the main program.
GCCOMP The size of a COMP item is determined according to the Gnu-
COBOL scheme, where for a PICTURE of length:

• 1–2, the item has 1 byte

• 3–4, the item has 2 bytes

• 5–9, the item has 4 bytes

• 10–18, the item has 8 bytes.

GNUCOBOL GnuCOBOL is compiling the source unit.


HOSTSIGNS A signed packed-decimal item’s value may be considered NU-
MERIC if the sign has value X"F".
IBMCOMP The size of a COMP item is determined according to the IBM
scheme, where for a PICTURE of length:

• 1–4, the item has 2 bytes

• 5–9, the item has 4 bytes

• 10–18, the item has 8 bytes.

MODULE The module being compiled does not contain the main pro-
gram.
NOHOSTSIGNS A signed packed-decimal item’s value may not be considered
NUMERIC if the sign has value X"F".
NOIBMCOMP The size of a COMP item is not determined according to the
IBM scheme.
NOSTICKY- Sticky-linkage (linkage-section items remaining allocated be-
LINKAGE tween invocations) is not enabled.
NOTRUNC Numeric data items are truncated according to their internal
representation.

50
3. Compiler directives

OCCOMP The size of a COMP item is determined according to the Gnu-


COBOL scheme, where for a PICTURE of length:

• 1–2, the item has 1 byte

• 3–4, the item has 2 bytes

• 5–9, the item has 4 bytes

• 10–18, the item has 8 bytes.

OPENCOBOL GnuCOBOL is compiling the source unit.


P64 Pointers are greater than 32 bits long.
STICKY-LINKAGE Sticky-linkage (linkage-section items remaining allocated be-
tween invocations) is enabled.
TRUNC Numeric data items are truncated according to their PICTURE
clauses.

51
4. Compilation group
" #
program-definition
...
function-definition

where program-definition is
"( ) #
IDENTIFICATION
DIVISION.
ID
   

 COMMON 
 ( )  
 INITIAL
( )    
program-name-1 h i    
PROGRAM-ID. AS literal-2 IS  RECURSIVE  PROGRAM.
   
literal-1    
  
 
 EXTERNAL

 


h i
comment-paragraphs
h i
environment-division
h i
data-division
h h i i
procedure-division program-definition . . .
" ( )#
program-name-1
END PROGRAM .
literal-1

where function-definition is
"( ) #
IDENTIFICATION
DIVISION.
ID
( )
function-name-1 h i
FUNCTION-ID. AS literal-4 .
literal-3
h i
comment-paragraphs
h i
environment-division
h i
data-division
h i
procedure-division
( )
function-name-1
END FUNCTION .
literal-3

53
4. Compilation group

Syntax rules

General rules

54
5. Identification division
"( ) #
IDENTIFICATION
DIVISION.
ID
( )
function-id-paragraph
program-id-paragraph
h i
options-paragraph
AUTHOR. comment-text.
 


 DATE-WRITTEN. comment-text. 
 
 DATE-MODIFIED. comment-text. 
 
 DATE-COMPILED. comment-text.  . . .
 
 
 INSTALLATION. comment-text. 
 
 REMARKS. comment-text.
 


SECURITY. comment-text.

Syntax rules

General rules

5.1. PROGRAM-ID paragraph


( )
program-name-1 h i
PROGRAM-ID. AS literal-2
literal-1
   
  COMMON  
 
  
 

INITIAL
  
  
  
      
 
PROGRAM
   
RECURSIVE
     
  
 
   
 
IS  .

 

RESIDENT
 
 
  

   

   
 
( )


 
PROTOTYPE
   
 



 
   
 EXTERNAL PROGRAM
 

56
5. Identification division

Syntax rules

General rules

57
5. Identification division

5.2. FUNCTION-ID paragraph


( )
function-name-1 h i
FUNCTION-ID. AS literal-2 .
literal-1

Syntax rules

General rules

58
5. Identification division

5.3. OPTIONS paragraph

OPTIONS.
  


 NATIVE 


STANDARD
 
 
 
 
 
 
 
 
 
STANDARD-BINARY
  
ARITHMETIC IS
 

   
 STANDARD-DECIMAL
 
 
 
 
 
 
  
 
 
 OSVS
 

 
AWAY-FROM-ZERO


 

NEAREST-AWAY-FROM-ZERO
 
 

 
 

 
NEAREST-EVEN
 
 

 
 

 
 NEAREST-TOWARD-ZERO
 

DEFAULT ROUNDED MODE IS
 
PROHIBITED

  

  
 TOWARD-GREATER





  
TOWARD-LESSER
 
 

 
 

 
TRUNCATION

 

 
COBOL 

 
ENTRY-CONVENTION IS EXTERN 
 

STDCALL

 

NEAREST-AWAY-FROM-ZERO
  

 
 NEAREST-EVEN
 

INTERMEDIATE ROUNDING IS  .
 
PROHIBITED
 
 


TRUNCATION
 

Syntax rules

General rules

59
6. Environment division
h i
ENVIRONMENT DIVISION.
h i
configuration-section
h i
input-output-section

Syntax rules

General rules

6.1. Configuration section


Format 1 (standard)

CONFIGURATION
h SECTION. i
source-computer-paragraph
h i
object-computer-paragraph
h h i i
special-names-header special-names-entry . . .
h i
repository-paragraph

Format 2 (micro-focus-and-gnucobol)

h i
CONFIGURATION SECTION.
 
source-computer-paragraph

 object-computer-paragraph 
 
 special-names-header
 

 
 special-names-entry
 

repository-paragraph

61
6. Environment division

Syntax rules

General rules

6.1.1. SOURCE-COMPUTER paragraph


The SOURCE-COMPUTER paragraph identifies the computer on which the compilation
unit should be compiled.
n o h i 
SOURCE-COMPUTER. computer-name-1 . . . WITH DEBUGGING MODE .

Syntax rules

General rules

62
6. Environment division

6.1.2. OBJECT-COMPUTER paragraph


The OBJECT-COMPUTER paragraph identifies the computer on which the runtime mod-
ule should be run.
OBJECT-COMPUTER.
hn o i
computer-name-1 . . .

     

 
 CHARACTERS 


  MEMORY SIZE IS integer-1 WORDS
   
 
   
MODULES
  
 
  
   
 PROGRAM COLLATING SEQUENCE collating-sequences 
   

. . . .
   
  SEGMENT-LIMIT IS integer-2
 
 
locale-name-1
    
     
     
  LOCALE
 
 
 CHARACTER CLASSIFICATION IS
   
SYSTEM-DEFAULT
 
  
   

USER-DEFAULT
 

where collating-sequences is:


 h i 
IS alphanumeric-collating-sequence national-collating-sequence

 


 

( )
FOR ALPHANUMERIC IS alphanumeric-collating-sequence

 

FOR NATIONAL IS national-collating-sequence

 

Syntax rules

General rules

63
6. Environment division

6.1.3. SPECIAL-NAMES paragraph


h i
SPECIAL-NAMES.

 
mnemonic-name-clause


 

alphabet-name-clause





 

 
 
symbolic-characters-clause

 
 

 
 
  
symbolic-constant-class

 
 

 
 
 
LOCALE locale-name-1 IS literal-1

 
 

 
 
  
class-clause

 
 

 
 
 h i 
CURRENCY SIGN IS literal-2 WITH PICTURE-SYMBOL literal-3

 
 

 
 
  
 DECIMAL-POINT IS COMMA ... .. . .
 
  
 NUMERIC SIGN IS TRAILING SEPARATE

 
 
 
 
 
CURSOR IS identifier-1

 
 

 
 
CRT STATUS IS identifier-2

 
 

 
 

 
 
SCREEN-CONTROL IS identifier-3

 
 

 
 

 
 

 
 
EVENT-STATUS IS identifier-4

 
 

 
 

 
 
 TOP IS identifier-5
 

where mnemonic-name-clause is

IS CRT
 
 

integer-1 IS system-name-1
 

mnemonic-name-1 h (
i ON STATUS IS switch-status-name-1 
)
 IS switch-name-1

 
 
OFF STATUS IS switch-status-name-2

where alphabet-name-clause is

64
6. Environment division

ALPHABET
 alphabet-name-1 IS 

 
 ASCII 


EBCDIC

 
 



 
 


  
STANDARD-1

 
 



 
 


  
STANDARD-2

 
 



  


  
NATIVE
 h i 
FOR ALPHANUMERIC

 


 

LOCALE

 
 



 
 


  ( )  
THROUGH
 
 

  
literal-5

 

 
 



THRU
  
literal-4 . . .

 
   



 
   


  n o  
ALSO literal-6 . . .
 

 
 


UTF-8

   


 
 
 

   
UTF-16

 
 
 


 
 
 

   
UCS-4

 
 
 


 
 
 

   
NATIVE

 h i 
 
 

 
FOR NATIONAL

 

LOCALE

 


 
 
 

   ( )    
THROUGH

 
 
 

literal-8

 
 
 
 
 

     
literal-7 THRU . . .

 
   
 


 
   
 

  n o   
ALSO literal-9 . . .

 
 
 
 
 

   

where symbolic-characters-clause is
SYMBOLIC
( CHARACTERS ( ) )
n o IS n o h i
symbolic-character-name-1 . . . integer-2 . . . . . . IN WORD
ARE

where symbolic-constant-clause is
n o
SYMBOLIC CONSTANT identifier-6 IS literal-10 . . .

where class-clause is
" # ( "( ) #)
FOR ALPHANUMERIC THRU
CLASS class-name-1 IS literal-11 literal-12 . . .
FOR NATIONAL THROUGH

h i
IN alphabet-name-1

Syntax rules

General rules

65
6. Environment division

6.1.4. REPOSITORY paragraph

REPOSITORY.
 (n o )  
function-name-1 . . .
FUNCTION INTRINSIC

 


ALL

 
 
  
... .
 h i 
FUNCTION function-name-2 AS literal-1

  


 h i 

 
PROGRAM program-name-1 AS literal-2

 

Syntax rules

General rules

66
6. Environment division

6.2. Input-output section


h i
INPUT-OUTPUT SECTION.
h i
file-control-paragraph
h i
i-o-control-paragraph

Syntax rules

General rules

6.2.1. FILE-CONTROL paragraph


h i
FILE-CONTROL.
h i
file-control-entry . . .

where file-control-entry is
 
actual-key-clause
assign-clause
 

access-mode-clause
 

 
alternate-record-key-clause 
 
collating-sequence-clause
 

 
collating-sequence-key-clause
 
file-limit-clause
 

file-status-clause
 

 
lock-mode-clause
 
" #  
OPTIONAL nominal-key-clause
 
SELECT file-name-1  . . . .
 
NOT OPTIONAL organization-clause
 

padding-character-clause
 

password-clause
 

 
record-delimiter-clause
 

record-key-clause
 

 
relative-key-clause 
 
reserve-clause
 

sharing-clause
 

 
track-area-clause
 

track-limit-clause

67
6. Environment division

where actual-key-clause is

ACTUAL KEY IS identifier-1

where assign-clause is
h i 
 device-or-line-adv-file literal-1





 
device

 "   

#
EXTERNAL

 
 
 

 ( ) 
external-file-name

 h i 

DYNAMIC device-or-line-adv-file

 

ASSIGN TO identifier-2

 

 ( ) 

 h i USING 

device-or-line-adv-file identifier-3

 

 
VARYING

 


 

 
DISK FROM identifier-4

 

where device-or-line-adv-file is
( )
device
LINE ADVANCING FILE

where device is
 


 CARD-PUNCH 


CARD-READER

 


 

 
CASSETTE

 


 

 
DISC

 


 

 
DISK

 


 

 
DISPLAY

 


 

 
INPUT

 


 

 
 INPUT-OUTPUT 
 


 KEYBOARD 


MAGNETIC-TAPE

 


 

 
OUTPUT

 


 

 
PRINT

 


 

 
PRINTER

 


 

 
PRINTER-1

 


 

 
RANDOM

 


 

 
TAPE
 

where access-mode-clause is

68
6. Environment division

 
SEQUENTIAL
 
ACCESS MODE IS DYNAMIC
RANDOM

 

where alternate-record-key-clause is
"( ) #
= n o
ALTERNATE RECORD KEY IS identifier-5 identifier-6 . . .
SOURCE IS
h h i i
WITH NO DUPLICATES

h i
PASSWORD IS identifier-7

h i
SUPPRESS WHEN literal-2

where collating-sequence-clause is
 h i 
IS alphanumeric-collating-sequence national-collating-sequence

 


 

COLLATING SEQUENCE ( FOR ALPHANUMERIC IS alphanumeric-collating-sequence )


 

FOR NATIONAL IS national-collating-sequence

 

where collating-sequence-key-clause is

COLLATING SEQUENCE OF identifier-8 IS alphabet-name-1

where file-limit-clause is
( )( ) (( )( )( ))
FILE-LIMIT IS identifier-9 THROUGH identifier-10
...
FILE-LIMITS ARE literal-3 THRU literal-4

where file-status-clause is
" #
FILE h i
STATUS IS identifier-11 identifier-12
SORT

where lock-mode-clause is

69
6. Environment division

LOCK
(( MODE IS ) " ( )#  )
MANUAL h i RECORD
WITH LOCK ON MULTIPLE WITH ROLLBACK

 

 
AUTOMATIC RECORDS

 

h i
 EXCLUSIVE WITH MASS-UPDATE

 


 

where nominal-key-clause is

NOMINAL KEY IS identifier-13

where organization-clause is
 

INDEXED 

"( ) # 
ORGANIZATION LINE SEQUENTIAL

 

IS
ORGANISATION  RECORD BINARY SEQUENTIAL
 
 
RELATIVE
 

where padding-character-clause is
( )
identifier-14
PADDING CHARACTER IS
literal-5

where password-clause is

PASSWORD IS identifier-15

where record-delimiter-clause is
 
 STANDARD-1
 

RECORD DELIMITER IS LINE-SEQUENTIAL
BINARY-SEQUENTIAL

 

where record-key-clause is
"( ) #
= n o
RECORD KEY IS identifier-16 identifier-17 . . .
SOURCE IS

h i
PASSWORD IS identifier-18

h h i i
WITH NO DUPLICATES

where relative-key-clause is

70
6. Environment division

RELATIVE KEY IS identifier-19

where reserve-clause is
( )" #
NO AREA
RESERVE
integer-1 AREAS

where sharing-clause is
 
ALL OTHER
 
SHARING WITH NO OTHER
READ ONLY

 

where track-area-clause is
( )
identifier-20
TRACK-AREA IS CHARACTERS
literal-6

where track-area-clause is
( )
TRACK
TRACK-LIMIT IS integer-2
TRACKS

Syntax rules

General rules

71
6. Environment division

6.2.2. I-O-CONTROL paragraph


h i
I-O-CONTROL.
 

 APPLY COMMIT ON identifier-1 . . . 


 

 
CORE-INDEX

   


   

   
EXTENDED-SEARCH

 
 
 


 
 
 

 
LOCK-HOLDING

   


 
 
 

   
APPLY PRINT-CONTROL ON file-name-1 . . .

 


 

 
RECORD-OVERFLOW

 
 
 


 
 
 

   
WRITE-ONLY

 
 
 


 
 
 

   
WRITE-VERIFY

   


 


 


 

 ( ) 
CYL-INDEX

 

APPLY TO integer-1 ON file-name-2 . . .

 

 
MASTER-INDEX

 


 


 


 

 ( ) 
TRACK ... .
APPLY CYL-OVERFLOW OF integer-2 ON file-name-3 . . .
TRACKS

 


 


 


 

 ( ) 
CORE-INDEX

 

 
APPLY TO identifier-2 ON file-name-4 . . .

 

REORG-CRITERIA

 


 


 

 
RECORD

   


 

 n o 
SAME SORT AREA FOR file-name-5 ...

   


   

 
SORT-MERGE

 


 


 n h io 

MULTIPLE FILE TAPE CONTAINS file-name-6 POSITION integer-3 ...

 


 


 


 

integer-4(RECORDS
   

  

 )   
RERUN ON file-name-7 EVERY
 
REEL

 

END OF

 

UNIT

  
 

 

Syntax rules

General rules

72
7. Data division
h i
DATA DIVISION.
h i
file-section
h i
working-storage-section
h i
communication-section
h i
local-storage-section
h i
report-section
h i
screen-section

Syntax rules

General rules

7.1. File section


h i
FILE SECTION.
( ( ) )
record-description
file-description-entry ... ...
constant-definition

74
7. Data division

Syntax rules

General rules

7.1.1. File description entry

block-clause
 
 h n o i 
 CODE-SET IS alphabet-name-1 FOR identifier-1 . . . 
 
 
 ( )" # 
 DATA RECORD IS
 n o 
identifier-2 . . .

RECORDS ARE
 
 
 
IS EXTERNAL
 

IS GLOBAL
 

 ( )" #( ) 
 LABEL RECORD IS STANDARD
 
 

RECORDS ARE OMITTED
 
 
 
linage-clause
 

 ( ) 
F
( ) 
FD
 
file-name-1  . . . .
 
 
 
FIXED
 
SD  
 
 
 
 ( ) 
 
V
 
 
 
 RECORDING MODE IS
 
 VARIABLE 

   
   
U
 
 
 
  
 
 
S
   
 
 
( ) 
 REPORT IS n o 
identifier-3 . . .
 
 REPORTS ARE
 

 
   
 FILE-ID   ( ) 
literal-1
  
 VALUE OF ID IS
 
identifier-5

identifier-4
 
 
 
 
 
record-clause

Syntax rules

General rules

75
7. Data division

7.2. Working-storage section

WORKING-STORAGE
" # SECTION.
constant-definition
...
record-description

Syntax rules

General rules

76
7. Data division

7.3. Communication section


" " # #
record-description
COMMUNICATION SECTION. communication-description-entry ... ...
constant-definition

7.3.1. Communication description entry


Format 1 (input)

SYMBOLIC QUEUE IS identifier-1


 


 
 SYMBOLIC SUB-QUEUE-1 IS identifier-2

 

 

 SYMBOLIC SUB-QUEUE-2 IS identifier-3 

 

 
 
 SYMBOLIC SUB-QUEUE-3 IS identifier-4 

 


 

 MESSAGE DATE IS identifier-5
 

 

 MESSAGE TIME IS identifier-6


 
SYMBOLIC SOURCE IS identifier-7
h i 
 
CD entry-name FOR INITIAL INPUT   .
  

 TEXT LENGTH IS identifier-8

 
  
 
 END KEY IS identifier-9

 
 
 
 
 STATUS KEY IS identifier-10
  
 
 
 MESSAGE COUNT IS identifier-11
  

 identifier-12 identifier-13 identifier-14
 

 identifier-15 identifier-16 identifier-17
 

identifier-18 identifier-19 identifier-20
 
identifier-21 identifier-22

Format 2 (output)

CD
entry-name FOR OUTPUT
DESTINATION COUNT IS identifier-23



 TEXT LENGTH IS identifier-24
 

 STATUS KEY IS identifier-25
 

 h n o i 
 DESTINATION TABLE OCCURS integer-1 TIMES INDEXED BY index-name-1 . . .  .
 
 
 ERROR KEY IS identifier-26 
 
 DESTINATION IS identifier-27
 

SYMBOLIC DESTINATION IS identifier-28

77
7. Data division

Format 3 (I-O)

CD entry-name FOR INITIAL I-O


MESSAGE DATE IS identifier-29
 
 

 
MESSAGE TIME IS identifier-30


  
  
 
 SYMBOLIC TERMINAL IS identifier-31

 
 

 TEXT LENGTH IS identifier-32 .
 
 
  
 END KEY IS identifier-33
  

 
 
 STATUS KEY IS identifier-34


 

identifier-35 identifier-36 identifier-37 identifier-38 identifier-39 identifier-40

78
7. Data division

7.4. Local-storage section

LOCAL-STORAGE
" SECTION.
#
constant-definition
...
record-description

Syntax rules

General rules

79
7. Data division

7.5. Linkage section

LINKAGE SECTION. #
"
constant-definition
...
record-description

Syntax rules

General rules

80
7. Data division

7.6. Report section

REPORT
" SECTION. #
constant-definition
...
report-description

Syntax rules

General rules

7.6.1. Report description

RD report-name-1

IS GLOBAL
 
( )
 identifier-1 
 WITH CODE IS
 
literal-1

 
... .
( n o 
 identifier-2 . . .
) " #
 CONTROL IS
 

 h i 
 CONTROLS ARE FINAL identifier-3 . . . 
 
page-limits-clause
n o
report-group-description-1 . . .

where page-limits-clause is

81
7. Data division

" #" #( )( )
LIMIT IS integer-1 LINE
PAGE
LIMITS ARE identifier-4 LINES
"( )( )#
integer-2 COLUMNS
identifier-5 COLS
 ( ) 
integer-3
HEADING IS
identifier-6

 
 ( ) ( ) 
 DETAIL integer-4 
FIRST IS
 
DE identifier-7

 
 ( ) ( )
 CONTROL HEADING integer-5 
LAST IS
 
CH identifier-8 


 ...
 ( ) ( ) 
 DETAIL integer-6
LAST IS
 
DE identifier-9

 
 ( ) 
 integer-7 
FOOTING IS
 
identifier-10

 
 ( ) 
integer-8
 
 LINE LIMIT IS
 

identifier-11

where report-group-description is

blank-clause
 

column-clause
 

GROUP INDICATE 
 
 
justified-clause 
 
line-clause
 

next-group-clause 
 
 
picture-clause
 

present-when-clause
 
level-number entry-name 
 . . . .
occurs-clause


sign-clause
 

source-clause
 

 
sum-clause
 

type-clause
 

 
USAGE IS DISPLAY 
 
value-clause
 

varying-clause

82
7. Data division

Syntax rules

General rules

83
7. Data division

7.7. Screen section


SCREEN
" SECTION. #
constant-definition
...
screen-description

84
7. Data division

85
7. Data division

Syntax rules

General rules

7.7.1. Screen description

h h i i
level-number entry-name control-definition control-attributes . . .

appearance-attribute-clauses
 
 AUTO
  
  
 
 AUTO-SKIP


 
 AUTOTERMINATE   
 
column-clause
 

 
 ccol-clause
 

 
 
 cline-clause 
 
 
 csize-clause
 

 
EOL
  
 
 
 
 EOS
 

ERASE
 
( ) 

 

h
 TO END OF
i LINE 




SCREEN
  
 
( ) 
 FULL 
 
 LENGTH-CHECK
 

 
IS GLOBAL 
 
 
 GRID 
 
. . . .
 
 INITIAL
 
 
 LEFTLINE 
 
 
justified-clause 
 
line-clause
 

   
NO-ECHO
 
   
  
 NO ECHO


  
 OFF
  
 

 
occurs-clause 
 
picture-clause
 

( ) 
 REQUIRED 
 
 EMPTY-CHECK
 

 
source-destination-clauses 
 
SECURE
 

sign-clause
 

 
 size-clause
 

 
usage-clause
 

value-clause
86
7. Data division

where appearance-attribute-clauses is

87
7. Data division

"( ) ( )#
BACKGROUND-COLOR identifier-1
IS
BACKGROUND-COLOUR integer-1
" #
BELL
BEEP
( )
LINE
BLANK
SCREEN
( )
BLINK
BLINKING

( ) ( )
COLOR identifier-2
WITH IS
COLOUR integer-2

"( ) ( )#
FOREGROUND-COLOR identifier-3
IS
FOREGROUND-COLOUR integer-3

HIGHLIGHT
 

 HIGH
 

 BOLD
 

 
LOWLIGHT 
 

LOW

h i
WITH STANDARD

h i
WITH BACKGROUND-HIGH

h i
WITH BACKGROUND-STANDARD

h i
WITH BACKGROUND-LOW

h i
OVERLINE

" " ( )##


identifier-4
PROMPT CHARACTER IS
literal-1

REVERSE-VIDEO
 
88
 REVERSED
 

REVERSE
" #
UNDERLINE
UNDERLINED
7. Data division

where source-destination-clauses is
" ( )#
identifier-5
FROM
literal-2
h i
TO identifier-6
h i
USING identifier-7

Syntax rules

General rules

89
7. Data division

7.8. Record description


Format 1 (data-description)

level-number
 ( entry-name
) 
LENGTH
ANY
NUMERIC

 
 
blank-when-zero-clause 
 h i 
IS EXTERNAL AS literal-1
 

 
 IS EXTERNAL-FORM
 

 ( ) 
 IS IDENTIFIED BY identifier-1
 
 


 literal-2 

 
IS GLOBAL 
 
justified-clause
 

 h i 
 
 LIKE identifier-2 ( literal-3 ) 
 
 
occurs-clause
 
. . . .

( )
 PICTURE
 h h i i 
IS picture-string-1 LOCALE IS locale-name-1 SIZE IS integer-1 

 PIC


 
REDEFINES identifier-3
 

SAME AS identifier-4
 

 
sign-clause 
 
special-names-clause
 

 h i 
IS TYPEDEF STRONG
 

 
 
SYNCHRONIZED 
 
 " # 
   LEFT 
TYPE TO type-name-1 SYNCHRONISED
 
RIGHT

 
SYNC

 

 
 
usage-clause
 

value-clause

Format 2 (renames)

"( ) #
THROUGH
66 identifier-5 RENAMES identifier-6 identifier-7 .
THRU

90
7. Data division

Format 3 (condition-name)

( )" #( "( ) #)
VALUE IS THROUGH
88 identifier-8 literal-4 literal-5 ...
VALUES ARE THRU
h i
WHEN SET TO FALSE IS literal-6 .

Syntax rules

General rules

91
7. Data division

7.9. Constant definition


Format 1 (standard)

literal-1
  
( ) 
 
 ( ) 


1 h AS
i BYTE-LENGTH


identifier-1 CONSTANT IS GLOBAL OF identifier-2 .
01 LENGTH

 

 
 
FROM identifier-3
 

Format 2 (micro-focus)

 
( )" # literal-2
VALUE IS
h i  

78 identifier-4 IS GLOBAL START OF identifier-5 .
VALUES ARE 
NEXT
 

Syntax rules

General rules

92
7. Data division

7.10. Data division clauses


7.10.1. ANY LENGTH clause
The ANY LENGTH clause specifies that the length of the data item will be determined
at runtime.
( )
LENGTH
ANY
NUMERIC

Syntax rules

General rules

93
7. Data division

7.10.2. AUTO clause


The AUTO clause specifies that the screen cursor will immediate move to the next screen
item when the current screen item is full.

AUTO
 
 

AUTO-SKIP
AUTOTERMINATE

 

Syntax rules

General rules

94
7. Data division

7.10.3. BACKGROUND-COLOR clause


The BACKGROUND-COLOR clause specifies the background-color of the screen item.
( ) ( )
BACKGROUND-COLOR identifier-1
IS
BACKGROUND-COLOUR literal-1

Syntax rules

General rules

95
7. Data division

7.10.4. BACKGROUND-HIGH clause

BACKGROUND-HIGH

Syntax rules

General rules

96
7. Data division

7.10.5. BACKGROUND-LOW clause

BACKGROUND-LOW

Syntax rules

General rules

97
7. Data division

7.10.6. BACKGROUND-STANDARD clause

BACKGROUND-STANDARD

Syntax rules

General rules

98
7. Data division

7.10.7. BELL clause


( )
BELL
BEEP

Syntax rules

General rules

99
7. Data division

7.10.8. BLANK clause


( )
LINE
BLANK
SCREEN

Syntax rules

General rules

100
7. Data division

7.10.9. BLANK WHEN ZERO clause


The BLANK WHEN ZERO clause causes an item to be blanked when a value of zero is
stored in it.

ZERO
 
 

BLANK WHEN ZEROES
ZEROS

 

Syntax rules

General rules

101
7. Data division

7.10.10. BLINK clause


( )
BLINK
BLINKING

Syntax rules

General rules

102
7. Data division

7.10.11. BLOCK clause


The BLOCK clause specifies the size of a physical record, that is, how many logical
records should be read in one physical I/O operation.
" #
h i CHARACTERS
BLOCK CONTAINS integer-1 TO integer-2
RECORDS

Syntax rules

General rules

103
7. Data division

7.10.12. COLOR clause


( ) ( )
COLOR identifier-1
WITH IS
COLOUR literal-1

Syntax rules

General rules

104
7. Data division

7.10.13. COLUMN clause


The COLUMN clause specifies what column an item should be printed or displayed at.

Format 1 (report-section)

COLUMN 
 
# LEFT
  
# h i 
 PLUS integer-1
 " "
COLUMNS NUMBER
 IS

RIGHT 
 n o
COL NUMBERS ARE  integer-2 . . . 
CENTER

 

 
COLS
 

Format 2 (screen-section)

 
COLUMN +
 

 

  ( )
COL
 
 -  identifier-1
NUMBER IS 
 
 POSITION  PLUS  integer-3

 
 
 POS MINUS
 

Syntax rules

General rules

105
7. Data division

7.10.14. CCOL clause

+
 
( )
-  identifier-1
CCOL NUMBER IS 
 
PLUS  integer-1

MINUS

Syntax rules

General rules

106
7. Data division

7.10.15. CLINE clause

+
 
( )
-  identifier-1
CLINE NUMBER IS 
 
PLUS  integer-1

MINUS

Syntax rules

General rules

107
7. Data division

7.10.16. CSIZE clause


" #( )
IS identifier-1
CSIZE
= integer-1

Syntax rules

General rules

108
7. Data division

7.10.17. DATA RECORDS clause


( )
RECORD IS n o
DATA identifier-1 . . .
RECORDS ARE

Syntax rules

General rules

109
7. Data division

7.10.18. DESTINATION clause

DESTINATION IS identifier-1

Syntax rules

General rules

110
7. Data division

7.10.19. DESTINATION COUNT clause

DESTINATION COUNT IS identifier-1

Syntax rules

General rules

111
7. Data division

7.10.20. DESTINATION TABLE OCCURS clause


h n o i
DESTINATION TABLE OCCURS integer-1 TIMES INDEXED BY index-name-1 . . .

Syntax rules

General rules

112
7. Data division

7.10.21. END KEY clause

END KEY IS identifier-1

Syntax rules

General rules

113
7. Data division

7.10.22. Entry name


The entry name specifies the name of the item being declared.
" #
FILLER
identifier-1

Syntax rules

General rules

114
7. Data division

7.10.23. ERASE clause


The ERASE clause indicates part of the screen to be blanked before displaying the item.

EOL
 

 

EOS
 

ERASE h (
i LINE
)
 TO END OF

 

 
SCREEN

Syntax rules

General rules

115
7. Data division

7.10.24. ERROR KEY clause

ERROR KEY IS identifier-1

Syntax rules

General rules

116
7. Data division

7.10.25. EXTERNAL clause


h i
IS EXTERNAL AS literal-1

Syntax rules

General rules

117
7. Data division

7.10.26. EXTERNAL-FORM clause

 IS EXTERNAL-FORM
 
 
( ) 
identifier-1

 IS IDENTIFIED BY

literal-1
 

Syntax rules

General rules

118
7. Data division

7.10.27. FOREGROUND-COLOR clause


( ) ( )
FOREGROUND-COLOR identifier-1
IS
FOREGROUND-COLOUR literal-1

Syntax rules

General rules

119
7. Data division

7.10.28. FROM clause


( )
identifier-1
FROM
literal-1

Syntax rules

General rules

120
7. Data division

7.10.29. FULL clause


The FULL clause specifies that the item must be filled entirely before the cursor can
move to another item.
( )
FULL
LENGTH-CHECK

Syntax rules

General rules

121
7. Data division

7.10.30. GLOBAL clause


The GLOBAL clause specifies that an item may be accessed from within nested pro-
grams.
IS GLOBAL

Syntax rules

General rules

122
7. Data division

7.10.31. GRID clause

GRID

Syntax rules

General rules

123
7. Data division

7.10.32. HIGHLIGHT clause

HIGHLIGHT
 
 
HIGH
BOLD

 

Syntax rules

General rules

124
7. Data division

7.10.33. INITIAL clause


INIITAL

Syntax rules

General rules

125
7. Data division

7.10.34. JUSTIFIED clause


The JUSTIFIED clause causes data smaller than the data item to be padded by spaces
on the left to fill the item.
( )
JUSTIFIED
RIGHT
JUST

Syntax rules

General rules

126
7. Data division

7.10.35. LABEL RECORDS clause


( )( )
RECORD IS STANDARD
LABEL
RECORDS ARE OMITTED

Syntax rules

General rules

127
7. Data division

7.10.36. LEFTLINE clause

LEFTLINE

Syntax rules

General rules

128
7. Data division

7.10.37. Level-number
A 1- or 2-digit integer having a value that is either between 1 and 49 or is 66, 77, 78 or
88.

Syntax rules

General rules

129
7. Data division

7.10.38. LIKE clause


h i
LIKE identifier-1 ( literal-1 )

Syntax rules

General rules

130
7. Data division

7.10.39. LINAGE clause


The LINAGE clause specifies the page limits of a logical page.
 
BOTTOM

( ) ( )
identifier-1 identifier-2 

 

LINAGE IS LINES  TOP  ...

literal-1  literal-2
WITH FOOTING AT

 

Syntax rules

General rules

131
7. Data division

7.10.40. LINE clause


The LINE clause specifies the line an item should be printer or displayed on.

Format 1 (report section)

 " #" # " #


IS

LINE NUMBER
 
 + integer-1

NUMBERS ARE PLUS ...
LINES ARE ON NEXT PAGE

 
 

Format 2 (screen item)

+
 
( )
-  identifier-1
LINE NUMBER IS 
 
MINUS integer-2

PLUS

Format 3 (screen control)

" #( )" #
IS identifier-2 CELL
LINES
= integer-3 PIXEL

Syntax rules

General rules

132
7. Data division

7.10.41. LOWLIGHT clause


( )
LOWLIGHT
LOW

Syntax rules

General rules

133
7. Data division

7.10.42. MESSAGE COUNT clause

MESSAGE COUNT IS identifier-1

Syntax rules

General rules

134
7. Data division

7.10.43. MESSAGE DATE clause

MESSAGE DATE IS identifier-1

Syntax rules

General rules

135
7. Data division

7.10.44. MESSAGE TIME clause

MESSAGE TIME IS identifier-1

Syntax rules

General rules

136
7. Data division

7.10.45. NEXT GROUP clause


The NEXT GROUP clause specifies the number of blank lines that should follow the end
of a report group.
" # 
 +

integer-1

NEXT GROUP IS PLUS
ON NEXT PAGE

 

Syntax rules

General rules

137
7. Data division

7.10.46. NO ECHO clause


 
NO ECHO
 
NO-ECHO
OFF

 

Syntax rules

General rules

138
7. Data division

7.10.47. OCCURS clause


The OCCURS clause describes tables, repeated data items accessible by subscripts.

Format 1 (usual)

OCCURS
 h i h i 
integer-1 TO integer-2 TIMES DEPENDING ON identifier-1
 

h ih ih ih i
 DYNAMIC CAPACITY IN identifier-2 FROM integer-3 TO integer-4 INITIALIZED
 

 (( ) ) 
ASCENDING n o
KEY IS identifier-3 . . . . . . 

DESCENDING

 
 n o 
INDEXED BY index-name-1 . . .

Format 2 (report section)

h i h ih i
OCCURS integer-5 TO integer-6 TIMES DEPENDING ON identifier-4 STEP integer-7

Format 3 (screen section)

OCCURS integer-8 TIMES

Format 4 (unbounded)

h i
OCCURS integer-9 TO UNBOUNDED TIMES DEPENDING ON identifier-5
 (( ) ) 
ASCENDING n o
KEY IS identifier-6 . . . . . . 

DESCENDING

 
 n o 
INDEXED BY index-name-2 . . .

139
7. Data division

Syntax rules

General rules

140
7. Data division

7.10.48. OVERLINE clause

OVERLINE

Syntax rules

General rules

141
7. Data division

7.10.49. PICTURE clause


The PICTURE clause describes the general characteristics and editing requirements of
an elementary data item.
( )
PICTURE h h i i
IS picture-string-1 LOCALE IS locale-name-1 SIZE IS integer-1
PIC

Syntax rules

General rules

142
7. Data division

7.10.50. PRESENT WHEN clause


The PRESENT WHEN clause specifies a condition under which a report section entry will
be processed.

WHEN condition-1
 

 

 
PAGE

   

( )
 BEFORE NEW 

 

) 
identifier-1 . . .
(  
PRESENT  AFTER
 

ABSENT  OR 

 

 ( )( ) 
JUSTIFIED BEFORE

 

NEW PAGE

 

 JUST AFTER

 

Syntax rules

General rules

143
7. Data division

7.10.51. PROMPT clause


" ( )#
identifier-1
PROMPT CHARACTER IS
literal-1

Syntax rules

General rules

144
7. Data division

7.10.52. RECORD clause


The RECORD clause specifies the number of bytes of a logical record.
 h i 


 CONTAINS integer-1 TO integer-2 CHARACTERS 


h ih i
RECORD IS VARYING in size FROM integer-3 TO integer-4 CHARACTERS
 
DEPENDING ON identifier-1

 

Syntax rules

General rules

145
7. Data division

7.10.53. RECORDING MODE clause


( )
F


 

FIXED

 


 

( )
V

 

RECORDING MODE IS


 VARIABLE 


U

 

 

 
S
 

Syntax rules

General rules

146
7. Data division

7.10.54. REDEFINES clause


The REDEFINES clause indicates the data shares the same memory as an item with a
different description.
REDEFINES identifier-1

Syntax rules

General rules

147
7. Data division

7.10.55. REPORT clause


( )
REPORT IS n o
identifier-1 . . .
REPORTS ARE

Syntax rules

General rules

148
7. Data division

7.10.56. REQUIRED clause


( )
REQUIRED
EMPTY-CHECK

Syntax rules

General rules

149
7. Data division

7.10.57. REVERSE-VIDEO clause

REVERSE-VIDEO
 
 
REVERSED
REVERSE

 

Syntax rules

General rules

150
7. Data division

7.10.58. SAME AS clause


SAME AS identifier-1

Syntax rules

General rules

151
7. Data division

7.10.59. SECURE clause


SECURE

Syntax rules

General rules

152
7. Data division

7.10.60. STATUS KEY clause

STATUS KEY IS identifier-1

Syntax rules

General rules

153
7. Data division

7.10.61. SIGN clause


The SIGN clause defines how to store item’s sign.
( )
LEADING h i
SIGN IS SEPARATE CHARACTER
TRAILING

Syntax rules

General rules

154
7. Data division

7.10.62. SIZE clause


" #( )
IS identifier-1
SIZE
= integer-1

Syntax rules

General rules

155
7. Data division

7.10.63. SOURCE clause


The SOURCE clause identifies data to be used in processing a report section entry.
h i
SOURCE IS number-1 rounded-phrase

Syntax rules

General rules

156
7. Data division

7.10.64. SPECIAL-NAMES clause

CURSOR
 
 

IS SPECIAL-NAMES SCREEN CONTROL
EVENT STATUS

 

Syntax rules

General rules

157
7. Data division

7.10.65. STANDARD clause


WITH STANDARD

Syntax rules

General rules

158
7. Data division

7.10.66. SUM clause


The SUM clause provides a list of data items to be summed for use in an elementary
report item.
 ( )
n o RESET ON identifier-1 
 
SUM OF number-1 . . .  FINAL
 

UPON identifier-2

 

Syntax rules

General rules

159
7. Data division

7.10.67. SYMBOLIC DESTINATION clause

SYMBOLIC DESTINATION IS identifier-1

Syntax rules

General rules

160
7. Data division

7.10.68. SYMBOLIC QUEUE clause

SYMBOLIC QUEUE IS identifier-1

Syntax rules

General rules

161
7. Data division

7.10.69. SYMBOLIC SOURCE clause

SYMBOLIC SOURCE IS identifier-1

Syntax rules

General rules

162
7. Data division

7.10.70. SYMBOLIC SUB-QUEUE-1 clause

SYMBOLIC SUB-QUEUE-1 IS identifier-1

Syntax rules

General rules

163
7. Data division

7.10.71. SYMBOLIC SUB-QUEUE-2 clause

SYMBOLIC SUB-QUEUE-2 IS identifier-1

Syntax rules

General rules

164
7. Data division

7.10.72. SYMBOLIC SUB-QUEUE-3 clause

SYMBOLIC SUB-QUEUE-3 IS identifier-1

Syntax rules

General rules

165
7. Data division

7.10.73. SYMBOLIC TERMINAL clause

SYMBOLIC TERMINAL IS identifier-1

Syntax rules

General rules

166
7. Data division

7.10.74. SYNCHRONIZED clause


The SYNCHRONIZED clause specifies an item should be aligned in a byte boundary and
in what way.

SYNCHRONIZED
 
" #
  LEFT

SYNCHRONISED
 RIGHT
SYNC

 

Syntax rules

General rules

167
7. Data division

7.10.75. TEXT LENGTH clause

TEXT LENGTH IS identifier-1

Syntax rules

General rules

168
7. Data division

7.10.76. TO clause
TO identifier-1

Syntax rules

General rules

169
7. Data division

7.10.77. TYPE clause


The TYPE clause for a data description entry specifies that the data is given by a type
declaration.
The TYPE clause for a report group specifies when the group is printed.

Format 1 (type-name)

TYPE TO type-name-1

Format 2 (report-group)

( )" #( ) 
CONTROL HEADING ON identifier-1 h i 
OR PAGE

 
CH FOR FINAL

 


 


 ( ) 

identifier-2
  h i 
 ( ) " # 
CONTROL FOOTING ON OR PAGE

 

FINAL

  

 
CF FOR

  

ALL

 


 

 ( ) 
DETAIL

 


 

 
DE

 


 

( ) 
TYPE IS PAGE FOOTING
 PF

 

 

 ( ) 
PAGE HEADING

 


 

 
PH

 


 

( ) 
 REPORT FOOTING

 

 

 
 RF

 

 

 ( ) 
REPORT HEADING

 


 

 
RH

 

Syntax rules

General rules

TYPEDEF clause
h i
IS TYPEDEF STRONG

170
7. Data division

Syntax rules

General rules

171
7. Data division

7.10.78. UNDERLINE clause


The UNDERLINE clause specifies that each character of a field is to be displayed with
an underline.
( )
UNDERLINE
UNDERLINED

Syntax rules

General rules

172
7. Data division

7.10.79. USAGE clause


The USAGE clause specifies the representation of a data item in memory.
 

 BINARY 

 
BIT

 


 

fixed-length-integers

 


 

 
computational-usages

 


 

 
DISPLAY

 


 

 
 FLOAT-BINARY-32 

 
 

 
FLOAT-BINARY-64

 


 

 
FLOAT-BINARY-128

 


 


 

FLOAT-DECIMAL-16 

 
h i 

USAGE IS FLOAT-DECIMAL-34
FLOAT-LONG

 


 


FLOAT-SHORT

 


 

 
INDEX

 

 

 
 NATIONAL






 

PACKED DECIMAL

 


 

 
POINTER

 


 

 
PROGRAM-POINTER 

 
 

 
 handle-usages






 

type-name-1

 

where fixed-length-integers is

BINARY-CHAR
  

 
 
 

BINARY-SHORT

 
 
 


 
 
 

  ( )  
BINARY-LONG

 
 
 
   " #

SIGNED

 
 
 

BINARY-INT

 

 
UNSIGNED

 

BINARY-C-LONG

 
 
 


 
 
 

  ( )  
BINARY-DOUBLE

 
 
 

   

  
 

 BINARY-LONG-LONG 
 

SIGNED-SHORT

 


 

 
SIGNED-INT

 


 

 
SIGNED-LONG

 


 

 
UNSIGNED-SHORT

 


 

 
UNSIGNED-INT

 


 

 
UNSIGNED-LONG

 

173
7. Data division

where computation-usages is
( ) 
 COMP





 COMPUTATIONAL

 

 


 ( ) 

COMP-0

 


 

 
COMPUTATIONAL-0

 


 


 

 ( ) 
COMP-1

 


 

 
COMPUTATIONAL-1

 


 


 

 ( ) 
COMP-2

 


 

 
COMPUTATIONAL-2

 


 


 

 ( ) 
COMP-3

 


 

 
 COMPUTATIONAL-3

 

 

( )


 COMP-4 


COMPUTATIONAL-4

 


 


 

 ( ) 
COMP-5

 


 

 
COMPUTATIONAL-5

 


 


 

 ( ) 
COMP-6

 


 

 
COMPUTATIONAL-6

 


 


 

 ( ) 
COMP-N

 


 

 
COMPUTATIONAL-N

 


 


 

 ( ) 
COMP-X

 


 

 
 COMPUTATIONAL-X

 

where handle-usages is

174
7. Data division

   
DEFAULT-FONT
     

 
 
 
    

FIXED-FONT

      
 


     
 

    
TRADITIONAL-FONT

 
   
 

FONT

     

    
SMALL-FONT
 
 


     
 

      
 

MEDIUM-FONT

      
 


      
 
  


LARGE-FONT

   

    




  
OF 
HANDLE  h i 
LAYOUT-MANAGER LM-RESIZE
  

  
 
 


    
   
MENU

 
  


  
 
 

   
 
SUBWINDOW

  
  


    
 
 

THREAD

    
 


   
 

    
VARIANT

  
 
 

   



   

 WINDOW
 
 

Syntax rules

General rules

175
7. Data division

7.10.80. USING clause


USING identifier-1

Syntax rules

General rules

176
7. Data division

7.10.81. VALUE clause


The VALUE clause specifies the initial value of the local-storage and working-storage
section data items and the values to be used in INITALIZE statements.
The VALUE clause for condition-names specifies the values under which a condition-
name is true (or false).

Format 1 (initialization)

( )" #
VALUE IS
literal-1
VALUES ARE

Format 2 (condition)

( )" #( "( ) #)
VALUE IS THROUGH
literal-2 literal-3 ...
VALUES ARE THRU
h i
WHEN SET TO FALSE IS literal-4

Syntax rules

General rules

177
7. Data division

7.10.82. VALUE OF clause


 
( ) FILE-ID  ( )
VALUE literal-1

 
OF ID IS
VALUES identifier-2
identifier-1

 

Syntax rules

General rules

178
7. Data division

7.10.83. VARYING clause


The VARYING clause declares counters to be used in printing repeated items in the re-
port writer.

VARYING identifier-1 FROM number-1 BY number-2

Syntax rules

General rules

179
7. Data division

7.10.84. VOLATILE clause


The VOLATILE clause indicates an item may change in ways outside the control of the
program.

VOLATILE

Syntax rules

General rules

180
8. Procedure division
8.1. Concepts
8.1.1. Exceptions
• EC-ALL

• EC-ARGUMENT
– EC-ARGUMENT-FUNCTION
– EC-ARGUMENT-IMP

• EC-BOUND
– EC-BOUND-IMP
– EC-BOUND-ODO
– EC-BOUND-OVERFLOW
– EC-BOUND-PTR
– EC-BOUND-REF-MOD
– EC-BOUND-SET
– EC-BOUND-SUBSCRIPT
– EC-BOUND-TABLE-LIMIT

• EC-DATA
– EC-DATA-CONVERSION
– EC-DATA-IMP
– EC-DATA-INCOMPATIBLE
– EC-DATA-OVERFLOW
– EC-DATA-PTR-NULL

• EC-FLOW
– EC-FLOW-GLOBAL-EXIT
– EC-FLOW-GLOBAL-GOBACK
– EC-FLOW-IMP
– EC-FLOW-RELEASE

182
8. Procedure division

– EC-FLOW-REPORT
– EC-FLOW-RETURN
– EC-FLOW-SEARCH
– EC-FLOW-USE

• EC-FUNCTION
– EC-FUNCTION-PTR-INVALID
– EC-FUNCTION-PTR-NULL

• EC-I-O
– EC-I-O-AT-END
– EC-I-O-EOP
– EC-I-O-EOP-OVERFLOW
– EC-I-O-FILE-SHARING
– EC-I-O-IMP
– EC-I-O-INVALID-KEY
– EC-I-O-LINAGE
– EC-I-O-LOGIC-ERROR
– EC-I-O-PERMANENT-ERROR
– EC-I-O-RECORD-OPERATION

• EC-IMP
– EC-IMP-ACCEPT
– EC-IMP-DISPLAY
– EC-IMP-FEATURE-DISABLED
– EC-IMP-FEATURE-MISSING
– EC-IMP-UTC-UNKNOWN

• EC-JSON
– EC-JSON-IMP

• EC-LOCALE
– EC-LOCALE-IMP
– EC-LOCALE-INCOMPATIBLE
– EC-LOCALE-INVALID
– EC-LOCALE-INVALID-PTR
– EC-LOCALE-MISSING

183
8. Procedure division

– EC-LOCALE-SIZE

• EC-OO
– EC-OO-CONFORMANCE
– EC-OO-EXCEPTION
– EC-OO-FINALIZABLE
– EC-OO-IMP
– EC-OO-METHOD
– EC-OO-NULL
– EC-OO-RESOURCE
– EC-OO-UNIVERSAL

• EC-ORDER
– EC-ORDER-IMP
– EC-ORDER-NOT-SUPPORTED

• EC-OVERFLOW
– EC-OVERFLOW-IMP
– EC-OVERFLOW-STRING
– EC-OVERFLOW-UNSTRING

• EC-PROGRAM
– EC-PROGRAM-ARG-MISMATCH
– EC-PROGRAM-ARG-OMITTED
– EC-PROGRAM-CANCEL-ACTIVE
– EC-PROGRAM-IMP
– EC-PROGRAM-NOT-FOUND
– EC-PROGRAM-PTR-NULL
– EC-PROGRAM-RECURSIVE-CALL
– EC-PROGRAM-RESOURCES

• EC-RAISING
– EC-RAISING-IMP
– EC-RAISING-NOT-SPECIFIED

• EC-RANGE
– EC-RANGE-IMP
– EC-RANGE-INDEX

184
8. Procedure division

– EC-RANGE-INSPECT-SIZE
– EC-RANGE-INVALID
– EC-RANGE-PERFORM-VARYING
– EC-RANGE-PTR
– EC-RANGE-SEARCH-INDEX
– EC-RANGE-SEARCH-NO-MATCH

• EC-REPORT
– EC-REPORT-ACTIVE
– EC-REPORT-COLUMN-OVERLAP
– EC-REPORT-FILE-MODE
– EC-REPORT-IMP
– EC-REPORT-INACTIVE
– EC-REPORT-LINE-OVERLAP
– EC-REPORT-NOT-TERMINATED
– EC-REPORT-PAGE-LIMIT
– EC-REPORT-PAGE-WIDTH
– EC-REPORT-SUM-SIZE
– EC-REPORT-VARYING

• EC-SCREEN
– EC-SCREEN-FIELD-OVERLAP
– EC-SCREEN-IMP
– EC-SCREEN-ITEM-TRUNCATED
– EC-SCREEN-LINE-NUMBER
– EC-SCREEN-STARTING-COLUMN

• EC-SIZE
– EC-SIZE-ADDRESS
– EC-SIZE-EXPONENTIATION
– EC-SIZE-IMP
– EC-SIZE-OVERFLOW
– EC-SIZE-TRUNCATION
– EC-SIZE-UNDERFLOW
– EC-SIZE-ZERO-DIVIDE

185
8. Procedure division

• EC-SORT-MERGE
– EC-SORT-MERGE-ACTIVE
– EC-SORT-MERGE-FILE-OPEN
– EC-SORT-MERGE-IMP
– EC-SORT-MERGE-RELEASE
– EC-SORT-MERGE-RETURN
– EC-SORT-MERGE-SEQUENCE

• EC-STORAGE
– EC-STORAGE-IMP
– EC-STORAGE-NOT-ALLOC
– EC-STORAGE-NOT-AVAIL

• EC-USER

• EC-VALIDATE
– EC-VALIDATE-CONTENT
– EC-VALIDATE-FORMAT
– EC-VALIDATE-IMP
– EC-VALIDATE-RELATION
– EC-VALIDATE-VARYING

• EC-XML
– EC-XML-CODESET
– EC-XML-CODESET-CONVERSION
– EC-XML-COUNT
– EC-XML-DOCUMENT-TYPE
– EC-XML-IMPLICIT-CLOSE
– EC-XML-INVALID
– EC-XML-NAMESPACE
– EC-XML-STACKED-OPEN
– EC-XML-RANGE

186
8. Procedure division

8.2. Procedure division header


h i h i
PROCEDURE DIVISION call-convention-phrase linkage-phrase
" ( )#
h i identifier-1
using-chaining-clause RETURNING .
OMITTED
h i
declaratives
section-name-2 SECTION.
 

paragraph-name-2.  ...
 

imperative-statement-1 .

where using-chaining-clause is
( )
USING
CHAINING
( ( ) )
REFERENCE h i h i h i
BY param-size OPTIONAL identifier-2 memory-size ...
VALUE

where param-size is
( )
AUTO
h i
 UNSIGNED SIZE IS
integer-1 


SIZE IS DEFAULT

where memory-size is
" #
identifier-3
WITH MEMORY SIZE IS
literal-1

where declaratives is
DECLARATIVES.
" " # #
paragraph-name-2.
section-name-1 SECTION. use-statement ... ...
imperative-statement-2 .
END DECLARATIVES.

Syntax rules

General rules

187
8. Procedure division

8.3. Common phrases


8.3.1. Call-convention phrase

C
 

EXTERN
 

PASCAL
 

 
STATIC 
 
STDCALL
 

mnemonic-name-1

Syntax rules

General rules

188
8. Procedure division

8.3.2. LINKAGE phrase

C
 

WITH PASCAL  LINKAGE


 

STDCALL

Syntax rules

General rules

189
8. Procedure division

8.3.3. RETRY phrase


 
 FOR arithmetic-expression-1 TIMES 
 
RETRY FOR arithmetic-expression-2 SECONDS
FOREVER

 

Syntax rules

General rules

190
8. Procedure division

8.3.4. ROUNDED phrase


 
AWAY-FROM-ZERO


 

NEAREST-AWAY-FROM-ZERO
 
 
 
 
 
 
 
NEAREST-EVEN
 
 
 
 
 
 
   
 NEAREST-TOWARD-ZERO
 

ROUNDED MODE IS
 
PROHIBITED

 
 

   
TOWARD-GREATER
 
 

  
 
TOWARD-LESSER
 
 

  
 
 
TRUNCATION

 

Syntax rules

General rules

191
8. Procedure division

8.3.5. SIZE phrase


 


 SIZE IS AUTO 


SIZE IS DEFAULT

 


 

SIZE IS integer-1
UNSIGNED SIZE IS AUTO 

 


 
 
UNSIGNED SIZE IS integer-2
 

Syntax rules

General rules

192
8. Procedure division

8.4. ACCEPT statement


The ACCEPT statement transfers data provided by the user or the operating system to
the specified data item.

Format 1 (device)

( )
identifier-1 h ih i
ACCEPT FROM mnemonic-name-1 END-ACCEPT
OMITTED

Format 2 (screen)

193
8. Procedure division

 h i 
 position-specifier identifier-2
ACCEPT
OMITTED
 

  ( )  
 identifier-3 
AT LINE NUMBER
   
    
integer-1


 
 
 
     
 
    
 
COLUMN 
 
 
 
 
  
  
 ( )  
 
 COL identifier-4
     
   
 AT  POSITION  NUMBER integer-2
   
   
   

  

  
 
 

 
 
   POS 
 


   
 
 ( ) 
identifier-5
  
 
 AT
  
 
  
 
 
  integer-3 
 

 
 FROM CRT 
 
 MODE IS BLOCK
 

 
 accept-appearance-attribute-clauses 
 
accept-attribute-clauses

 ( ) 
EXCEPTION h i
 ON identifier-6 imperative-statement-1

ESCAPE

 
 ( ) 
 EXCEPTION h i 
NOT ON identifier-7 imperative-statement-2
 
ESCAPE

h i
END-ACCEPT

where position-specifier is
 
( position-specifier-num , position-specifier-num )
 
( , position-specifier-num )
( position-specifier-num , )

 

where position-specifier-num is
( ) "( ) #
identifier-8 +
literal-2
literal-1 -

where accept-appearance-attribute-clauses is

194
8. Procedure division

( )
h i BELL
WITH NO
BEEP
( )
BLINK
WITH
BLINKING
 
HIGHLIGHT
 
 
HIGH





 
WITH BOLD
LOWLIGHT 

 


 

LOW
 

WITH STANDARD
WITH BACKGROUND-HIGH
WITH BACKGROUND-STANDARD
WITH BACKGROUND-LOW
WITH LEFTLINE
WITH OVERLINE" ( )#
identifier-9
WITH PROMPT CHARACTER IS
literal-3
 
REVERSE-VIDEO
 
WITH REVERSED
REVERSE

 

WITH SAME
( )
identifier-10
WITH PROTECTED SIZE IS
integer-4
( )
UNDERLINE
WITH
UNDERLINED
( ) ( )
FOREGROUND-COLOR identifier-11
WITH IS
FOREGROUND-COLOUR integer-5
( ) ( )
BACKGROUND-COLOR identifier-12
WITH IS
BACKGROUND-COLOUR integer-6
( ) ( )
COLOR identifier-13
WITH IS
COLOUR integer-7
( ) "( )( )#
UP identifier-14 LINE
WITH SCROLL
DOWN integer-8 LINES

where accept-attribute-clauses is

195
8. Procedure division

( )
AUTO
WITH
TAB

WITH CONTROL KEY IN identifier-15


( )
CONVERSION
WITH
CONVERT
WITH CURSOR IS literal-4
( )
FULL
WITH
LENGTH-CHECK
( )
LOWER
WITH
UPPER
 
NO-ECHO
 
WITH NO ECHO
OFF

 

( )
REQUIRED
WITH
EMPTY-CHECK
WITH SECURE( )
h i DEFAULT
WITH NO
UPDATE
 ( ) 
WITH TIMEOUT AFTER
( )
  identifier-16
TIME-OUT
 integer-9
BEFORE TIME

 

Format 3 (temporal)

 h i

 DATE YYYYMMDD 

 h i 
DAY YYYYDDD
 

ACCEPT identifier-17 FROM
DAY-OF-WEEK





 
TIME
 

Format 4 (environment)

196
8. Procedure division

ARGUMENT-NUMBER
 

 ( ) 

COLUMNS

 


 

 
COLS

 


 

 
COMMAND-LINE

 


 

 
ESCAPE KEY

 

 

 
EXCEPTION STATUS 

 


 

ACCEPT identifier-18 FROM ( INPUT STATUS
)
 LINES

 

 

 
 LINE NUMBER

 

 

 
 TERMINAL-INFO






 

SYSTEM-INFO

 


 


 

USER NAME

 

 

WORD

 

Format 5 (environment-exception)

ARGUMENT-VALUE
 

 ( ) 

identifier-20 

 
ACCEPT identifier-19 FROM ENVIRONMENT


 literal-5 


ENVIRONMENT-VALUE
 
 ( ) 
EXCEPTION h i
 ON identifier-21 imperative-statement-3

ESCAPE

 
 ( ) 
 EXCEPTION h i 
NOT ON identifier-22 imperative-statement-4
 
ESCAPE

Format 6 (message)

ACCEPT cd-name-1 MESSAGE COUNT

Format 7 (from screen)

197
8. Procedure division

( )
identifier-24
 

AT LINE NUMBER

 
 
  
integer-10

 
 
  



 
 
 
 


    
COLUMN

 
 
   



 
   


    ( ) 
COL identifier-25

 
 
 
 


 AT NUMBER

 
 
 
   
POSITION integer-11

 
 

ACCEPT identifier-23 FROM SCREEN  ...

  
  



 

POS
    

 

 

  ( ) 
identifier-26

 


AT

  
 

integer-12
  


 


 ( ) 

identifier-27

 

SIZE IS

 

literal-6
 

Syntax rules

Format 2

1. Position specifiers may not be used with any of the ON EXCEPTION clauses.

General rules

198
8. Procedure division

8.5. ADD statement


The ADD statement adds two or more numbers and stores the result.

Format 1 (simple)

( )
identifier-1 n o
ADD . . . TO identifier-2 . . .
literal-1
" #
ON SIZE ERROR imperative-statement-1

NOT ON SIZE ERROR imperative-statement-2

h i
END-ADD

Format 2 (giving)

( )
identifier-3 h h i i
ADD . . . TO identifier-4 . . .
literal-2
n h io
GIVING identifier-5 rounded-phrase . . .
" #
ON SIZE ERROR imperative-statement-3

NOT ON SIZE ERROR imperative-statement-4

h i
END-ADD

Format 3 (corresponding)

199
8. Procedure division

( )
CORRESPONDING h i
ADD identifier-6 TO identifier-7 rounded-phrase
CORR
" #
ON SIZE ERROR imperative-statement-5

NOT ON SIZE ERROR imperative-statement-6

h i
END-ADD

Format 4 (table)

h i
ADD TABLE identifier-8 TO identifier-9 rounded-phrase

h i
FROM INDEX integer-1 TO integer-2

h i
DESTINATION INDEX integer-3

" #
ON SIZE ERROR imperative-statement-7

NOT ON SIZE ERROR imperative-statement-8

h i
END-ADD

Syntax rules

General rules

200
8. Procedure division

8.6. ALLOCATE statement


The ALLOCATE statement requests memory from the operating system for a BASED
data item or to be referenced by a data-pointer.
 h i 


 identifier-1 INITIALIZED 


  )# 
ALLOCATE
" (
identifier-2
 arithmetic-expression-1 INITIALIZED TO 
literal-1

 

 

" ( )#
24
LOC
31

h i
RETURNING identifier-3

Syntax rules

General rules

201
8. Procedure division

8.7. ALTER statement


The ALTER statement changes the target of a GO TO statement. Its use is strongly
discouraged and commonly proscribed.
n o
ALTER procedure-name-1 TO PROCEED TO procedure-name-2 . . .

Syntax rules

General rules

202
8. Procedure division

8.8. CALL statement


The CALL statement transfers execution to another program, optionally with arguments
and storing a return value.
CALL
h ih ih i
call-convention-phrase IN THREAD linkage-phrase

 
identifier-1


 
 
 

literal-1

 


 

 
 function-name-1
  
 

  
identifier-2
( )
NESTED

  
 

AS

 literal-2

   

program-prototype-name 
 

function-name-2

  
 

h i
HANDLE IN identifier-3

OMITTED
     
REFERENCE


    ( 
) 
USING BY CONTENT identifier-4 ...
   h i 
 size-phrase

VALUE literal-3

 
  
 
 

 INTO identifier-5
  
 

ADDRESS OF identifier-6
( 
 
 
)  
 RETURNING
 
 

NOTHING

 
 GIVING 
  NULL





 
 
 
OMITTED

 

( )
ON EXCEPTION imperative-statement-1
 

OVERFLOW
 
 
NOT ON EXCEPTION imperative-statement-2

h i
END-CALL

Syntax rules

General rules

203
8. Procedure division

8.9. CANCEL statement


The CANCEL statement unloads a program from the operating system memory. This
has the effect of freeing all the program’s working-storage items and closing all files the
program left open.
( )
identifier-1
CANCEL ...
literal-1

Syntax rules

General rules

204
8. Procedure division

8.10. CLOSE statement


The CLOSE statement prevents the program from accessing or modifying an open file.
It first processes all pending writes for the file and releases all locks still held in the file.

Format 1 (file)

( )
REEL h
 i
FOR REMOVAL 

 

  UNIT 

CLOSE file-name-1   ...
 

 WITH NO REWIND 

 
WITH LOCK
 

Format 2 (window)

h i
CLOSE WINDOW identifier-1 WITH NO DISPLAY

Syntax rules

General rules

205
8. Procedure division

8.11. COMMIT statement


The COMMIT statement forces all pending file writes to be processed.
COMMIT TRANSACTION

Syntax rules

General rules

206
8. Procedure division

8.12. COMPUTE statement


The COMPUTE statement evaluates an arithmetic expression and stores the result.
 
= 
n h io   

COMPUTE identifier-1 rounded-phrase . . . EQUAL arithmetic-expression-1
 EQUALS

 

" #
ON SIZE ERROR imperative-statement-1

NOT ON SIZE ERROR imperative-statement-2

h i
END-COMPUTE

Syntax rules

General rules

207
8. Procedure division

8.13. CONTINUE statement


The plain format of the CONTINUE statement has no effect on program execution. The
after format of the CONTINUE statement pauses execution for a specified length of
time.

Format 1 (plain)

CONTINUE

Format 2 (after)

CONTINUE AFTER expression-1 SECONDS

Syntax rules

General rules

208
8. Procedure division

8.14. DELETE statement


The DELETE statement removes a record from a file or removes an entire file.

Format 1 (record)

DELETE file-name-1 RECORD


h i
retry-phrase
" #
INVALID KEY imperative-statement-1

NOT INVALID KEY imperative-statement-2

h i
END-DELETE

Format 2 (file)

n o
DELETE FILE file-name-2 . . .

" #
ON EXCEPTION imperative-statement-3

NOT ON EXCEPTION imperative-statement-4

h i
END-DELETE

Syntax rules

General rules

209
8. Procedure division

8.15. DESTROY statement


( )
ALL CONTROLS
DESTROY
identifier-1 . . .

Syntax rules

General rules

210
8. Procedure division

8.16. DISABLE statement


The DISABLE statement prevents the program from modifying or accessing an enabled
communication descriptor.

INPUT TERMINAL
 
" ( )#
OUTPUT  identifier-1
DISABLE   cd-name-1 WITH KEY
 
I-O TERMINAL  literal-1
TERMINAL

Syntax rules

General rules

211
8. Procedure division

8.17. DISPLAY statement


The DISPLAY statement displays data to a user or sends data to the operating system.

Format 1 (device)

( ) " #
identifier-1 UPON mnemonic-name-1
DISPLAY ...

literal-1 WITH NO ADVANCING


" #
ON EXCEPTION imperative-statement-1

NOT ON EXCEPTION imperative-statement-2

h i
END-DISPLAY

Format 2 (environment)

ARGUMENT-NUMBER 
 
( ) 
 
identifier-2 COMMAND-LINE
 

DISPLAY UPON
literal-2 

 ENVIRONMENT-NAME 

ENVIRONMENT-VALUE
 

" #
ON EXCEPTION imperative-statement-3

NOT ON EXCEPTION imperative-statement-4

h i
END-DISPLAY

Format 3 (screen)

212
8. Procedure division

position-clauses
  
 

 
( ) 
identifier-3 CRT

    
  


   UPON
 

DISPLAY literal-3

 CRT-UNDER  . . .

OMITTED
  
 
 MODE IS BLOCK

   


 

 
display-appearance-attribute-clauses

 

" #
ON EXCEPTION imperative-statement-5

NOT ON EXCEPTION imperative-statement-6

h i
END-DISPLAY

Format 4 (Microsoft screen)

ERASE
 

    
identifier-4

 

DISPLAY

 

disp-position-specifier literal-4 ...

 
ERASE
 
 
 

h n o i
WITH display-appearance-attribute-clauses . . .

h i
END-DISPLAY

Format 5 (ordinary window)

213
8. Procedure division

( )
WINDOW h i
DISPLAY UPON identifier-5
SUBWINDOW

POP-UP AREA IS identifier-6


 

 " # 

IS

 


HANDLE identifier-7
 

 
IN

 


 

 
LINES integer-1

 


 

 ( ) 
identifier-8

 

TITLE IS

 

 
literal-5

 

" # ...
SCROLL
WITH NO

 

 
WRAP

 


 

 " # 
 SHADOW

 

 

 
BOXED

 


 

 
position-clauses

 


 

 
display-appearance-attribute-clauses
 

h i
END-DISPLAY

Format 6 (floating window)

h i h i
DISPLAY FLOATING GRAPHICAL WINDOW UPON identifier-9

POP-UP AREA" # IS identifier-10


 
 

IS

 


HANDLE identifier-11
 

 
IN

 


 

 
LINES integer-2

 


 

 ( ) 
identifier-12

 

TITLE IS

 

 
literal-6

 

" # ...
SCROLL
WITH NO

 

 
WRAP
 


 

" # 
SHADOW

 


 

 
 BOXED

 

 

 
position-clauses

 


 

 
display-appearance-attribute-clauses
 

h i
END-DISPLAY

214
8. Procedure division

Format 7 (special window)

 
INITIAL
 
h i h i
DISPLAY STANDARD GRAPHICAL WINDOW UPON identifier-13
INDEPENDENT

 

POP-UP AREA IS identifier-14


 

 " # 

IS

 


HANDLE identifier-15
 

 
IN

 


 

 
LINES integer-3

 


 

 ( ) 
identifier-16

 

TITLE IS

 

 
literal-7

 

" # ...
SCROLL
WITH NO

 

 
WRAP

 


 

 " # 
 SHADOW

 

 

 
BOXED

 


 

 
position-clauses

 


 

 
display-appearance-attribute-clauses
 

h i
END-DISPLAY

Format 8 (message box)

215
8. Procedure division

( )
identifier-17
DISPLAY MESSAGE BOX ...
literal-8
 " #( ) 
IS identifier-18
TITLE
= literal-9

 
 " #( ) 
 IS identifier-19 
TYPE
 
= literal-10

 
 " #( ) 
 IS identifier-20 
ICON . . .
 

 = literal-11 
" #( ) 
 IS identifier-21 
DEFAULT
 
= literal-12

 
( )( )
 RETURNING identifier-22 
 
GIVING literal-13
h i
END-DISPLAY

where position-clauses is
 ( ) 
identifier-23 
LINE NUMBER

 
  
   
literal-14

 
 



 
 


     
COLUMN

 
 



   
 
   ( ) 
COL identifier-24

  
 

AT NUMBER
 
 
  POSITION 

 literal-15 



     
   
POS
  
 
 


 


 ( ) 

identifier-25

 

AT

 

 
literal-16

 

 

where display-appearance-attribute-clauses is

216
8. Procedure division

( )
BELL
WITH
BEEP
( )
LINE
WITH BLANK
SCREEN
( )
BLINK
WITH
BLINKING
( )
CONVERSION
WITH
CONVERT
EOL
 

 

EOS
 

WITH ERASE h (
i LINE
)
 TO END OF

 

 
SCREEN

 
HIGHLIGHT

 

HIGH

 

 

WITH BOLD
LOWLIGHT 

 
 

 
LOW
 

WITH STANDARD
WITH BACKGROUND-HIGH
WITH BACKGROUND-STANDARD
WITH BACKGROUND-LOW
WITH OVERLINE
 
REVERSE-VIDEO
 
WITH REVERSED
REVERSE

 

WITH SAME
( )
identifier-26
WITH SIZE IS
literal-17
( )
UNDERLINE
WITH
UNDERLINED
( )" #( )
FOREGROUND-COLOR IS identifier-27
WITH
FOREGROUND-COLOUR = integer-4
( )" #( )
BACKGROUND-COLOR IS identifier-28
WITH
BACKGROUND-COLOUR = integer-5
( ) ( )
COLOR identifier-29
WITH IS
COLOUR integer-6
( ) "( )( )#
UP identifier-30 LINE
WITH SCROLL
DOWN integer-7 LINES

217
8. Procedure division

where disp-position-specifier is
 
( disp-position-specifier-num , disp-position-specifier-num )
 
( , disp-position-specifier-num )
( disp-position-specifier-num , )

 

where disp-position-specifier-num is
( ) "( ) #
identifier-31 +
literal-19
literal-18 -

Syntax rules

General rules

218
8. Procedure division

8.18. DIVIDE statement


The DIVIDE statement divides one or more numbers by another and stores the results.

Format 1 (into)

( ) (( ) )
identifier-1 identifier-2 h i
DIVIDE INTO rounded-phrase ...
literal-1 literal-2
" #
ON SIZE ERROR imperative-statement-1

NOT ON SIZE ERROR imperative-statement-2

h i
END-DIVIDE

Format 2 (giving)

( )( )( )
identifier-3 BY identifier-4
DIVIDE
literal-3 INTO literal-4
(( ) )
identifier-5 h i
GIVING rounded-phrase ...
literal-5
" ( )#
identifier-6
REMAINDER
literal-6
" #
ON SIZE ERROR imperative-statement-3

NOT ON SIZE ERROR imperative-statement-4

h i
END-DIVIDE

Syntax rules

General rules

219
8. Procedure division

8.19. ENABLE statement


The ENABLE statement allows the program to access and modify a communication
descriptor.

INPUT TERMINAL
 
" ( )#
OUTPUT  identifier-1
ENABLE   cd-name-1 WITH KEY
 
I-O TERMINAL  literal-1
TERMINAL

Syntax rules

General rules

220
8. Procedure division

8.20. ENTRY statement


The ENTRY statement indicates an alternative point of entry into the program.

Format 1 (usual)

h i
ENTRY call-convention-phrase literal-1
h i
linkage-phrase

REFERENCE OMITTED
      

   ( ( ))
  
USING BY CONTENT identifier-1 ... 
   h i 
size-phrase

VALUE literal-2

 
 
  
  

Format 2 (for GO TO)

ENTRY FOR GO TO literal-3

Syntax rules

General rules

221
8. Procedure division

8.21. EVALUATE statement


The EVALUATE statement evaluates one or more conditions and execute the statements
corresponding to the first true condition.
   
expression-1
  expression-2
 
EVALUATE TRUE ALSO TRUE  ...
 

FALSE FALSE

 
 
 

n h i o
WHEN selection-object ALSO selection-object . . . imperative-statement-1 . . .
h i
WHEN OTHER imperative-statement-2
h i
END-EVALUATE

where selection-object is
 "( ) #
THROUGH
partial-expression-1 expression-3 

 
 
THRU

 


 

ANY
TRUE

 

 

 
FALSE

 

Syntax rules

General rules

222
8. Procedure division

8.22. EXHIBIT statement


h i h ih ih i
EXHIBIT CHANGED NAMED exhibit-pos-spec ERASE

( )
literal-1
...
identifier-1

h i
UPON mnemonic-name-1

where exhibit-pos-spec is
 
( exhibit-pos-spec-num , exhibit-pos-spec-num )
 
( , exhibit-pos-spec-num )
( exhibit-pos-spec-num , )

 

where exhibit-pos-spec-num is
( ) "( ) #
identifier-2 +
literal-3
literal-2 -

Syntax rules

General rules

223
8. Procedure division

8.23. EXIT statement


The EXIT statement indicates the end of a path of execution.

FUNCTION
 

PARAGRAPH
 
h i 
 
PERFORM CYCLE 
EXIT 
 
"( )# ( ) 
RETURNING identifier-1
 
PROGRAM
 
GIVING literal-1

 
 
SECTION

Syntax rules

General rules

224
8. Procedure division

8.24. FREE statement


The FREE statement returns memory to the operating system.
n o
FREE identifier-1 . . .

Syntax rules

General rules

225
8. Procedure division

8.25. GENERATE statement


The GENERATE statement a specified report entry.
GENERATE report-name-1

Syntax rules

General rules

226
8. Procedure division

8.26. GO TO statement
The GO TO statement transfer execution to another part of the program.
( )
procedure-name-1 . . . h i
GO TO DEPENDING ON identifier-1
ENTRY entry-name . . .

Syntax rules

General rules

227
8. Procedure division

8.27. GOBACK statement


The GOBACK statement terminates execution in the program, returning control to the
calling program or, if no such program exists, to the operating system.
"( )( )#
RETURNING identifier-1
GOBACK
GIVING literal-1

Syntax rules

General rules

228
8. Procedure division

8.28. IF statement
The IF statement evaluates a condition and executes statements depending on whether
the condition was true or false.
( )
imperative-statement-1
IF condition THEN ...
ELSE imperative-statement-2
h i
END-IF

Syntax rules

General rules

229
8. Procedure division

8.29. INITIALIZE statement


The INITIALIZE statement sets data items to their default values.
( )( )
INITIALIZE identifier-1 h i
. . . WITH FILLER
INITIALISE basic-literal-1
 
ALL


 

ALPHABETIC

 
 





 
ALPHANUMERIC

 
 
  

 
 
ALPHANUMERIC-EDITED
  
TO VALUE
 
NATIONAL

 
 
  
NATIONAL-EDITED




 
  
NUMERIC





 

 
 
NUMERIC-EDITED

 

ALPHABETIC
    

 
 

ALPHANUMERIC
 

 
 
 
 

 
 
 
  
ALPHANUMERIC-EDITED
 
   
 ( )
identifier-2
  
 
 
REPLACING NATIONAL DATA BY . . .
 

 literal-1 
NATIONAL-EDITED
 

 
 
 
 

 
 
 

  
NUMERIC
 
 
 
 
 

 
 
 
  
NUMERIC-EDITED
  

h i
THEN TO DEFAULT

Syntax rules

General rules

230
8. Procedure division

8.30. INITIATE statement


The INITIATE statement allows the program to begin generating the specified report.
n o
INITIATE report-name-1 . . .

Syntax rules

General rules

231
8. Procedure division

8.31. INQUIRE statement


Format 1 (control)

( ) (( )" # )
identifier-1 control-property IN
INQUIRE identifier-2 . . .
CONTROL LAYOUT-DATA =

Format 2 (window)

  
) LAYOUT-MANAGER " #
identifier-3h
(
IN
   

INQUIRE i SIZE identifier-5 . . .
WINDOW identifier-4  =
TITLE

  

Syntax rules

General rules

232
8. Procedure division

8.32. INSPECT statement


The INSPECT statement counts the number of occurrences of a character string, re-
places occurrences or both.
  h i

 identifier-1 


 tallying-phrase replacing-phrase 


INSPECT literal-1 replacing-phrase
function-name-1 converting-phrase

 
 

where tallying-phrase is
TALLYING
CHARACTERS
   

 
( ) 
  
 
 


 identifier-2 ALL
 ( )
 h i

FOR identifier-3 . . . before-after-phrase ...
 

literal-2 LEADING
 literal-3

 
 
 
 
 

     
TRAILING
 
   

where replacing-phrase is
  


CHARACTERS







 ALL


   
 ( ) 

identifier-5

 ( )
 h i

REPLACING LEADING  identifier-4 BY before-after-phrase ...
literal-5
 
FIRST  literal-4


   
 


  
 
 

 TRAILING

 
 

where converting-phrase is
( ) ( )
identifier-6 identifier-7 h i
CONVERTING TO before-after-phrase
literal-6 literal-7

where before-after-phrase is
 ( ) 
identifier-8
 BEFORE INITIAL

literal-8

 
 ( ) 
 identifier-9 
AFTER INITIAL
 
literal-9

Syntax rules

General rules

233
8. Procedure division

8.33. JSON GENERATE statement


The JSON GENERATE statement converts a JSON record based on the structure and
content of the input data item.
JSON GENERATE identifier-1 FROM identifier-2
h i
COUNT IN identifier-3
h n o i
NAME OF identifier-4 IS literal-1 . . .
h n o i
SUPPRESS identifier-5 . . .
" #
ON EXCEPTION imperative-statement-1

NOT ON EXCEPTION imperative-statement-2

h i
END-JSON

Syntax rules

General rules

234
8. Procedure division

8.34. JSON PARSE statement


The JSON PARSE statement starts an event-driven JSON parser; the processing proce-
dure is performed as each component of the JSON document is identified in order.
JSON PARSE identifier-1 INTO identifier-2
h i
WITH DETAIL
h n o i
NAME OF identifier-3 IS literal-1 . . .
h n o i
SUPPRESS identifier-4 . . .
" #
ON EXCEPTION imperative-statement-1

NOT ON EXCEPTION imperative-statement-2

h i
END-JSON

Syntax rules

General rules

235
8. Procedure division

8.35. MERGE statement


The MERGE statement reads multiple files with the same record desciption, combines
their records and sorts them.
" ( ) #
ASCENDING h i
MERGE identifier-1 ON KEY identifier-2 . . . . . .
DESCENDING
h h ii
WITH DUPLICATES IN ORDER

  h i 
IS alphanumeric-collating-sequence national-collating-sequence

 

 
 

COLLATING SEQUENCE IS
 ( ) 
FOR ALPHANUMERIC IS alphanumeric-collating-sequence 
 
 
 
FOR NATIONAL IS national-collating-sequence

 


h n o i
USING file-name-1 . . .
 n o 
GIVING file-name-2 . . .
 "( ) #
 THROUGH 
OUTPUT PROCEDURE IS procedure-name-1 procedure-name-2
 
THRU

Syntax rules

General rules

236
8. Procedure division

8.36. MODIFY statement


Format 1 (control)

( )
identifier-1 n o h i
MODIFY control-attributes . . . END-MODIFY
CONTROL

Format 2 (window)

  
) LAYOUT-MANAGER " #
identifier-2h
(
IN
   
 h i
MODIFY i SIZE identifier-4 . . . END-MODIFY
WINDOW identifier-3  =
TITLE

  

Syntax rules

General rules

237
8. Procedure division

8.37. MOVE statement


The MOVE statement sets the value of one or more data items.
" #( )
CORRESPONDING identifier-1 n o
MOVE TO identifier-2 . . .
CORR literal-1

Syntax rules

General rules

238
8. Procedure division

8.38. MULTIPLY statement


The MULTIPLY statement multiplies multiple numbers and stores the result.

Format 1 (simple)

( ) (( ) )
identifier-1 identifier-2 h i
MULTIPLY BY rounded-phrase ...
literal-1 literal-2
" #
ON SIZE ERROR imperative-statement-1

NOT ON SIZE ERROR imperative-statement-2

h i
END-MULTIPLY

Format 2 (giving)

( ) ( )
identifier-3 identifier-4
MULTIPLY BY
literal-3 literal-4
(( ) )
identifier-5 h i
GIVING rounded-phrase ...
literal-5
" #
ON SIZE ERROR imperative-statement-3

NOT ON SIZE ERROR imperative-statement-4

h i
END-MULTIPLY

Syntax rules

General rules

239
8. Procedure division

8.39. NEXT SENTENCE statement


The NEXT SENTENCE statement transfers execution to the first statement following the
current sentence.
NEXT SENTENCE

Syntax rules

General rules

240
8. Procedure division

8.40. OPEN statement


The OPEN statement allows the program to access or modify specified files.
n o
OPEN open-body . . .

where open-body is

INPUT 
 
 
h i OUTPUT
 h ih in o h i
EXCLUSIVE sharing-mode retry-phrase file-name-1 . . . open-options
I-O
 

 
EXTEND
 

where sharing-mode is
 
ALL OTHER
 
SHARING WITH NO OTHER
READ ONLY

 

where open-options is
 
# LOCK

"
 FOR 


 MASS-UPDATE 
 WITH  
BULK-ADDITION
  

   
ALL
 
 
 
 
   
READERS
 
 
  "
  #
 WITH NO REWIND
   
ALLOWING UPDATERS


  REVERSED
WRITERS 
 
 
 
 
  
 
NO OTHERS
 
  
 
  
DISP
 
 
 
 LEAVE
 

 
REREAD
 

Syntax rules

General rules

241
8. Procedure division

8.41. PERFORM statement


The PERFORM statement executes the specified procedures or statements one or more
times.

Format 1 (procedure)

"( ) #
h i THROUGH
PERFORM IN THREAD procedure-name-1 procedure-name-2
THRU

FOREVER
 
h i times-phrase 
HANDLE IN identifier-1
 
until-phrase 
 

varying-phrase

Format 2 (inline)

FOREVER
 
h i times-phrase  h i
PERFORM IN THREAD HANDLE IN identifier-2
 
until-phrase 
 

varying-phrase

imperative-statement-1
h i
END-PERFORM

where times-phrase is
 
identifier-3
 

literal-1 TIMES
function-name-1

 

where until-phrase is
" ( )# ( )
BEFORE condition-1
WITH TEST UNTIL
AFTER EXIT

and where varying-phrase is

242
8. Procedure division

" ( )#
BEFORE
WITH TEST
AFTER
( )" ( )#
identifier-5 identifier-6
VARYING identifier-4 FROM BY UNTIL condition-2
literal-2 literal-3
" ( )" ( )# #
identifier-8 identifier-9
AFTER identifier-7 FROM BY UNTIL condition-3 . . .
literal-4 literal-5

Syntax rules

General rules

243
8. Procedure division

8.42. PURGE statement


The PURGE statement
PURGE cd-name-1

Syntax rules

General rules

244
8. Procedure division

8.43. RAISE statement


The RAISE statement activates an exception condition.
( )
EXCEPTION exception-name
RAISE
identifier-1

Syntax rules

General rules

245
8. Procedure division

8.44. READ statement


The READ statement transfer data from a file to the file’s record or to a data item.
" #
NEXT h i
READ file-name-1 RECORD INTO identifier-1
PREVIOUS
( )
IGNORING LOCK

 WITH IGNORE LOCK


 

" #
 NO
  
" #  
 ADVANCING ON LOCK LOCK

WITH KEPT
  
retry-phrase
 
WAIT

 

h i
KEY IS identifier-2
( )
INVALID KEY imperative-statement-1

 NOT INVALID KEY imperative-statement-2 
 
( ) 
 AT END imperative-statement-3 
 
NOT AT END imperative-statement-4

h i
END-READ

Syntax rules

General rules

246
8. Procedure division

8.45. READY statement


The READY TRACE statement causes the name of procedures reached by execution to
be displayed.
READY TRACE

Syntax rules

General rules

247
8. Procedure division

8.46. RECEIVE statement


The RECEIVE statement transfers data from a communication descriptor to a data item.
( )
MESSAGE
RECEIVE cd-name-1 INTO identifier-1
SEGMENT

" #
WITH DATA imperative-statement-1

NO DATA imperative-statement-2

h i
END-RECEIVE

Syntax rules

General rules

248
8. Procedure division

8.47. RELEASE statement


The RELEASE statement provides a record for sorting.
 
identifier-2 

 
RELEASE identifier-1 FROM literal-1
 

function-call-1

 

Syntax rules

General rules

249
8. Procedure division

8.48. RESET statement


The RESET TRACE stops the names of procedures reached by execution being displayed.
RESET TRACE

Syntax rules

General rules

250
8. Procedure division

8.49. RETURN statement


The RETURN statement retrieves records from the sorting process in order.
h i
RETURN file-name-1 RECORD INTO identifier-1

AT END imperative-statement-1
h i
NOT AT END imperative-statement-2
h i
END-RETURN

Syntax rules

General rules

251
8. Procedure division

8.50. REWRITE statement


The REWRITE statement replaces an existing record in the file with one provided by the
program.
 
identifier-1
 

 
 
 
record-name-1 FROM literal-1

  


  

 
function-name-1

 
 
 
REWRITE  


 identifier-2
  
 
FILE file-name-1 FROM

literal-2

 


 

function-name-2

 
  
 

h i
retry-phrase

h h i i
WITH NO LOCK
" #
INVALID KEY imperative-statement-1

NOT INVALID KEY imperative-statement-2

h i
END-REWRITE

Syntax rules

General rules

252
8. Procedure division

8.51. ROLLBACK statement


The ROLLBACK statement deletes any pending file writes.
ROLLBACK TRANSACTION

Syntax rules

General rules

253
8. Procedure division

8.52. SEARCH statement


The SEARCH statement iterates through a table to find a record satisfying a condition.

Format 1 (simple)

h i
SEARCH identifier-1 VARYING identifier-2
h i
AT END imperative-statement-1
n o
WHEN condition-1 imperative-statement-2 . . .
h i
END-SEARCH

Format 2 (all)

SEARCH ALL identifier-3


h i
AT END imperative-statement-3

WHEN expression-1 imperative-statement-4


h i
END-SEARCH

Syntax rules

General rules

254
8. Procedure division

8.53. SEND statement


The SEND statement provides data to a communication descriptor.

Format 1 (from)

SEND cd-name-1 FROM identifier-1

Format 2 (with indicator)

identifier-3
 

 
h i ESI
 

SEND cd-name-2 FROM identifier-2 WITH


 EMI 


EGI
 

( )" # 
identifier-4 LINE 

( ) 
 
 BEFORE  literal-1

LINES 

ADVANCING
 
 AFTER mnemonic-name-1
 

 
 
 
PAGE
 

h i
REPLACING LINE

Syntax rules

General rules

255
8. Procedure division

8.54. SET statement


The SET statement sets the value or properties of a data item.

Format 1 (simple)

 
identifier-2
 

SET identifier-1 TO literal-1
arithmetic-expression-1

 

Format 2 (entry)

( )
identifier-4
SET identifier-3 TO ENTRY
literal-2

Format 3 (environment)

( ) ( )
identifier-5 identifier-6
SET ENVIRONMENT TO
literal-3 literal-4

Format 4 (attribute)

( )
BELL
 


 
 

BEEP

 
 



 
 


  
BLINK

 
 



 
 

  
HIGHLIGHT


 
 ( )


  ON 
 
SET identifier-7 ATTRIBUTE LOWLIGHT ...
OFF 
REVERSE-VIDEO


 
 


  

  
UNDERLINE


 
 



 
 

  
LEFTLINE


 
 


 
 

  
OVERLINE
  

256
8. Procedure division

Format 5 (arithmetic)

( )
n o UP
SET index-name-1 . . . BY arithmetic-expression-2
DOWN

Format 6 (on/off)

( ( ))
n o ON
SET mnemonic-name-1 . . . TO ...
OFF

Format 7 (true/false)

( ( ))
n o TRUE
SET condition-name-1 . . . TO ...
FALSE

Format 8 (exception)

SET LAST EXCEPTION TO OFF

Format 9 (thread)

( )
h i identifier-9
SET THREAD identifier-8 PRIORITY TO
integer-1

Format 10 (file-handler)

( )
n o FH--FCD
SET identifier-10 . . . TO ADDRESS OF OF file-name-1
FH--KEYDEF

257
8. Procedure division

Syntax rules

General rules

258
8. Procedure division

8.55. SORT statement


The SORT statement sorts the record of a file or a table.
" ( ) #
ASCENDING h i
SORT identifier-1 ON KEY identifier-2 . . . . . .
DESCENDING
h h ii
WITH DUPLICATES IN ORDER

  h i 
IS alphanumeric-collating-sequence national-collating-sequence

 

  

COLLATING SEQUENCE IS
 ( ) 
FOR ALPHANUMERIC IS alphanumeric-collating-sequence 
 
 
 
 FOR NATIONAL IS national-collating-sequence



 n o 
USING file-name-1 . . .
 "( ) #
 THROUGH 
INPUT PROCEDURE IS procedure-name-1 procedure-name-2
 
THRU
 n o 
GIVING file-name-2 . . .
 "( ) #
 THROUGH 
OUTPUT PROCEDURE IS procedure-name-3 procedure-name-4
 
THRU

Syntax rules

General rules

259
8. Procedure division

8.56. START statement


The START statement changes the record currently being considered. It may also change
the order in which records are accessed.

Format 1 (file)

FIRST
 

START file-name-1 KEY IS relational-operator identifier-1


 

LAST
" ( ) #
SIZE
WITH arithmetic-expression-1
LENGTH
" #
INVALID KEY imperative-statement-1

NOT INVALID KEY imperative-statement-2

h i
END-START

Format 2 (transaction)

START TRANSACTION

Syntax rules

General rules

260
8. Procedure division

8.57. STOP statement


The STOP statement terminates the run unit and returns control to the operating system.

Format 1 (standard)

( )( ) 
RETURNING identifier-1
 GIVING literal-1
 
STOP RUN 

 ( ) " #
ERROR identifier-2 
WITH STATUS
 
NORMAL literal-2

Format 2 (literal)

STOP literal-3

Format 3 (identifier)

STOP identifier-3

Format 4 (ACUCOBOL)

( )
identifier-4
STOP RUN
literal-4

Format 5 (thread)

h i
STOP THREAD identifier-5

261
8. Procedure division

Syntax rules

General rules

262
8. Procedure division

8.58. STRING statement


The STRING statement appends multiples character strings and stores the result.
  
SIZE

( )
 identifier-1
  
 
STRING DELIMITED BY identifier-2  . . . INTO identifier-3
 
 literal-1
literal-2
 
 
 

h i
WITH POINTER IS identifier-4
" #
ON OVERFLOW imperative-statement-1

NOT ON OVERFLOW imperative-statement-2

h i
END-STRING

Syntax rules

General rules

263
8. Procedure division

8.59. SUBTRACT statement


The SUBTRACT statement subtracts one set of numbers from another set of numbers
and stores the results.

Format 1 (simple)

( ) (( ) )
identifier-1 identifier-2 h i
SUBTRACT . . . FROM rounded-phrase ...
literal-1 literal-2
" #
ON SIZE ERROR imperative-statement-1

NOT ON SIZE ERROR imperative-statement-2

h i
END-SUBTRACT

Format 2 (giving)

( ) ( )
identifier-3 identifier-4
SUBTRACT . . . FROM
literal-3 literal-4
(( ) )
identifier-5 h i
GIVING rounded-phrase ...
literal-5
" #
ON SIZE ERROR imperative-statement-3

NOT ON SIZE ERROR imperative-statement-4

h i
END-SUBTRACT

Format 3 (corresponding)

264
8. Procedure division

( )
CORR h i
SUBTRACT identifier-6 FROM identifier-7 rounded-phrase
CORRESPONDING
" #
ON SIZE ERROR imperative-statement-5

NOT ON SIZE ERROR imperative-statement-6

h i
END-SUBTRACT

Format 4 (table)

h i
SUBTRACT TABLE identifier-8 TO identifier-9 rounded-phrase

h i
FROM INDEX integer-1 TO integer-2

h i
DESTINATION INDEX integer-3

" #
ON SIZE ERROR imperative-statement-7

NOT ON SIZE ERROR imperative-statement-8

h i
END-SUBTRACT

Syntax rules

General rules

265
8. Procedure division

8.60. SUPPRESS statement


The SUPPRESS statement suppresses the writing of a report group.
SUPPRESS PRINTING

Syntax rules

General rules

266
8. Procedure division

8.61. TERMINATE statement


The TERMINATE statement prevents further writing of a report.
n o
TERMINATE report-name-1 . . .

Syntax rules

General rules

267
8. Procedure division

8.62. TRANSFORM statement


The TRANSFORM statement replaces instances of character with another character.
( ) ( )
identifier-2 identifier-3
TRANSFORM identifier-1 FROM TO
literal-1 literal-2

Syntax rules

General rules

268
8. Procedure division

8.63. UNLOCK statement


The UNLOCK statement releases all currently held locks on a file.
" #
RECORD
UNLOCK file-name-1
RECORDS

Syntax rules

General rules

269
8. Procedure division

8.64. UNSTRING statement


The UNSTRING statement extracts substrings from a string and copies the substrings
to specified data items.
( )
identifier-1
UNSTRING
literal-1
" ( )( ( )) #
h
i identifier-2 h i identifier-3
DELIMITED BY ALL OR ALL ...
literal-2 literal-3
n h ih io
INTO identifier-4 DELIMITER IN identifier-5 COUNT IN identifier-6 . . .
h i
WITH POINTER IS identifier-7
h i
TALLYING IN identifier-8
" #
ON OVERFLOW imperative-statement-1

NOT ON OVERFLOW imperative-statement-2

h i
END-UNSTRING

Syntax rules

General rules

270
8. Procedure division

8.65. USE statement


The USE statement indicates when a declarative should be executed.

Format 1 (file exception)

( )
h i EXCEPTION
USE GLOBAL AFTER STANDARD PROCEDURE ON
ERROR

INPUT
   

 


n o  OUTPUT   
file-name-1 . . .   . . .
 

  I-O   
 
 EXTEND 

Format 2 (debugging)

 
procedure-name-1
 

USE FOR DEBUGGING ON ALL PROCEDURES ...
ALL REFERENCES OF identifier-1

 

Format 3 (start/end)

( )
START
USE AT PROGRAM
END

Format 4 (reporting)

h i
USE GLOBAL BEFORE REPORTING identifier-2

271
8. Procedure division

Format 5 (exception)

n h i o
USE EXCEPTION exception-name FILE file-name-2 . . . . . .

Syntax rules

General rules

272
8. Procedure division

8.66. VALIDATE statement


The VALIDATE statement performs various validation tasks for a data item.
n o
VALIDATE identifier-1 . . .

Syntax rules

General rules

273
8. Procedure division

8.67. WRITE statement


The WRITE statement provides a new record to the file.

Format 1 (sequential)

 
identifier-1
 

 
 
 
record-name-1 FROM literal-1

  


  

 
function-name-1

 
 
 
WRITE  


 identifier-2
  
 
FILE file-name-1 FROM

literal-2

 


 

function-name-2

 
 
 

( )" # 
identifier-3 LINE

( ) 
 

 BEFORE  literal-3

LINES


ADVANCING
 
 AFTER mnemonic-name-1
 

 
 
 
PAGE
 

h i h h i i
retry-phrase WITH NO LOCK

 ( ) 
END-OF-PAGE
 AT imperative-statement-1

EOP

 
 ( ) 
 END-OF-PAGE 
NOT AT imperative-statement-2
 
EOP
h i
END-WRITE

Format 2 (random)

274
8. Procedure division

 
identifier-4
 

 
 
 
record-name-2 FROM literal-4

  


  

 
function-name-3

 
 
 

WRITE  


 identifier-5
  
 
FILE file-name-2 FROM

literal-5

 


 

function-name-4

 
  
 

( )" # 
identifier-6 LINE

( ) 
 

 BEFORE  literal-6

LINES 

ADVANCING
 
 AFTER mnemonic-name-2
 

 
 
 
PAGE
 

h i h h i i
retry-phrase WITH NO LOCK

" #
INVALID KEY imperative-statement-3

NOT INVALID KEY imperative-statement-4

h i
END-WRITE

Syntax rules

General rules

275
8. Procedure division

8.68. XML GENERATE statement


The XML GENERATE statement creates an XML document based on the structure and
content of the input data item.
XML GENERATE identifier-1 FROM identifier-2
h i
COUNT IN identifier-3
" ( )#
identifier-4
WITH ENCODING
literal-1
h i
WITH XML-DECLARATION
h i
WITH ATTRIBUTES
" ( )" ( )##
identifier-5 identifier-6
NAMESPACE IS NAMESPACE-PREFIX IS
literal-2 literal-3
h n o i
NAME OF identifier-7 IS literal-4 . . .

   
ATTRIBUTE


  

TYPE OF identifier-8 IS ELEMENT ...
 

CONTENT

 
 


identifier-9
   
 

ATTRIBUTE
 
     
 
( )
NUMERIC
 
 
 
 
 
 
ELEMENT
 
 
   
 
 
 
 NONNUMERIC
 
 
   
 
 
CONTENT
 
  
 
 
   
SUPPRESS EVERY  ...
  
 
 


 ATTRIBUTE 
 

 
 
ELEMENT
 
 
 
 
 
 
 
 
 
 
   
CONTENT
 
 
 
 
 
 
 
 
 
 
 h i 
WHEN
non-quote-alnum-fig-const OR . . . non-quote-alnum-fig-const
 

" #
ON EXCEPTION imperative-statement-1

NOT ON EXCEPTION imperative-statement-2

h i
END-XML

where non-quote-alnum-fig-const is

276
8. Procedure division

ZERO
 
 

ZEROES

 


 

 
ZEROS

 


 

 
SPACE

 


 

SPACES
HIGH-VALUE 

 


 
 
HIGH-VALUES

 
 

 
LOW-VALUE 

 


 

LOW-VALUES
 

Syntax rules

General rules

277
8. Procedure division

8.69. XML PARSE statement


The XML PARSE statement starts an event-driven XML parser; the processing procedure
is performed as each component of the XML document is identified in order.
XML PARSE identifier-1
" ( )#
identifier-2
WITH ENCODING
literal-1
h i
RETURNING NATIONAL
h i
VALIDATING WITH identifier-3
"( ) #
THROUGH
PROCESSING PROCEDURE IS procedure-name-1 procedure-name-2
THRU
" #
ON EXCEPTION imperative-statement-1

NOT ON EXCEPTION imperative-statement-2

h i
END-XML

Syntax rules

General rules

278
9. Intrinsic functions
9.1. ABS function
( )
ABS
FUNCTION ( argument-1 )
ABSOLUTE-VALUE

Syntax rules

General rules

280
9. Intrinsic functions

9.2. ACOS function


FUNCTION ACOS ( argument-1 )

Syntax rules

General rules

281
9. Intrinsic functions

9.3. ANNUITY function


FUNCTION ANNUITY ( argument-1 argument-2 )

Syntax rules

General rules

282
9. Intrinsic functions

9.4. ASIN function


FUNCTION ASIN ( argument-1 )

Syntax rules

General rules

283
9. Intrinsic functions

9.5. ATAN function


FUNCTION ATAN ( argument-1 )

Syntax rules

General rules

284
9. Intrinsic functions

9.6. BOOLEAN-OF-INTEGER function

FUNCTION BOOLEAN-OF-INTEGER ( argument-1 argument-2 )

Syntax rules

General rules

285
9. Intrinsic functions

9.7. BYTE-LENGTH function


FUNCTION BYTE-LENGTH ( argument-1 )

Syntax rules

General rules

286
9. Intrinsic functions

9.8. CHAR function


FUNCTION CHAR ( argument-1 )

Syntax rules

General rules

287
9. Intrinsic functions

9.9. CHAR-NATIONAL function

FUNCTION CHAR-NATIONAL ( argument-1 )

Syntax rules

General rules

288
9. Intrinsic functions

9.10. COMBINED-DATETIME function


FUNCTION COMBINED-DATETIME ( argument-1 argument-2 )

Syntax rules

General rules

289
9. Intrinsic functions

9.11. CONCAT function


n o n o
FUNCTION CONCAT CONCATENATE ( argument-1 . . . )

Syntax rules

General rules

290
9. Intrinsic functions

9.12. CONTENT-LENGTH function


FUNCTION CONTENT-LENGTH ( argument-1 )

Syntax rules

General rules

291
9. Intrinsic functions

9.13. CONTENT-OF function


h i
FUNCTION CONTENT-OF ( argument-1 argument-2 )

Syntax rules

General rules

292
9. Intrinsic functions

9.14. COS function


FUNCTION COS ( argument-1 )

Syntax rules

General rules

293
9. Intrinsic functions

9.15. CURRENCY-SYMBOL function


FUNCTION CURRENCY-SYMBOL

Syntax rules

General rules

294
9. Intrinsic functions

9.16. CURRENT-DATE function


FUNCTION CURRENT-DATE

Syntax rules

General rules

295
9. Intrinsic functions

9.17. DATE-OF-INTEGER function


FUNCTION DATE-OF-INTEGER ( argument-1 )

Syntax rules

General rules

296
9. Intrinsic functions

9.18. DATE-TO-YYYYMMDD function


h h ii
FUNCTION DATE-TO-YYYYMMDD ( argument-1 argument-2 argument-3 )

Syntax rules

General rules

297
9. Intrinsic functions

9.19. DAY-OF-INTEGER function


FUNCTION DAY-OF-INTEGER ( argument-1 )

Syntax rules

General rules

298
9. Intrinsic functions

9.20. DAY-TO-YYYYDDD function


h h ii
FUNCTION DAY-TO-YYYYDDD ( argument-1 argument-2 argument-3 )

Syntax rules

General rules

299
9. Intrinsic functions

9.21. DISPLAY-OF function

FUNCTION DISPLAY-OF ( argument-1 )

Syntax rules

General rules

300
9. Intrinsic functions

9.22. E function
FUNCTION E

Syntax rules

General rules

301
9. Intrinsic functions

9.23. EXCEPTION-FILE function


FUNCTION EXCEPTION-FILE

Syntax rules

General rules

302
9. Intrinsic functions

9.24. EXCEPTION-FILE-N function

FUNCTION EXCEPTION-FILE-N

Syntax rules

General rules

303
9. Intrinsic functions

9.25. EXCEPTION-LOCATION function


FUNCTION EXCEPTION-LOCATION

Syntax rules

General rules

304
9. Intrinsic functions

9.26. EXCEPTION-LOCATION-N function

FUNCTION EXCEPTION-LOCATION-N

Syntax rules

General rules

305
9. Intrinsic functions

9.27. EXCEPTION-STATEMENT function


FUNCTION EXCEPTION-STATEMENT

Syntax rules

General rules

306
9. Intrinsic functions

9.28. EXCEPTION-STATUS function


FUNCTION EXCEPTION-STATUS

Syntax rules

General rules

307
9. Intrinsic functions

9.29. EXP function


FUNCTION EXP ( argument-1 )

Syntax rules

General rules

308
9. Intrinsic functions

9.30. EXP10 function


FUNCTION EXP10 ( argument-1 )

Syntax rules

General rules

309
9. Intrinsic functions

9.31. FACTORIAL function


FUNCTION FACTORIAL ( argument-1 )

Syntax rules

General rules

310
9. Intrinsic functions

9.32. FORMATTED-CURRENT-DATE function


FUNCTION FORMATTED-CURRENT-DATE ( argument-1 )

Syntax rules

General rules

311
9. Intrinsic functions

9.33. FORMATTED-DATE function


FUNCTION FORMATTED-DATE ( argument-1 argument-2 )

Syntax rules

General rules

312
9. Intrinsic functions

9.34. FORMATTED-DATETIME function


FUNCTION FORMATTED-DATETIME
" #
argument-4
( argument-1 argument-2 argument-3 )
SYSTEM-OFFSET

Syntax rules

General rules

313
9. Intrinsic functions

9.35. FORMATTED-TIME function


" #
argument-3
FUNCTION FORMATTED-TIME ( argument-1 argument-2 )
SYSTEM-OFFSET

Syntax rules

General rules

314
9. Intrinsic functions

9.36. FRACTION-PART function


FUNCTION FRACTION-PART ( argument-1 )

Syntax rules

General rules

315
9. Intrinsic functions

9.37. HIGHEST-ALGEBRAIC function


FUNCTION HIGHEST-ALGEBRAIC ( argument-1 )

Syntax rules

General rules

316
9. Intrinsic functions

9.38. INTEGER function


FUNCTION INTEGER ( argument-1 )

Syntax rules

General rules

317
9. Intrinsic functions

9.39. INTEGER-OF-BOOLEAN function

FUNCTION INTEGER-OF-BOOLEAN ( argument-1 )

Syntax rules

General rules

318
9. Intrinsic functions

9.40. INTEGER-OF-DATE function


FUNCTION INTEGER-OF-DATE ( argument-1 )

Syntax rules

General rules

319
9. Intrinsic functions

9.41. INTEGER-OF-DAY function


FUNCTION INTEGER-OF-DAY ( argument-1 )

Syntax rules

General rules

320
9. Intrinsic functions

9.42. INTEGER-OF-FORMATTED-DATE function


FUNCTION INTEGER-OF-FORMATTED-DATE ( argument-1 argument-2 )

Syntax rules

General rules

321
9. Intrinsic functions

9.43. INTEGER-PART function


FUNCTION INTEGER-PART ( argument-1 )

Syntax rules

General rules

322
9. Intrinsic functions

9.44. LENGTH function


h i
FUNCTION LENGTH ( argument-1 PHYSICAL )

Syntax rules

General rules

323
9. Intrinsic functions

9.45. LENGTH-AN function


FUNCTION LENGTH-AN ( argument-1 )

Syntax rules

General rules

324
9. Intrinsic functions

9.46. LOCALE-COMPARE function


h i
FUNCTION LOCALE-COMPARE ( argument-1 argument-2 argument-3 )

Syntax rules

General rules

325
9. Intrinsic functions

9.47. LOCALE-DATE function


h i
FUNCTION LOCALE-DATE ( argument-1 argument-2 )

Syntax rules

General rules

326
9. Intrinsic functions

9.48. LOCALE-TIME function


h i
FUNCTION LOCALE-TIME ( argument-1 argument-2 )

Syntax rules

General rules

327
9. Intrinsic functions

9.49. LOCALE-TIME-FROM-SECONDS function


h i
FUNCTION LOCALE-TIME-FROM-SECONDS ( argument-1 argument-2 )

Syntax rules

General rules

328
9. Intrinsic functions

9.50. LOG function


FUNCTION LOG ( argument-1 )

Syntax rules

General rules

329
9. Intrinsic functions

9.51. LOG10 function


FUNCTION LOG10 ( argument-1 )

Syntax rules

General rules

330
9. Intrinsic functions

9.52. LOWER-CASE function


FUNCTION LOWER-CASE ( argument-1 )

Syntax rules

General rules

331
9. Intrinsic functions

9.53. LOWEST-ALGEBRAIC function


FUNCTION LOWEST-ALGEBRAIC ( argument-1 )

Syntax rules

General rules

332
9. Intrinsic functions

9.54. MAX function


n o
FUNCTION MAX ( argument-1 . . . )

Syntax rules

General rules

333
9. Intrinsic functions

9.55. MEAN function


n o
FUNCTION MEAN ( argument-1 . . . )

Syntax rules

General rules

334
9. Intrinsic functions

9.56. MEDIAN function


n o
FUNCTION MEDIAN ( argument-1 . . . )

Syntax rules

General rules

335
9. Intrinsic functions

9.57. MIDRANGE function


n o
FUNCTION MIDRANGE ( argument-1 . . . )

Syntax rules

General rules

336
9. Intrinsic functions

9.58. MIN function


n o
FUNCTION MIN ( argument-1 . . . )

Syntax rules

General rules

337
9. Intrinsic functions

9.59. MOD function


FUNCTION MOD ( argument-1 argument-2 )

Syntax rules

General rules

338
9. Intrinsic functions

9.60. MODULE-CALLER-ID function


FUNCTION MODULE-CALLER-ID

Syntax rules

General rules

339
9. Intrinsic functions

9.61. MODULE-DATE function


FUNCTION MODULE-DATE

Syntax rules

General rules

340
9. Intrinsic functions

9.62. MODULE-FORMATTED-DATE function


FUNCTION MODULE-FORMATTED-DATE

Syntax rules

General rules

341
9. Intrinsic functions

9.63. MODULE-ID function


FUNCTION MODULE-ID

Syntax rules

General rules

342
9. Intrinsic functions

9.64. MODULE-PATH function


FUNCTION MODULE-PATH

Syntax rules

General rules

343
9. Intrinsic functions

9.65. MODULE-SOURCE function


FUNCTION MODULE-SOURCE

Syntax rules

General rules

344
9. Intrinsic functions

9.66. MODULE-TIME function


FUNCTION MODULE-TIME

Syntax rules

General rules

345
9. Intrinsic functions

9.67. MONETARY-DECIMAL-POINT function


FUNCTION MONETARY-DECIMAL-POINT

Syntax rules

General rules

346
9. Intrinsic functions

9.68. MONETARY-THOUSANDS-SEPARATOR function


FUNCTION MONETARY-THOUSANDS-SEPARATOR

Syntax rules

General rules

347
9. Intrinsic functions

9.69. NATIONAL-OF function


h i
FUNCTION NATIONAL-OF ( argument-1 argument-2 )

Syntax rules

General rules

348
9. Intrinsic functions

9.70. NUMERIC-DECIMAL-POINT function


FUNCTION NUMERIC-DECIMAL-POINT

Syntax rules

General rules

349
9. Intrinsic functions

9.71. NUMERIC-THOUSANDS-SEPARATOR function


FUNCTION NUMERIC-THOUSANDS-SEPARATOR

Syntax rules

General rules

350
9. Intrinsic functions

9.72. NUMVAL function


FUNCTION NUMVAL ( argument-1 )

Syntax rules

General rules

351
9. Intrinsic functions

9.73. NUMVAL-C function


h i
FUNCTION NUMVAL-C ( argument-1 argument-2 )

Syntax rules

General rules

352
9. Intrinsic functions

9.74. NUMVAL-F function


FUNCTION NUMVAL-F ( argument-1 )

Syntax rules

General rules

353
9. Intrinsic functions

9.75. ORD function


FUNCTION ORD ( argument-1 )

Syntax rules

General rules

354
9. Intrinsic functions

9.76. ORD-MAX function


n o
FUNCTION ORD-MAX ( argument-1 . . . )

Syntax rules

General rules

355
9. Intrinsic functions

9.77. ORD-MIN function


n o
FUNCTION ORD-MIN ( argument-1 . . . )

Syntax rules

General rules

356
9. Intrinsic functions

9.78. PI function
FUNCTION PI

Syntax rules

General rules

357
9. Intrinsic functions

9.79. PRESENT-VALUE function


h i
FUNCTION PRESENT-VALUE ( argument-1 argument-2 argument-3 . . . )

Syntax rules

General rules

358
9. Intrinsic functions

9.80. RANDOM function


h i
FUNCTION RANDOM ( argument-1 )

Syntax rules

General rules

359
9. Intrinsic functions

9.81. RANGE function


n o
FUNCTION RANGE ( argument-1 . . . )

Syntax rules

General rules

360
9. Intrinsic functions

9.82. REM function


FUNCTION REM ( argument-1 argument-2 )

Syntax rules

General rules

361
9. Intrinsic functions

9.83. REVERSE function


FUNCTION REVERSE ( argument-1 )

Syntax rules

General rules

362
9. Intrinsic functions

9.84. SECONDS-FROM-FORMATTED-TIME function


FUNCTION SECONDS-FROM-FORMATTED-TIME ( argument-1 argument-2 )

Syntax rules

General rules

363
9. Intrinsic functions

9.85. SECONDS-PAST-MIDNIGHT function


FUNCTION SECONDS-PAST-MIDNIGHT ( argument-1 )

Syntax rules

General rules

364
9. Intrinsic functions

9.86. SIGN function


FUNCTION SIGN ( argument-1 )

Syntax rules

General rules

365
9. Intrinsic functions

9.87. SIN function


FUNCTION SIN ( argument-1 )

Syntax rules

General rules

366
9. Intrinsic functions

9.88. SQRT function

FUNCTION SQRT ( argument-1 )

Syntax rules

General rules

367
9. Intrinsic functions

9.89. STANDARD-COMPARE function

FUNCTION STANDARD-COMPARE

h ih i
( argument-1 argument-2 argument-3 argument-4 )

Syntax rules

General rules

368
9. Intrinsic functions

9.90. STANDARD-DEVIATION function


n o
FUNCTION STANDARD-DEVIATION ( argument-1 . . . )

Syntax rules

General rules

369
9. Intrinsic functions

9.91. STORED-CHAR-LENGTH function


FUNCTION STORED-CHAR-LENGTH ( argument-1 )

Syntax rules

General rules

370
9. Intrinsic functions

9.92. SUBSTITUTE function


n o
FUNCTION SUBSTITUTE ( argument-1 argument-2 argument-3 . . . )

Syntax rules

General rules

371
9. Intrinsic functions

9.93. SUBSTITUTE-CASE function


n o
FUNCTION SUBSTITUTE-CASE ( argument-1 argument-2 argument-3 . . . )

Syntax rules

General rules

372
9. Intrinsic functions

9.94. SUM function


n o
FUNCTION SUM ( argument-1 . . . )

Syntax rules

General rules

373
9. Intrinsic functions

9.95. TAN function


FUNCTION TAN ( argument-1 )

Syntax rules

General rules

374
9. Intrinsic functions

9.96. TEST-DATE-YYYYMMDD function


FUNCTION TEST-DATE-YYYYMMDD ( argument-1 )

Syntax rules

General rules

375
9. Intrinsic functions

9.97. TEST-DAY-YYYYDDD function


FUNCTION TEST-DAY-YYYYDDD ( argument-1 )

Syntax rules

General rules

376
9. Intrinsic functions

9.98. TEST-FORMATTED-DATETIME function


FUNCTION TEST-FORMATTED-DATETIME ( argument-1 argument-2 )

Syntax rules

General rules

377
9. Intrinsic functions

9.99. TEST-NUMVAL function


FUNCTION TEST-NUMVAL ( argument-1 )

Syntax rules

General rules

378
9. Intrinsic functions

9.100. TEST-NUMVAL-C function


FUNCTION TEST-NUMVAL-C ( argument-1 argument-2 )

Syntax rules

General rules

379
9. Intrinsic functions

9.101. TEST-NUMVAL-F function


FUNCTION TEST-NUMVAL-F ( argument-1 )

Syntax rules

General rules

380
9. Intrinsic functions

9.102. TRIM function


" #
LEADING
FUNCTION TRIM ( argument-1 )
TRAILING

Syntax rules

General rules

381
9. Intrinsic functions

9.103. UPPER-CASE function


FUNCTION UPPER-CASE ( argument-1 )

Syntax rules

General rules

382
9. Intrinsic functions

9.104. VARIANCE function


n o
FUNCTION VARIANCE ( argument-1 . . . )

Syntax rules

General rules

383
9. Intrinsic functions

9.105. WHEN-COMPILED function


FUNCTION WHEN-COMPILED

Syntax rules

General rules

384
9. Intrinsic functions

9.106. YEAR-TO-YYYY function


h h ii
FUNCTION YEAR-TO-YYYY ( argument-1 argument-2 argument-3 )

Syntax rules

General rules

385
9. Intrinsic functions

387
Appendices

389
A. GNU Free Documentation License
Version 1.3, 3 November 2008
Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.

<http://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document,
but changing it is not allowed.

A.1. Preamble
The purpose of this License is to make a manual, textbook, or other functional and use-
ful document “free” in the sense of freedom: to assure everyone the effective freedom
to copy and redistribute it, with or without modifying it, either commercially or noncom-
mercially. Secondarily, this License preserves for the author and publisher a way to get
credit for their work, while not being considered responsible for modifications made by
others.
This License is a kind of “copyleft”, which means that derivative works of the docu-
ment must themselves be free in the same sense. It complements the GNU General
Public License, which is a copyleft license designed for free software.
We have designed this License in order to use it for manuals for free software, be-
cause free software needs free documentation: a free program should come with man-
uals providing the same freedoms that the software does. But this License is not limited
to software manuals; it can be used for any textual work, regardless of subject matter
or whether it is published as a printed book. We recommend this License principally for
works whose purpose is instruction or reference.

391
A. GNU Free Documentation License

A.2. Applicability and definitions


This License applies to any manual or other work, in any medium, that contains a no-
tice placed by the copyright holder saying it can be distributed under the terms of this
License. Such a notice grants a world-wide, royalty-free license, unlimited in duration,
to use that work under the conditions stated herein. The “Document”, below, refers to
any such manual or work. Any member of the public is a licensee, and is addressed as
“you”. You accept the license if you copy, modify or distribute the work in a way requiring
permission under copyright law.
A “Modified Version” of the Document means any work containing the Document or a
portion of it, either copied verbatim, or with modifications and/or translated into another
language.
A “Secondary Section” is a named appendix or a front-matter section of the Document
that deals exclusively with the relationship of the publishers or authors of the Document
to the Document’s overall subject (or to related matters) and contains nothing that could
fall directly within that overall subject. (Thus, if the Document is in part a textbook of
mathematics, a Secondary Section may not explain any mathematics.) The relationship
could be a matter of historical connection with the subject or with related matters, or of
legal, commercial, philosophical, ethical or political position regarding them.
The “Invariant Sections” are certain Secondary Sections whose titles are designated,
as being those of Invariant Sections, in the notice that says that the Document is re-
leased under this License. If a section does not fit the above definition of Secondary
then it is not allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant Sections then there
are none.
The “Cover Texts” are certain short passages of text that are listed, as Front-Cover
Texts or Back-Cover Texts, in the notice that says that the Document is released under
this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may
be at most 25 words.
A “Transparent” copy of the Document means a machine-readable copy, represented
in a format whose specification is available to the general public, that is suitable for revis-
ing the document straightforwardly with generic text editors or (for images composed
of pixels) generic paint programs or (for drawings) some widely available drawing editor,
and that is suitable for input to text formatters or for automatic translation to a variety of
formats suitable for input to text formatters. A copy made in an otherwise Transparent
file format whose markup, or absence of markup, has been arranged to thwart or dis-
courage subsequent modification by readers is not Transparent. An image format is not
Transparent if used for any substantial amount of text. A copy that is not “Transparent”
is called “Opaque”.
Examples of suitable formats for Transparent copies include plain ASCII without markup,
Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD,

392
A. GNU Free Documentation License

and standard-conforming simple HTML, PostScript or PDF designed for human modi-
fication. Examples of transparent image formats include PNG, XCF and JPG. Opaque
formats include proprietary formats that can be read and edited only by proprietary word
processors, SGML or XML for which the DTD and/or processing tools are not generally
available, and the machine-generated HTML, PostScript or PDF produced by some word
processors for output purposes only.
The “Title Page” means, for a printed book, the title page itself, plus such following
pages as are needed to hold, legibly, the material this License requires to appear in the
title page. For works in formats which do not have any title page as such, “Title Page”
means the text near the most prominent appearance of the work’s title, preceding the
beginning of the body of the text.
The “publisher” means any person or entity that distributes copies of the Document
to the public.
A section “Entitled XYZ” means a named subunit of the Document whose title either
is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in
another language. (Here XYZ stands for a specific section name mentioned below, such
as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve
the Title” of such a section when you modify the Document means that it remains a
section “Entitled XYZ” according to this definition.
The Document may include Warranty Disclaimers next to the notice which states that
this License applies to the Document. These Warranty Disclaimers are considered to be
included by reference in this License, but only as regards disclaiming warranties: any
other implication that these Warranty Disclaimers may have is void and has no effect
on the meaning of this License.

393
A. GNU Free Documentation License

A.3. Verbatim copying


You may copy and distribute the Document in any medium, either commercially or non-
commercially, provided that this License, the copyright notices, and the license notice
saying this License applies to the Document are reproduced in all copies, and that you
add no other conditions whatsoever to those of this License. You may not use tech-
nical measures to obstruct or control the reading or further copying of the copies you
make or distribute. However, you may accept compensation in exchange for copies. If
you distribute a large enough number of copies you must also follow the conditions in
section 3.
You may also lend copies, under the same conditions stated above, and you may
publicly display copies.

394
A. GNU Free Documentation License

A.4. Copying in quantity


If you publish printed copies (or copies in media that commonly have printed covers) of
the Document, numbering more than 100, and the Document’s license notice requires
Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all
these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the
back cover. Both covers must also clearly and legibly identify you as the publisher of
these copies. The front cover must present the full title with all words of the title equally
prominent and visible. You may add other material on the covers in addition. Copying
with changes limited to the covers, as long as they preserve the title of the Document
and satisfy these conditions, can be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put
the first ones listed (as many as fit reasonably) on the actual cover, and continue the
rest onto adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100,
you must either include a machine-readable Transparent copy along with each Opaque
copy, or state in or with each Opaque copy a computer-network location from which the
general network-using public has access to download using public-standard network
protocols a complete Transparent copy of the Document, free of added material. If you
use the latter option, you must take reasonably prudent steps, when you begin distribu-
tion of Opaque copies in quantity, to ensure that this Transparent copy will remain thus
accessible at the stated location until at least one year after the last time you distribute
an Opaque copy (directly or through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well
before redistributing any large number of copies, to give them a chance to provide you
with an updated version of the Document.

395
A. GNU Free Documentation License

A.5. Modifications
You may copy and distribute a Modified Version of the Document under the conditions of
sections 2 and 3 above, provided that you release the Modified Version under precisely
this License, with the Modified Version filling the role of the Document, thus licensing
distribution and modification of the Modified Version to whoever possesses a copy of
it. In addition, you must do these things in the Modified Version:

A. Use in the Title Page (and on the covers, if any) a title distinct from that of the
Document, and from those of previous versions (which should, if there were any,
be listed in the History section of the Document). You may use the same title as a
previous version if the original publisher of that version gives permission.

B. List on the Title Page, as authors, one or more persons or entities responsible for
authorship of the modifications in the Modified Version, together with at least five
of the principal authors of the Document (all of its principal authors, if it has fewer
than five), unless they release you from this requirement.

C. State on the Title page the name of the publisher of the Modified Version, as the
publisher.

D. Preserve all the copyright notices of the Document.

E. Add an appropriate copyright notice for your modifications adjacent to the other
copyright notices.

F. Include, immediately after the copyright notices, a license notice giving the public
permission to use the Modified Version under the terms of this License, in the form
shown in the Addendum below.

G. Preserve in that license notice the full lists of Invariant Sections and required Cover
Texts given in the Document’s license notice.

H. Include an unaltered copy of this License.

I. Preserve the section Entitled “History”, Preserve its Title, and add to it an item
stating at least the title, year, new authors, and publisher of the Modified Version
as given on the Title Page. If there is no section Entitled “History” in the Document,
create one stating the title, year, authors, and publisher of the Document as given
on its Title Page, then add an item describing the Modified Version as stated in
the previous sentence.

J. Preserve the network location, if any, given in the Document for public access to
a Transparent copy of the Document, and likewise the network locations given in
the Document for previous versions it was based on. These may be placed in the

396
A. GNU Free Documentation License

“History” section. You may omit a network location for a work that was published
at least four years before the Document itself, or if the original publisher of the
version it refers to gives permission.

K. For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title


of the section, and preserve in the section all the substance and tone of each of
the contributor acknowledgements and/or dedications given therein.

L. Preserve all the Invariant Sections of the Document, unaltered in their text and
in their titles. Section numbers or the equivalent are not considered part of the
section titles.

M. Delete any section Entitled “Endorsements”. Such a section may not be included
in the Modified Version.

N. Do not retitle any existing section to be Entitled “Endorsements” or to conflict in


title with any Invariant Section.

O. Preserve any Warranty Disclaimers.

If the Modified Version includes new front-matter sections or appendices that qualify
as Secondary Sections and contain no material copied from the Document, you may at
your option designate some or all of these sections as invariant. To do this, add their
titles to the list of Invariant Sections in the Modified Version’s license notice. These titles
must be distinct from any other section titles.
You may add a section Entitled “Endorsements”, provided it contains nothing but en-
dorsements of your Modified Version by various parties—for example, statements of
peer review or that the text has been approved by an organization as the authoritative
definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of
up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified
Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be
added by (or through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or by arrangement
made by the same entity you are acting on behalf of, you may not add another; but you
may replace the old one, on explicit permission from the previous publisher that added
the old one.
The author(s) and publisher(s) of the Document do not by this License give permis-
sion to use their names for publicity for or to assert or imply endorsement of any Modi-
fied Version.

397
A. GNU Free Documentation License

A.6. Combining documents


You may combine the Document with other documents released under this License, un-
der the terms defined in section 4 above for modified versions, provided that you include
in the combination all of the Invariant Sections of all of the original documents, unmod-
ified, and list them all as Invariant Sections of your combined work in its license notice,
and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical
Invariant Sections may be replaced with a single copy. If there are multiple Invariant
Sections with the same name but different contents, make the title of each such section
unique by adding at the end of it, in parentheses, the name of the original author or
publisher of that section if known, or else a unique number. Make the same adjustment
to the section titles in the list of Invariant Sections in the license notice of the combined
work.
In the combination, you must combine any sections Entitled “History” in the various
original documents, forming one section Entitled “History”; likewise combine any sec-
tions Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must
delete all sections Entitled “Endorsements”.

398
A. GNU Free Documentation License

A.7. Collections of documents


You may make a collection consisting of the Document and other documents released
under this License, and replace the individual copies of this License in the various doc-
uments with a single copy that is included in the collection, provided that you follow the
rules of this License for verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute it individ-
ually under this License, provided you insert a copy of this License into the extracted
document, and follow this License in all other respects regarding verbatim copying of
that document.

399
A. GNU Free Documentation License

A.8. Aggregation with independent works


A compilation of the Document or its derivatives with other separate and independent
documents or works, in or on a volume of a storage or distribution medium, is called an
“aggregate” if the copyright resulting from the compilation is not used to limit the legal
rights of the compilation’s users beyond what the individual works permit. When the
Document is included in an aggregate, this License does not apply to the other works in
the aggregate which are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Docu-
ment, then if the Document is less than one half of the entire aggregate, the Document’s
Cover Texts may be placed on covers that bracket the Document within the aggregate,
or the electronic equivalent of covers if the Document is in electronic form. Otherwise
they must appear on printed covers that bracket the whole aggregate.

400
A. GNU Free Documentation License

A.9. Translation
Translation is considered a kind of modification, so you may distribute translations of
the Document under the terms of section 4. Replacing Invariant Sections with trans-
lations requires special permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the original versions of these
Invariant Sections. You may include a translation of this License, and all the license no-
tices in the Document, and any Warranty Disclaimers, provided that you also include the
original English version of this License and the original versions of those notices and
disclaimers. In case of a disagreement between the translation and the original version
of this License or a notice or disclaimer, the original version will prevail.
If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “His-
tory”, the requirement (section 4) to Preserve its Title (section 1) will typically require
changing the actual title.

401
A. GNU Free Documentation License

A.10. Termination
You may not copy, modify, sublicense, or distribute the Document except as expressly
provided under this License. Any attempt otherwise to copy, modify, sublicense, or dis-
tribute it is void, and will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license from a particular
copyright holder is reinstated (a) provisionally, unless and until the copyright holder ex-
plicitly and finally terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to 60 days after the
cessation.
Moreover, your license from a particular copyright holder is reinstated permanently
if the copyright holder notifies you of the violation by some reasonable means, this is
the first time you have received notice of violation of this License (for any work) from
that copyright holder, and you cure the violation prior to 30 days after your receipt of the
notice.
Termination of your rights under this section does not terminate the licenses of par-
ties who have received copies or rights from you under this License. If your rights have
been terminated and not permanently reinstated, receipt of a copy of some or all of the
same material does not give you any rights to use it.

402
A. GNU Free Documentation License

A.11. Future revisions of this license


The Free Software Foundation may publish new, revised versions of the GNU Free Doc-
umentation License from time to time. Such new versions will be similar in spirit to
the present version, but may differ in detail to address new problems or concerns. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number. If the Docu-
ment specifies that a particular numbered version of this License “or any later version”
applies to it, you have the option of following the terms and conditions either of that
specified version or of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version number of this Li-
cense, you may choose any version ever published (not as a draft) by the Free Software
Foundation. If the Document specifies that a proxy can decide which future versions
of this License can be used, that proxy’s public statement of acceptance of a version
permanently authorizes you to choose that version for the Document.

403
A. GNU Free Documentation License

A.12. Relicensing
“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web
server that publishes copyrightable works and also provides prominent facilities for any-
body to edit those works. A public wiki that anybody can edit is an example of such a
server. A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means
any set of copyrightable works thus published on the MMC site.
“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license pub-
lished by Creative Commons Corporation, a not-for-profit corporation with a principal
place of business in San Francisco, California, as well as future copyleft versions of that
license published by that same organization.
“Incorporate” means to publish or republish a Document, in whole or in part, as part
of another Document.
An MMC is “eligible for relicensing” if it is licensed under this License, and if all works
that were first published under this License somewhere other than this MMC, and subse-
quently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant
sections, and (2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site under CC-
BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible
for relicensing.

404
A. GNU Free Documentation License

A.13. Addendum: How to use this License for your documents


To use this License in a document you have written, include a copy of the License in the
document and put the following copyright and license notices just after the title page:

Copyright © YEAR YOUR NAME. Permission is granted to copy, distribute


and/or modify this document under the terms of the GNU Free Documenta-
tion License, Version 1.3 or any later version published by the Free Software
Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-
Cover Texts. A copy of the license is included in the section entitled “GNU
Free Documentation License”.

If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the
“with . . . Texts.” line with this:

with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover
Texts being LIST, and with the Back-Cover Texts being LIST.

If you have Invariant Sections without Cover Texts, or some other combination of the
three, merge those two alternatives to suit the situation.
If your document contains nontrivial examples of program code, we recommend re-
leasing these examples in parallel under your choice of free software license, such as
the GNU General Public License, to permit their use in free software.

405
B. Language element lists
This appendix is required for conformance to the COBOL standard.

B.1. Implementor-defined language element list


1. ACCEPT statement (conversion of data):

2. ACCEPT statement (device used when FROM is unspecified):

3. ACCEPT statement, screen format (result when screen items overlap):

4. ACCEPT statement, screen format (when data is verified, behavior for inconsis-
tent data):

5. ACCEPT statement (size of data transfer):

6. Alignment of alphanumeric group items (relative to first elementary item):

7. Alignment of data for increased efficiency (special or automatic alignment: in-


terpretation, implicit filler, semantics of statements):

8. ALPHABET clause (ordinal number of characters in the native coded character


sets):

9. Alphanumeric literals (number of hexadecimal digits that map to an alphanu-


meric character):

10. ASSIGN clause, USING phrase (meaning and rules for operands; consistency
rules):

11. BACKGROUND-COLOR clause (the background color when the clause is not spec-
ified or the value specified is not in the range 0 to 7):

12. Byte (number of bits in):

13. CALL statement (rules for program-name formation for a non-COBOL program):

14. CALL statement (runtime resources that are checked):

15. CALL statement (rules for locating a non-COBOL program):

16. CALL statement (calling a non-COBOL program):

407
B. Language element lists

17. CALL statement (other effects of the CALL statement):

18. CANCEL statement (result of canceling an active program when EC-PROGRAM-


CANCEL-ACTIVE is not enabled):

19. CANCEL statement (result of canceling a non-COBOL program):

20. Case mapping:

21. CHAR function (which one of the multiple characters is returned):

22. CHAR-NATIONAL function (which one of the multiple characters is returned):

23. Characters prohibited from use in text-words in COPY ... REPLACING and RE-
PLACE statements:

24. CLOSE statement (closing operations):

25. COBOL character repertoire (encoding of, mapping of, substitute graphics):

26. COBOL character repertoire (if more than one encoding in a compilation group,
control functions if any):

27. Color number (for a monochrome terminal, the mapping of the color attributes
onto other attributes):

28. Compiler directives, compiler directive IMP (syntax rules and general rules):

29. Computer’s coded character set (characters in and encoding of computer’s al-
phanumeric coded character set and computer’s national coded character set,
encoding for usage DISPLAY and usage NATIONAL):

30. Computer’s coded character set (coded character values for certain COBOL items):

31. Computer’s coded character set (correspondence between alphanumeric and na-
tional characters):

32. Computer’s coded character set (for literals, correspondence between compile-
time and runtime character sets, when conversion takes place):

33. Computer’s coded character set (correspondence between lowercase and upper-
case letters when a locale is not in effect):

34. Computer’s coded character set (when composite alphanumeric and national,
mapping of characters to each):

35. Computer’s coded character set (when more than one encoding, the mechanism
for selecting encoding for runtime):

408
B. Language element lists

36. Computer’s coded character set (whether UTF-8 or mixed alphanumeric and na-
tional characters recognized in class alphanumeric; applicable syntax and gen-
eral rules):

37. COPY statement (rules for identifying and locating default library text):

38. CRT status 9xxx (the value of xxx for unsuccessful completion with implementor-
defined conditions):

39. Cultural ordering table (allowable content of literal defines a cultural ordering
table):

40. Currency symbol (equivalence of non-COBOL characters):

41. Currency symbol (implementor-defined prohibition of non-COBOL characters):

42. Cursor (the cursor movement if keys are defined that change the cursor position):

43. Data storage (possible representations when implementation provides multiple


ways of storing data):

44. Default encoding specifications (for standard decimal floating-point usages):

45. Default endianness specifications (for standard floating-point usages):

46. DEFINE directive (mechanism for providing value of a compilation-variable-name


from the operating environment):

47. Devices that allow concurrent access:

48. DISPLAY statement (data conversion):

49. DISPLAY statement (format for display of a variable-length group):

50. DISPLAY statement (size of data transfer):

51. DISPLAY statement (standard display device):

52. Dynamic-capacity table (determination of highest permissible occurrence num-


ber):

53. Dynamic-capacity table (physical allocation):

54. Dynamic-length elementary items (maximum length):

55. Dynamic-length elementary items (structure if dynamic-length-structure-name-


1 is not specified):

56. ENTRY-CONVENTION clause (entry-convention-names, their meanings and the


default when not specified):

409
B. Language element lists

57. EXIT and GOBACK statements (execution continuation in a non-COBOL runtime


element):

58. Exponentiation (results for certain operand values):

59. External repository (mechanism for specifying whether checking and updating
occur):

60. External repository information (other information beyond the required informa-
tion):

61. Externalized names (formation and mapping rules):

62. Fatal exception condition (whether detected at compile time, circumstances un-
der which detected):

63. Fatal exception condition (whether or not execution will continue, how it will con-
tinue, and how any receiving operands are affected when events that would cause
a fatal exception to exist occur but checking for that condition is not enabled):

64. FILE-CONTROL entry, ASSIGN clause (TO phrase meaning and rules):

65. FILE-CONTROL entry, ASSIGN clause (consistency rules for external file connec-
tors):

66. FILE-CONTROL entry, ASSIGN clause (USING phrase meaning and rules):

67. Figurative constant values (representation of zero, space, and quote):

68. File sharing (interaction with other facilities and languages):

69. File sharing (which devices allow concurrent access to the file):

70. File sharing (default mode when unspecified):

71. Fixed file attribute (whether the ability to share a file is a fixed file attribute):

72. FLAG-02 directive (warning mechanism):

73. FLAG-85 directive (warning mechanism):

74. Floating-point numeric item (alignment when used as a receiving operand):

75. Floating-point numeric literals (maximum permitted value and minimum permit-
ted value of the exponent):

76. FOREGROUND-COLOR clause (the foreground color when the clause is not spec-
ified or the value specified is not in the range 0 to 7):

77. FORMAT clause (representation produced):

410
B. Language element lists

78. FORMAT clause (exclusions on restoring to same internal representation):

79. Format validation (rules for checking items of usages other than display or na-
tional):

80. FORMATTED-CURRENT-DATE (accuracy of returned time):

81. Function-identifier (execution of a non-COBOL function when a function-prototype-


name is specified):

82. Function-identifier (object time resources that are checked):

83. Function-identifier (result when argument rules are violated and checking for the
EC-ARGUMENT-FUNCTION exception condition is not enabled):

84. Function keys (context-dependent keys, function number, and method for en-
abling and disabling):

85. Function returned values (characteristics, representation, and returned value for
native arithmetic):

86. Hexadecimal alphanumeric literals (mapping for non-existing corresponding char-


acter):

87. Hexadecimal alphanumeric literals (mapping when characters not multiples of


four bits):

88. Hexadecimal national literals (mapping for non-existing corresponding charac-


ter):

89. Hexadecimal national literals (mapping when characters not multiples of four
bits):

90. Implementor-defined exception conditions, EC-IMP-xxx (specification and mean-


ing of xxx):

91. Implementor-defined level-2 exception conditions, EC-level-2-IMP (specification


and meaning of the specified level-2 exception condition):

92. INVOKE statement (behavior when invoking a non-COBOL method):

93. INVOKE statement (runtime resources that are checked):

94. I-O status (action taken for fatal exception conditions):

95. I-O status (if more than one value applies):

96. I-O status, permanent error (technique for error correction):

97. I-O status 0x (value of x):

411
B. Language element lists

98. I-O status 24 (manner in which the boundaries of a file are defined):

99. I-O status 34 (manner in which the boundaries of a file are defined):

100. I-O status 52 (conditions under which deadlock is detected):

101. I-O status 9x (value of x):

102. LEAP-SECOND directive (whether a value greater than 59 seconds may be re-
ported and, if so, the maximum number of seconds that may be reported):

103. LEAP-SECOND directive (whether standard numeric time form values greater
than or equal to 86,400 may be reported):

104. Life cycle for objects (timing and algorithm for taking part in continued execu-
tion):

105. Linkage section (whether access to linkage section items is meaningful when
called from a non-COBOL program):

106. Listings (whether and when produced by the compiler, effect of logical conver-
sion):

107. Locale specification (how user and system defaults defined; at least one user
and one system default):

108. Locale specification (manner of implementation):

109. Locale switch (whether a switch by a non-COBOL runtime module is recognized


by COBOL):

110. METHOD-ID paragraph (actual method-name used when PROPERTY phrase is


specified):

111. National literals (number of hexadecimal digits that map to a national character):

112. Native arithmetic (techniques used, intermediate data item):

113. Native arithmetic (when an operand or arithmetic expression is an integer):

114. NULL (value of NULL):

115. OBJECT-COMPUTER paragraph (default object computer):

116. OBJECT-COMPUTER paragraph (computer-name and implied equipment config-


uration):

117. OCCURS clause (range of values allowed in the index):

118. OPEN statement (validation of fixed file attributes):

412
B. Language element lists

119. OPEN statement with OUTPUT phrase (positioning of the output file with regard
to physical page boundaries):

120. OPEN statement without the SHARING phrase and no SHARING clause in the file
control entry (definition of sharing mode established for each file connector):

121. Parameterized classes and interfaces (when expanded):

122. Procedure division header rules when either the activating or the activated run-
time element is not a COBOL element (restrictions and mechanisms for all sup-
ported language products with details such as the matching of parameters, data
type representation, returning of a value, and omission of parameters):

123. Program-address identifier (relation between address and non-COBOL program):

124. Program-name (formation rules for a non-COBOL program):

125. RANDOM function (seed value when no argument on first reference):

126. RANDOM function (subset of the domain of argument-1):

127. RECORD clause (calculations to derive size of records on storage medium):

128. RECORD clause (implicit RECORD clause if RECORD clause is not specified):

129. RECORD clause (whether fixed or variable records produced for fixed-or-variable-
length format):

130. RECORD DELIMITER clause (consistency rules when used with external file con-
nectors):

131. RECORD DELIMITER clause (feature-name and associated method for determin-
ing length of variable-length records):

132. RECORD DELIMITER clause (if not specified, method for determining length of
variable-length records):

133. Record locking (circumstances other than a locked logical record that return a
locked record status):

134. Record locking (default mode when unspecified by user):

135. Record locking (maximum number allowed for a run unit):

136. Record locks (maximum number allowed for a file connector):

137. Reference format (control characters in a free-form line):

138. Reference format (meaning of lines and character positions in free-form and
fixed-form format):

413
B. Language element lists

139. Reference format (rightmost character position of program-text area):

140. Report file (record structure):

141. Report writer printable item (fixed correspondence between columns and na-
tional characters):

142. REPOSITORY paragraph (how external repository and class-specifier determine


which class is used):

143. REPOSITORY paragraph, INTERFACE phrase (how interface specifier and exter-
nal repository determine which interface is used):

144. REPOSITORY paragraph (when the AS phrase is required):

145. RESERVE clause (number of input-output areas, if not specified):

146. RETRY phrase (interval between attempts to obtain access to a locked file or
record):

147. RETRY phrase (maximum meaningful time-out value and internal representation;
technique for determining frequency of retries):

148. Run unit (relationship and interaction with non-COBOL components):

149. Run unit termination (whether locale reset):

150. SAME SORT/SORT-MERGE AREA clause (extent of allocation):

151. SEARCH ALL statement (varying of the search index during the search opera-
tion):

152. SECONDS-PAST-MIDNIGHT function returned value (precision):

153. SECURE clause (cursor movement when data is entered into a field for which the
SECURE clause is specified):

154. SELECT WHEN clause (whether a SELECT WHEN takes effect for READ state-
ments and REWRITE or WRITE statements with the FILE phrase in the absence of
a CODE-SET clause or a FORMAT clause):

155. SET statement (effect of SET on function whose address is being stored in a
function-pointer):

156. SET statement (effect of SET on program whose address is being stored in a
program-pointer):

157. SET statement (value in NaN payload):

158. SIGN clause (representation when PICTURE contains character ’S’ with no op-
tional SIGN clause):

414
B. Language element lists

159. SIGN clause (valid sign when SEPARATE CHARACTER phrase not present):

160. Size error condition (whether or not range of values allowed for the intermediate
data item is to be checked):

161. SPECIAL-NAMES paragraph (allowable locale-names and literal values):

162. SPECIAL-NAMES paragraph, ALPHABET clause (coded character set referenced


by STANDARD-2 phrase):

163. SPECIAL-NAMES paragraph, ALPHABET clause, code-name-1 (alphanumeric coded


character set and collating sequence; ordinal number of characters; correspon-
dence with native alphanumeric character set):

164. SPECIAL-NAMES paragraph, ALPHABET clause, code-name-1 and code-name-2


(the names supported for code-name-1 and code-name-2):

165. SPECIAL-NAMES paragraph, ALPHABET clause, code-name-2 (national coded


character set and collating sequence; ordinal number of characters; correspon-
dence with native national character set):

166. SPECIAL-NAMES paragraph, ALPHABET clause, literal phrase (ordinal number


of characters not specified):

167. SPECIAL-NAMES paragraph, ALPHABET clause, STANDARD-1 and STANDARD-


2 phrases (correspondence with native character set):

168. SPECIAL-NAMES paragraph, ALPHABET clause, UCS-4, UTF-8, and UTF-16 phrases
(correspondence with native character set):

169. SPECIAL-NAMES paragraph, device-name (names available, restrictions on use):

170. SPECIAL-NAMES paragraph, feature-name (names available, any positioning rules,


any restrictions on use):

171. SPECIAL-NAMES paragraph, switch-name (names available, which switches may


be referenced by the SET statement, scope of, and external facility for modifica-
tion):

172. Standard intermediate data item (representation):

173. STOP statement (constraints on the value of the STATUS literal or on the contents
of the data item referenced by the STATUS identifier):

174. STOP statement (mechanism for error termination):

175. Subscripts (mapping indexes to occurrence numbers):

176. Switch-name (identifies an external switch):

415
B. Language element lists

177. SYNCHRONIZED clause (effect on elementary items and containing records or


groups; implicit filler generation):

178. SYNCHRONIZED clause (how records of a file are handled):

179. SYNCHRONIZED clause (positioning when neither RIGHT or LEFT is specified):

180. System-names (rules for formation of a system-name):

181. Terminal screen (correspondence of a column and a character in the computer’s


national coded character set):

182. Text manipulation (stage of processing the LISTING and PAGE directives and the
SUPPRESS phrase of COPY):

183. Text manipulation (stage of processing parameterized class expansion):

184. Time formats and corresponding function values (maximum precision not less
than nine fractional digits):

185. THROUGH phrase in VALUE clause and EVALUATE statement (collating sequence
used for determining range of values when no alphabet-name is specified):

186. TURN directive (whether location information is available when the LOCATION
phrase is not specified):

187. USAGE BINARY clause (computer storage allocation, alignment and representa-
tion of data):

188. USAGE BINARY-CHAR, BINARY-SHORT, BINARY-LONG, BINARY-DOUBLE (allow


wider range than minimum specified):

189. USAGE BINARY-SHORT, BINARY-LONG, BINARY-DOUBLE, FLOAT-SHORT, FLOAT-


LONG, FLOAT-EXTENDED (representation and length of data item associated with):

190. USAGE COMPUTATIONAL clause (alignment and representation of data):

191. USAGE DISPLAY (size and representation of characters):

192. USAGE FLOAT-SHORT, FLOAT-LONG, FLOAT-EXTENDED (size and permitted range


of value):

193. USAGE FUNCTION-POINTER clause (alignment, size, and representation of data;


and allowable languages):

194. USAGE INDEX clause (alignment and representation of data):

195. USAGE NATIONAL (size and representation of characters):

196. USAGE OBJECT REFERENCE clause (amount of storage allocated):

416
B. Language element lists

197. USAGE PACKED-DECIMAL clause (computer storage allocation, alignment and


representation of data):

198. USAGE POINTER clause (alignment, size, representation, and range of values):

199. USAGE PROGRAM-POINTER clause (alignment, size, and representation of data;


and allowable languages):

200. USE statement (action taken following execution of the USE procedure when I-O
status value indicates a fatal exception condition):

201. User-defined words (whether extended letters may be specified in user-defined


words externalized to the operating environment):

202. Variable-length data items (actual time when the resources used are freed):

203. WRITE statement (mnemonic-name-1):

204. WRITE statement (page advance when mnemonic-name-1 specified):

417
B. Language element lists

B.2. Optional language element list


1. ACCEPT and DISPLAY screen handling: Complete support is claimed with the
exception of OCCURS items.

2. ARITHMETIC IS STANDARD: No support is claimed.

3. Dynamic capacity tables: The syntax is recognised, but no functionality is claimed.

4. DYNAMIC LENGTH elementary items: No support is claimed.

5. Extended letters: No support is claimed.

6. File sharing and record locking: Support is claimed, but the level of support is
processor-dependent.

7. FORMAT and SELECT WHEN file handling: No support is claimed.

8. Locale support and related functions: The syntax is recognised, but no function-
ality is claimed.

9. Object orientation: No support is claimed.

10. Report writer: Complete support is claimed.

11. RESUME statement: No support is claimed.

12. REWRITE FILE and WRITE FILE: Complete support is claimed.

13. VALIDATE: No support is claimed.

418
B. Language element lists

B.3. Non-standard extension list


Many extensions found in other compilers. Some own extensions.

Note: Flagging syntax extensions You can flag many syntax extensions when compil-
ing with -std=cobol2014 or one of the other strict COBOL syntax definitions.

419
B. Language element lists

420

You might also like