fujitsu software netcobol v11 - 富士通のソフト...
TRANSCRIPT
-
B1WD-3304-01ENZ0(00)March 2014
FUJITSU SoftwareNetCOBOL V11.0
Language Reference
-
PrefaceThis NetCOBOL Reference Manual covers the rules for writing programs in COBOL (COmmon Business OrientedLanguage). It contains information on the base language, as well as extensions and restrictions for Fujitsu NetCOBOLand NetCOBOL for the .NET environment.
The reader is assumed to have a basic knowledge of programming.
Organization
The table below shows how this manual is organized.
Chapter/Appendix Description
Chapter 1. General Rules Covers the general rules including the language elements of COBOL,unique reference, writing of literals, and reference format
Chapter 2. COBOL Modules Lists and explains the facilities of COBOL
Chapter 3. Identification Division and EndProgram Header
Explains the syntax of the Identification Division and End Programheader
Chapter 4. Environment Division Explains the syntax of the Environment Division
Chapter 5. Data Division Explains the syntax of the Data Division
Chapter 6. Procedure Division Explains the syntax of the Procedure Division
Chapter 7. Source Text Manipulation Explains the syntax of statements used in the Source Text Manipulationfunction
Chapter 8. Database(SQL) Explains the syntax of the Database function(SQL)
Chapter 9. Communication Database Explains the syntax of the Communication Database function
Chapter 10. Micro Focus Native Functions Explains the syntax of the Micro Focus native functions
Chapter 11. Object-OrientedProgramming Function
Explains the syntax of the object-oriented programming function.
Chapter 12. Microsoft .NET
Support
Describes the extensions added to support the .NET Framework
Appendix A. List of Reserved Words Lists the reserved words in COBOL
Appendix B. System QuantitativeRestrictions
Lists the quantitative restrictions of the COBOL Runtime System
Appendix C. Code Tables Lists the character sets and their internal representations
Appendix D. Intermediate Results Explains the attributes and accuracy of intermediate results
Appendix E. Functional Differences Lists the functional differences for each operating system
Appendix F. Control Record Formats Explains the formats of the control records
Appendix G. Data Item Definition UsingTypes
Explains the usage of types.
How to Use this Manual
Users who wish to gain an understanding of the basic concepts of COBOL and its facilities should first read Chapters 1and 2 in that order. Users who already have an understanding of COBOL may skip the first two chapters and read anyof the other chapters or appendices as required.
The following diagram shows the sequence in which the chapters and appendices of this reference manual should beread.
- i -
-
Symbols Used in Format Diagrams
In each chapter, Format shows how to write COBOL language elements, such as statements and clauses. The wordsshown in Format must be written in the sequence shown unless otherwise specified in the syntax rules or general rules.
Symbol Meaning Example
Character-stringin uppercaseletters
COBOL reserved word.
These character-strings must be writtenexactly as they appear in Format.
Example
VALUE IS constant-1
Meaning
VALUE cannot be omitted. IS can be omitted.Write any constant conforming to the syntaxrules in constant-1.
For example
VALUE IS "XXXX"
VALUE 12345
___________
(underline)
Underlining indicates that the character-string is a key word. A key word cannot beomitted. A character-string that is notunderlined can be omitted.
Character-stringin lowercaseletters
Character-string in lowercase lettersindicates the classifications of user-definedword, literal, PICTURE clause character-strings, and comment entries. Any character-string can be written in this portion providedthat it conforms to the syntax rules.
[ ]
(brackets)
Brackets indicate that one of the valuesgiven in the parentheses can be selected, orthe contents of the brackets can be omitted.
Example 1
- ii -
-
Symbol Meaning Example
Meaning
Write data-name-1 or FILLER, or omit this valuecompletely.
Example 2
[ON SIZE ERROR unconditional-statement-1]
Meaning
This value can be omitted completely.
{ }
(braces)
Braces indicate that one of the values givenin the braces can be selected or the value canbe omitted.
Example 1
{identifier-1 | literal-1}
Example 2
Meaning
Write either identifier-1 or literal-1.
{| |}
(choiceindicators)
These indicate that at least one of the valuesgiven in the choice indicators can be written.However, each character-string must beunique.
Example
Meaning
Any of the following can be written:
- COMMON
- INITIAL
- COMMON INITIAL
- INITIAL COMMON
...
(occurrencesymbol)
Indicates that the portion immediatelypreceding the occurrence symbol (theportion enclosed in brackets or parentheses)can be repeated.
Example
Meaning
Identifier-1 or literal-1 can be repeated.
.
(period)
Any period shown in Format must be writtenin the same position.
Example
WORKING-STORAGE SECTION.
Meaning
- iii -
-
Symbol Meaning Example
The period after SECTION must be written.
Specialcharacters suchas
+, -, >, =,
Special characters are key words. They arenot underlined, but must not be omitted.
Example
Meaning
The symbol =, > or >= must be written.
Shading
The shaded portions in the documentation indicate that they describe extended functions or functions specific toNetCOBOL. If the heading of a section or an item is shaded, the entire description under that heading is an extendedfunction of NetCOBOL.
Syntax Rules and General Rules
The explanation of COBOL language elements such as statements and clauses are arranged into Format, syntax rules,and general rules.
Format shows the arrangement of elements making up a statement or clause.
Syntax rules explain the arrangement of the elements in Format and restrictions on their arrangement.
General rules explain the results of execution and compilation where a statement or clause was written. They alsoexplain the meaning of elements in Format and the relationship between the elements.
Syntax rules or general rules are omitted when there are no rules relating to the elements in Format.
Obsolete Elements
Elements marked "Obsolete elements" in the text are given in the 1985 issue of the ANSI COBOL standard but may notbe included in the next edition. Fujitsu recommends that obsolete elements not be used when creating new programs.
Related Documentation
The documentation set for NetCOBOL includes "NetCOBOL User's Guide" in addition to this document. Refer to "NetCOBOLUser's Guide" for creating, compiling, executing, and debugging programs.
Refer to "NetCOBOL User's Guide" for the details of the other systems.
Scope of NetCOBOL Functions
The NetCOBOL functions consist of ANSI standard COBOL functions (ANSI Standard COBOL X3.23 1985, ISO-1989-1985)and NetCOBOL extended functions. The NetCOBOL functions are as follows:
- iv -
-
NetCOBOL
functions
ANSIstandard
COBOL
functions
Required
functions
Nucleus (2, nucleus 1, 2)
Sequential I-O function (2, sequential 1, 2)
Relative I-O function (2, relative 0, 2)
Indexed I-O function (2, indexed 0, 2)
Inter-program communication function
(2, communication 1, 2)
Sort-merge function (1, sort 0, 1)
Source test manipulation function
(2, source test 0, 2)
Optional
functions
Report writer function (1, report 0, 1)
Built-in function (1, function 0, 1)
Debug function (2, debug 0, 2)*
Segmentation function (2, segmentation0, 2)*
NetCOBOL
extendedfunctions
Presentation file function
Screen handling module
Command line argument and
environment variable operation function
Database function
Communication database function
Micro Focus native function
Object-oriented programming function
.NET programming function
*: The debug function and segmentation functions are treated as comments when the program is run.
Note
In the above, standard mnemonic symbols for each ANSI standard COBOL function are shown in parentheses. From leftto right the symbols show the position of the function in the hierarchy, the function abbreviation, and the maximumand minimum levels of the function to which the level belongs.
System-specific Functions
Some parts of the COBOL common syntax described in this manual depend on system functions, and differ amongsystems.
Such parts are indicated by the following system names:
Indicator Corresponding system Corresponding product
[DS]
[UXP/DS]
UXP/DS COBOL85 V20L11
[HP] HP-UX COBOL85 V20L11
[Solaris] Oracle Solaris 10 NetCOBOL V10
[Linux] Red Hat(R) Enterprise Linux(R) 5(for x86) NetCOBOL (32bit) V7.3
- v -
-
Indicator Corresponding system Corresponding product
Red Hat(R) Enterprise Linux(R) 5(for Intel64) 32bit
[LinuxIPF] Red Hat(R) Enterprise Linux(R) 5(for Intel Itanium) NetCOBOL V9.0
[Linux64] Red Hat(R) Enterprise Linux(R) 5(for Intel64) 64bit
Red Hat(R) Enterprise Linux(R) 6(for Intel64) 64bit
NetCOBOL V10
[Win16] Windows 95
Windows 3.1
COBOL V20L11
[Win32] Windows Server 2008
Windows Server 2003
Windows 7
Windows Vista
Windows XP
Windows 2000
NetCOBOL (32bit) V10
[Winx64] Windows Server 2012 R2
Windows Server 2012
Windows Server 2008 R2
Windows 8.1(x64)
Windows 8(x64)
Windows 7(x64)
NetCOBOL (64bit) V11
[.NET] Windows Server 2012 R2
Windows Server 2012
Windows Server 2008 R2
Windows 8.1
Windows 8
Windows 7
NetCOBOL for .NET V6
Refer to Appendix E "Functional Differences" for a list of functional differences.
Product Names
Product Name Abbreviation
Microsoft Windows Server 2012 R2 Datacenter
Microsoft Windows Server 2012 R2 Standard
Microsoft Windows Server 2012 R2 Essentials
Microsoft Windows Server 2012 R2 Foundation
Windows Server 2012 R2
Microsoft Windows Server 2012 Datacenter
Microsoft Windows Server 2012 Standard
Microsoft Windows Server 2012 Essentials
Microsoft Windows Server 2012 Foundation
Windows Server 2012
Microsoft Windows Server 2008 R2 Foundation Windows Server 2008 R2
- vi -
-
Product Name Abbreviation
Microsoft Windows Server 2008 R2 Standard
Microsoft Windows Server 2008 R2 Enterprise
Microsoft Windows Server 2008 R2 Datacenter
Microsoft Windows Server 2008 Foundation
Microsoft Windows Server 2008 Standard
Microsoft Windows Server 2008 Standard without Hyper-V
Microsoft Windows Server 2008 Enterprise
Microsoft Windows Server 2008 Enterprise without Hyper-V
Microsoft Windows Server 2008 Datacenter
Microsoft Windows Server 2008 Datacenter without Hyper-V
Windows Server 2008
or
Windows Server 2008(x64)
Microsoft Windows Server 2008 for Itanium-Based Systems Windows Server 2008
or
Windows Server 2008(Itanium)
Microsoft Windows Server 2003, Standard x64 Edition
Microsoft Windows Server 2003, Enterprise x64 Edition
Microsoft Windows Server 2003 R2, Standard x64 Edition
Microsoft Windows Server 2003 R2, Enterprise x 64 Edition
Windows Server 2003
or
Windows Server 2003(x64)
Microsoft Windows Server 2003, Standard Edition
Microsoft Windows Server 2003, Enterprise Edition
Microsoft Windows Server 2003 R2, Standard Edition
Microsoft Windows Server 2003 R2, Enterprise Edition
Windows Server 2003
Microsoft Windows Server 2003,
Enterprise Edition for Itanium-based Systems
Microsoft Windows Server 2003,
Datacenter Edition for Itanium-based Systems
Windows Server 2003
or
Windows Server 2003 (Itanium)
Windows 8.1
Windows 8.1 Pro
Windows 8.1 Enterprise
Windows 8.1
or
Windows 8.1 (x64)
Windows 8
Windows 8 Pro
Windows 8 Enterprise
Windows 8
or
Windows 8 (x64)
Windows 7 Home Premium
Windows 7 Professional
Windows 7 Enterprise
Windows 7 Ultimate
Windows 7
or
Windows 7 (x64)
Microsoft Windows Vista Home Basic
Microsoft Windows Vista Home Premium
Windows Vista
- vii -
-
Product Name Abbreviation
Microsoft Windows Vista Business
Microsoft Windows Vista Enterprise
Microsoft Windows Vista Ultimate
Microsoft Windows XP Home Edition operating system
Microsoft Windows XP Professional operating system
Windows XP
Microsoft Windows 2000 Professional
Microsoft Windows 2000 Server
Microsoft Windows 2000 Advanced Server
Windows 2000
Oracle Solaris Solaris
Trademarks
- NetCOBOL is a trademark or registered trademark of Fujitsu Limited or its subsidiaries in the United States or othercountries or in both.
- HP and HP-UX are trademarks of Hewlett-Packard Inc., U.S.A.
- Micro Focus is a trademark of Micro Focus International Limited
- Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of theirrespective owners. Oracle Solaris might be described as Solaris, Solaris Operating System, or Solaris OS.
- Windows, Windows Server, Windows Vista, MSDN, Visual Studio, and .NET are trademarks or registered trademarksof Microsoft Corporation in the United States and/or other countries.
- Linux is a registered trademark of Mr. Linus Torvalds in the United States and other countries.
- UNIX is a registered trademark of The Open Group in the United States and other countries.
- Intel and Itanium are registered trademarks of Intel Corporation.
- Other brand and product names are trademarks or registered trademarks of their respective owners.
NetCOBOL is copyrighted by Fujitsu Limited with all rights reserved. As a component of that program NetCOBOL useslibXpm developed by Groupe BULL and licensed to Fujitsu Limited under the requirement to reflect the followingpermission only as it pertains to the libXpm.
Copyright 1989-94 GROUPE BULL
Permission is hereby granted, free of charge, to any person obtaining a copy of the libXpm and associated documentationfiles (the "libXpm software"), to deal in the libXpm software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the libXpm Software, and to permitpersons to whom the libXpm Software is furnished to do so, subject to the following conditions: The above copyrightnotice and this permission notice shall be included in all copies or substantial portions of the Software.
THE LIBXPM SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUTNOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRIGEMENT.IN NO EVENT SHALL GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTIONOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE LIBXPM SOFTWARE OR THEUSE OR OTHER DEALINGS IN THE LIBXPM SOFTWARE.
Except as contained in this notice, the name of GROUPE BULL shall not be used in advertising or otherwise to promotethe sale, use or other dealings in this libXpm software without prior written authorization from GROUPE BULL.
- viii -
-
Export Regulation
Exportation/release of this document may require necessary procedures in accordance with the regulations of the ForeignExchange and Foreign Trade Control Law of Japan and/or US export control laws.
Acknowledgment
COBOL language specifications are based on the original specifications developed by the Conference on Data SystemsLanguages (CODASYL), and specifications in this manual are also derived from these specifications. The chapters listedbelow were included on request from CODASYL.
COBOL is not owned by any particular company, organization, or group; it has been designed for general use in industry.CODASYL does not guarantee and bears no responsibility in relation to the programming method, the accuracy oflanguage, and functions.
The following copyright owners permitted partial use of the following documents when the original specifications wereput together. This permission also extends to the use of the original specifications in other COBOL specifications.
- FLOW-MATIC (trademark of Sperryrand Inc.), "Programming for the Univac I and II, Data Automation Systems",copyright Sperryrand Inc. 1958, 1959
- IBM Commercial Translator, library number F28-8013, copyright IBM Inc. 1959
- FACT, library number 27A5260-2760, copyright Minneapolis Honeywell Inc. 1960
The contents of this manual may be revised without prior notice. No part of this document may be reproduced ortransmitted in any form or by any means, electronic or mechanical, for any purpose, without the express writtenpermission of Fujitsu Limited.
March 2014
Copyright 1996-2014FUJITSU LIMITED
- ix -
-
ContentsChapter 1 General Rules...................................................................................................................................................................... 1
1.1 Characters and Character Sets....................................................................................................................................................11.2 Basic Overview of the Language................................................................................................................................................ 2
1.2.1 Separator............................................................................................................................................................................ 21.2.2 COBOL Word........................................................................................................................................................................5
1.2.2.1 User-defined Words......................................................................................................................................................51.2.2.1.1 Rules for Describing User-defined Words............................................................................................................... 61.2.2.1.2 Application of User-defined Words........................................................................................................................ 7
1.2.2.2 System Name............................................................................................................................................................... 91.2.2.3 Reserved Words............................................................................................................................................................91.2.2.4 FUNCTION-NAME........................................................................................................................................................ 11
1.2.3 Literal............................................................................................................................................................................... 111.2.3.1 Numeric Literal.......................................................................................................................................................... 111.2.3.2 Nonnumeric Literal.................................................................................................................................................... 131.2.3.3 Hexadecimal Nonnumeric Literal............................................................................................................................... 131.2.3.4 National Nonnumeric Literal...................................................................................................................................... 141.2.3.5 Boolean Literal...........................................................................................................................................................15
1.2.4 Figurative Constant...........................................................................................................................................................151.2.5 Concatenation Expression.................................................................................................................................................171.2.6 Literals for Special Applications........................................................................................................................................ 181.2.7 Picture Character-string.................................................................................................................................................... 181.2.8 Comment Entry................................................................................................................................................................. 18
1.3 Concept of Data Description.....................................................................................................................................................191.3.1 Concept of Levels.............................................................................................................................................................. 191.3.2 Concept of Class................................................................................................................................................................ 191.3.3 Concept of Types............................................................................................................................................................... 20
1.3.3.1 Weakly-Typed Item.................................................................................................................................................... 201.3.3.2 Strongly-Typed Item................................................................................................................................................... 20
1.3.4 Standard Alignment Rule.................................................................................................................................................. 211.3.5 Adjustment of Data Boundaries........................................................................................................................................ 21
1.3.5.1 Slack Byte...................................................................................................................................................................221.3.5.2 Slack Bit..................................................................................................................................................................... 23
1.4 Uniqueness of Reference......................................................................................................................................................... 251.4.1 Qualification..................................................................................................................................................................... 251.4.2 Subscripting...................................................................................................................................................................... 281.4.3 Reference Modification..................................................................................................................................................... 291.4.4 Pointer.............................................................................................................................................................................. 311.4.5 Identifier........................................................................................................................................................................... 321.4.6 Condition-name Uniqueness of Reference ....................................................................................................................... 331.4.7 Function-identifier............................................................................................................................................................ 33
1.5 Reference Format.................................................................................................................................................................... 341.5.1 Configuration of a Source Code Line..................................................................................................................................341.5.2 Reference Format for Area A and Area B........................................................................................................................... 351.5.3 Blank Line.........................................................................................................................................................................361.5.4 Comment Line.................................................................................................................................................................. 361.5.5 Continuation of Lines........................................................................................................................................................361.5.6 Debugging Line................................................................................................................................................................ 371.5.7 In-line Comment............................................................................................................................................................... 371.5.8 Reference Format for Free Format.....................................................................................................................................38
1.5.8.1 Configuration of a Line...............................................................................................................................................381.5.8.2 Blank Line.................................................................................................................................................................. 38
- x -
-
1.5.8.3 Comment Lines.......................................................................................................................................................... 381.5.8.4 Continuation of Lines................................................................................................................................................. 381.5.8.5 Debugging Line..........................................................................................................................................................38
1.6 Program Configuration............................................................................................................................................................ 381.6.1 Returning Result from a Program......................................................................................................................................40
1.7 Operation Mode.......................................................................................................................................................................40
Chapter 2 COBOL Modules................................................................................................................................................................. 422.1 Nucleus....................................................................................................................................................................................42
2.1.1 Transcription and Movement of Data................................................................................................................................ 442.1.2 Arithmetic Operations.......................................................................................................................................................452.1.3 Optional Processing and Branching.................................................................................................................................. 452.1.4 Repetitive Processing........................................................................................................................................................462.1.5 Table Handling................................................................................................................................................................. 472.1.6 Initialization of Data Items............................................................................................................................................... 502.1.7 Handling Character Strings............................................................................................................................................... 502.1.8 Simple Input-Output......................................................................................................................................................... 512.1.9 Terminating a Program..................................................................................................................................................... 512.1.10 Pointer Handling.............................................................................................................................................................512.1.11 Handling Floating-Point Data Items............................................................................................................................... 52
2.2 Input-Output Facility................................................................................................................................................................532.2.1 File Organization.............................................................................................................................................................. 542.2.2 File Connector................................................................................................................................................................... 562.2.3 Operation of Input-Output Statements............................................................................................................................. 562.2.4 File Position (Record Pointer) Indicator.............................................................................................................................572.2.5 Volume Indicator.............................................................................................................................................................. 572.2.6 Sharing and Exclusion of Files...........................................................................................................................................572.2.7 Locking a Record...............................................................................................................................................................582.2.8 I-O Status.......................................................................................................................................................................... 592.2.9 Record Format...................................................................................................................................................................602.2.10 Record Area.....................................................................................................................................................................602.2.11 LINAGE-COUNTER Special Register.................................................................................................................................. 61
2.3 Inter-program Communication Module................................................................................................................................... 612.3.1 Accessing and Returning to a Program............................................................................................................................. 622.3.2 Global Name and Local Name...........................................................................................................................................622.3.3 External Attribute and Internal Attribute.......................................................................................................................... 632.3.4 External Name and Internal Name................................................................................................................................... 632.3.5 Program Activation........................................................................................................................................................... 642.3.6 The Common Attribute ..................................................................................................................................................... 642.3.7 Initial State of a Program.................................................................................................................................................. 642.3.8 Recursive Attribute of the Program................................................................................................................................... 652.3.9 Passing Parameters to the Called Program....................................................................................................................... 652.3.10 Scope of Names.............................................................................................................................................................. 662.3.11 Scope of a Program-name and Secondary Entry Point Names(*)....................................................................................672.3.12 PROGRAM-STATUS and RETURN-CODE Special Registers.................................................................................................. 68
2.4 Sort-Merge Module.................................................................................................................................................................. 682.4.1 Sorting Methods............................................................................................................................................................... 692.4.2 Merging Methods..............................................................................................................................................................692.4.3 SORT Input Procedure........................................................................................................................................................692.4.4 Sort-Merge Output Procedures.......................................................................................................................................... 692.4.5 Sort-merge File................................................................................................................................................................. 702.4.6 Special Register.................................................................................................................................................................70
2.4.6.1 SORT-STATUS.............................................................................................................................................................. 702.4.6.2 SORT-CORE-SIZE..........................................................................................................................................................70
- xi -
-
2.5 Source Text Manipulation Module........................................................................................................................................... 712.6 Presentation File Module.........................................................................................................................................................72
2.6.1 Destination Type............................................................................................................................................................... 732.6.2 Screen Form Descriptor..................................................................................................................................................... 732.6.3 File Organization and Access Mode...................................................................................................................................732.6.4 Presentation File Input-Output Statements...................................................................................................................... 732.6.5 I-O Status.......................................................................................................................................................................... 742.6.6 Presentation File Special Registers....................................................................................................................................74
2.7 Intrinsic Function Module........................................................................................................................................................ 752.8 Screen Handling Module..........................................................................................................................................................77
2.8.1 Screen and Screen Item.....................................................................................................................................................782.8.1.1 Screen Data Description Entry.................................................................................................................................... 782.8.1.2 Screen Item................................................................................................................................................................ 78
2.8.2 Input-Output Handling of the Screen................................................................................................................................ 792.8.3 Screen Input Status........................................................................................................................................................... 79
2.9 Command Line Argument and Environment Variable Modules................................................................................................792.9.1 Processing Command Line Arguments.............................................................................................................................. 80
2.9.1.1 Method for Finding the Number of Command Line Arguments.................................................................................. 802.9.1.2 Method for Obtaining the Value of Individual Command Line Arguments................................................................. 80
2.9.2 Accessing an Environment Variable.................................................................................................................................. 812.9.2.1 Accessing the Value of an Environment Variable........................................................................................................812.9.2.2 Updating the Value of an Environment Variable........................................................................................................ 81
2.10 Report Writer Module............................................................................................................................................................ 812.10.1 Report File...................................................................................................................................................................... 822.10.2 Report Writer Special Registers....................................................................................................................................... 82
2.10.2.1 Page Counter............................................................................................................................................................832.10.2.2 Line-Counter............................................................................................................................................................ 83
Chapter 3 Identification Division and End Program Header...............................................................................................................843.1 Composition of the Identification Division............................................................................................................................... 84
3.1.1 Program-Id Paragraph...................................................................................................................................................... 843.1.2 DATE-COMPILED Paragraph...............................................................................................................................................85
3.2 End Program Header............................................................................................................................................................... 86
Chapter 4 Environment Division........................................................................................................................................................ 884.1 Composition of the Environment Division................................................................................................................................884.2 CONFIGURATION SECTION.........................................................................................................................................................88
4.2.1 SOURCE-COMPUTER Paragraph..........................................................................................................................................884.2.1.1 WITH DEBUGGING MODE Clause................................................................................................................................. 89
4.2.2 OBJECT-COMPUTER Paragraph...........................................................................................................................................894.2.2.1 MEMORY SIZE Clause.................................................................................................................................................. 894.2.2.2 PROGRAM COLLATING SEQUENCE Clause.....................................................................................................................90
4.2.3 SPECIAL-NAMES Paragraph............................................................................................................................................... 914.2.3.1 Function-name-1 Clause............................................................................................................................................ 914.2.3.2 Function-name-2 Clause............................................................................................................................................ 944.2.3.3 Function-name-3 Clause............................................................................................................................................ 954.2.3.4 ALPHABET Clause....................................................................................................................................................... 954.2.3.5 CLASS Clause.............................................................................................................................................................. 984.2.3.6 CRT STATUS Clause......................................................................................................................................................994.2.3.7 CURRENCY SIGN Clause............................................................................................................................................. 1004.2.3.8 CURSOR Clause......................................................................................................................................................... 1004.2.3.9 DECIMAL-POINT IS COMMA Clause............................................................................................................................ 1014.2.3.10 POSITIONING UNIT Clause....................................................................................................................................... 1014.2.3.11 PRINTING MODE Clause.......................................................................................................................................... 101
- xii -
-
4.2.3.12 SYMBOLIC CHARACTERS Clause............................................................................................................................... 1034.2.3.13 SYMBOLIC CONSTANT Clause...................................................................................................................................104
4.3 Input-Output Section............................................................................................................................................................. 1054.3.1 File-Control Paragraph.................................................................................................................................................... 105
4.3.1.1 ACCESS MODE Clause (Sequential, Relative, Indexed, Presentation(*), and Report Writer Files)............................. 1134.3.1.2 ALTERNATE RECORD KEY Clause (Indexed File).........................................................................................................1144.3.1.3 ASSIGN Clause (Sequential File, Relative File, and Indexed File).............................................................................. 1164.3.1.4 ASSIGN Clause (Sort-merge and Report Writer)........................................................................................................ 1174.3.1.5 ASSIGN Clause (Presentation File)............................................................................................................................1174.3.1.6 DESTINATION Clause (Presentation File).................................................................................................................. 1184.3.1.7 END KEY Clause (Presentation File)..........................................................................................................................1184.3.1.8 FILE STATUS Clause (Sequential File, Relative File, Indexed File, Presentation File(*), and Report Writer).............. 1194.3.1.9 FORMAT Clause (Sequential File, Presentation File)................................................................................................. 1204.3.1.10 GROUP Clause (Sequential File, Presentation File)................................................................................................. 1214.3.1.11 LOCK MODE Clause (Sequential File, Relative File, and Indexed File).....................................................................1214.3.1.12 MESSAGE CLASS Clause (Presentation File)............................................................................................................ 1224.3.1.13 MESSAGE CODE Clause (Presentation File)............................................................................................................. 1234.3.1.14 MESSAGE MODE Clause (Presentation File)............................................................................................................ 1234.3.1.15 MESSAGE OWNER Clause (Presentation File)..........................................................................................................1244.3.1.16 MESSAGE SEQUENCE Clause (Presentation File)..................................................................................................... 1244.3.1.17 ORGANIZATION Clause (Sequential File).................................................................................................................1254.3.1.18 ORGANIZATION Clause (Relative File)..................................................................................................................... 1254.3.1.19 ORGANIZATION Clause (Indexed File)..................................................................................................................... 1264.3.1.20 ORGANIZATION Clause (Presentation File(*) and Report Writer)............................................................................ 1264.3.1.21 PADDING CHARACTER Clause (Sequential File)....................................................................................................... 1264.3.1.22 PROCESSING CONTROL Clause (Presentation File)...................................................................................................1264.3.1.23 PROCESSING MODE Clause (Presentation File)....................................................................................................... 1274.3.1.24 PROCESSING TIME Clause (Presentation File)......................................................................................................... 1274.3.1.25 RECORD DELIMITER Clause (Sequential File).......................................................................................................... 1284.3.1.26 RECORD KEY Clause (Indexed File)......................................................................................................................... 1284.3.1.27 RESERVE Clause (Sequential File, Relative File, Indexed File, and Report Writer)...................................................1294.3.1.28 SELECT Clause (Sequential File, Relative File, Indexed File, and Report Writer)......................................................1294.3.1.29 SELECT Clause (Sort-merge and Presentation File(*))............................................................................................ 1304.3.1.30 SELECTED FUNCTION Clause (Presentation File)..................................................................................................... 1304.3.1.31 SESSION CONTROL Clause (Presentation File).........................................................................................................1314.3.1.32 SYMBOLIC DESTINATION Clause (Presentation File)................................................................................................ 1314.3.1.33 UNIT CONTROL Clause (Presentation File).............................................................................................................. 132
4.3.2 I-O-Control Paragraph (I-O-CONTROL)............................................................................................................................. 1334.3.2.1 APPLY MULTICONVERSATION-MODE Clause (Presentation File)................................................................................ 1334.3.2.2 APPLY SAVED-AREA Clause (Presentation File)......................................................................................................... 1344.3.2.3 MULTIPLE FILE TAPE Clause (Sequential File and Report Writer).............................................................................. 1344.3.2.4 RERUN Clause (Sequential File, Relative File and Indexed File)............................................................................... 1344.3.2.5 SAME Clause (Sequential, Relative, Indexed, Sort-merge, Presentation File(*), and Report Writer Files)................ 135
Chapter 5 Data Division................................................................................................................................................................... 1375.1 Composition of the Data Division...........................................................................................................................................1375.2 File Description Entry.............................................................................................................................................................141
5.2.1 BLOCK CONTAINS Clause (Sequential File, Relative File, Indexed File, and Report Writer Module)..................................1425.2.2 CODE-SET Clause (Sequential File and Report Writer Module).........................................................................................1425.2.3 CONTROL RECORDS Clause (Sequential File)....................................................................................................................1435.2.4 DATA RECORDS Clause (Sequential File, Relative File, and Indexed File).........................................................................1445.2.5 ENCODING Clause (Sequential File, Relative File, Indexed File, and Presentation File)................................................... 1445.2.6 EXTERNAL Clause (Sequential File, Relative File, Indexed File, Presentation File(*), and Report Writer Module)........... 1455.2.7 GLOBAL Clause (Sequential File, Relative File, Indexed File, Presentation File(*), and Report Writer Module)...............145
- xiii -
-
5.2.8 LABEL RECORDS Clause (Sequential File, Relative File, Indexed File, and Report Writer File)..........................................1455.2.9 LINAGE Clause (Sequential File)......................................................................................................................................1465.2.10 RECORD Clause (Sequential File, Relative File, and Indexed File)................................................................................. 1485.2.11 RECORD Clause (Presentation File)............................................................................................................................... 1515.2.12 RECORD Clause (Report Writer Module)........................................................................................................................ 1515.2.13 REPORT Clause (Report Writer Module).........................................................................................................................1515.2.14 VALUE OF Clause (Sequential File, Relative File, Indexed File, and Report Writer Module)........................................... 152
5.3 Sort-Merge File Description Entry.......................................................................................................................................... 1525.4 Data Description Entry........................................................................................................................................................... 153
5.4.1 BASED ON Clause............................................................................................................................................................ 1565.4.2 BLANK WHEN ZERO Clause.............................................................................................................................................. 1575.4.3 CHARACTER TYPE Clause.................................................................................................................................................. 1575.4.4 ENCODING Clause............................................................................................................................................................1615.4.5 EXTERNAL Clause............................................................................................................................................................ 1635.4.6 GLOBAL Clause................................................................................................................................................................ 1645.4.7 JUSTIFIED Clause............................................................................................................................................................. 1645.4.8 OCCURS Clause................................................................................................................................................................ 1655.4.9 PICTURE Clause................................................................................................................................................................1685.4.10 PRINTING POSITION Clause............................................................................................................................................ 1785.4.11 REDEFINES Clause......................................................................................................................................................... 1795.4.12 RENAMES Clause........................................................................................................................................................... 1805.4.13 SIGN Clause................................................................................................................................................................... 1825.4.14 SYNCHRONIZED Clause.................................................................................................................................................. 1835.4.15 TYPE Clause................................................................................................................................................................... 1845.4.16 TYPEDEF Clause............................................................................................................................................................. 1855.4.17 USAGE Clause................................................................................................................................................................ 1865.4.18 VALUE Clause................................................................................................................................................................ 193
5.5 Screen Data Description Entry................................................................................................................................................1955.5.1 AUTO Clause....................................................................................................................................................................1985.5.2 BACKGROUND-COLOR Clause........................................................................................................................................... 1985.5.3 BELL Clause.....................................................................................................................................................................1995.5.4 BLANK LINE Clause..........................................................................................................................................................1995.5.5 BLANK SCREEN Clause..................................................................................................................................................... 2005.5.6 BLANK WHEN ZERO Clause.............................................................................................................................................. 2005.5.7 BLINK Clause................................................................................................................................................................... 2015.5.8 COLUMN NUMBER Clause................................................................................................................................................ 2015.5.9 ERASE Clause.................................................................................................................................................................. 2025.5.10 FOREGROUND-COLOR Clause......................................................................................................................................... 2025.5.11 FULL Clause...................................................................................................................................................................2035.5.12 HIGHLIGHT Clause......................................................................................................................................................... 2045.5.13 JUSTIFIED Clause........................................................................................................................................................... 2045.5.14 LINE NUMBER Clause.................................................................................................................................................... 2055.5.15 LOWLIGHT Clause.......................................................................................................................................................... 2055.5.16 PICTURE Clause..............................................................................................................................................................2065.5.17 REQUIRED Clause.......................................................................................................................................................... 2075.5.18 REVERSE-VIDEO Clause..................................................................................................................................................2075.5.19 SECURE Clause...............................................................................................................................................................2085.5.20 SIGN Clause................................................................................................................................................................... 2085.5.21 UNDERLINE Clause........................................................................................................................................................ 2085.5.22 USAGE Clause................................................................................................................................................................ 2095.5.23 VALUE Clause................................................................................................................................................................ 209
5.6 Report Description Entry........................................................................................................................................................ 2095.6.1 CODE Clause.................................................................................................................................................................... 211
- xiv -
-
5.6.2 CONTROL Clause.............................................................................................................................................................. 2115.6.3 PAGE Clause.................................................................................................................................................................... 212
5.7 Report Group Description Entry..............................................................................................................................................2155.7.1 COLUMN NUMBER Clause................................................................................................................................................ 2175.7.2 GROUP INDICATE Clause.................................................................................................................................................. 2185.7.3 LINE NUMBER Clause...................................................................................................................................................... 2185.7.4 NEXT GROUP Clause........................................................................................................................................................ 2195.7.5 SIGN Clause..................................................................................................................................................................... 2205.7.6 SOURCE Clause................................................................................................................................................................ 2205.7.7 SUM Clause..................................................................................................................................................................... 2215.7.8 TYPE Clause..................................................................................................................................................................... 2235.7.9 USAGE Clause.................................................................................................................................................................. 2265.7.10 VALUE Clause................................................................................................................................................................ 226
5.8 Report Group Presentation Rules........................................................................................................................................... 2275.8.1 How to Use the Presentation Table Rules .......................................................................................................................2275.8.2 Report Heading Group Presentation Rules...................................................................................................................... 2295.8.3 Page Heading Group Presentation Rules.........................................................................................................................2305.8.4 Report Body Group Presentation Rules............................................................................................................................2315.8.5 Page Footing Group Presentation Rules.......................................................................................................................... 2345.8.6 Report Footing Group Presentation Rule......................................................................................................................... 235
Chapter 6 Procedure Division...........................................................................................................................................................2376.1 Composition of the Procedure Division.................................................................................................................................. 2376.2 Procedure Division Header.....................................................................................................................................................2416.3 Common Statement Rules..................................................................................................................................................... 243
6.3.1 Arithmetic Expressions....................................................................................................................................................2436.3.2 Boolean Expressions....................................................................................................................................................... 2456.3.3 Conditional Expressions.................................................................................................................................................. 247
6.3.3.1 Relation Condition................................................................................................................................................... 2476.3.3.2 Class Condition.........................................................................................................................................................2486.3.3.3 Condition-name ...................................................................................................................................................... 2506.3.3.4 Switch-status Condition............................................................................................................................................2516.3.3.5 Sign Condition..........................................................................................................................................................2516.3.3.6 Complex Condition................................................................................................................................................... 2516.3.3.7 Abbreviating a Combined Relation Condition...........................................................................................................257
6.3.4 Comparison Rules........................................................................................................................................................... 2586.3.5 Rules for Moving (Transcribing) Data..............................................................................................................................2636.3.6 Arithmetic Statements.................................................................................................................................................... 2676.3.7 More Than One Arithmetic Result ...................................................................................................................................2676.3.8 ROUNDED Phrase............................................................................................................................................................ 2686.3.9 ON SIZE ERROR Phrase.................................................................................................................................................... 2686.3.10 CORRESPONDING Phrase............................................................................................................................................... 2696.3.11 Overlapping of Operands.............................................................................................................................................. 2696.3.12 INVALID KEY Phrase...................................................................................................................................................... 2706.3.13 AT END Phrase.............................................................................................................................................................. 2716.3.14 Incompatible Data........................................................................................................................................................ 272
6.4 Statements............................................................................................................................................................................ 2726.4.1 ACCEPT Statement (Nucleus)...........................................................................................................................................2726.4.2 ACCEPT Statement (Screen Handling)............................................................................................................................. 2746.4.3 ACCEPT Statement (Command Line Arguments and Environmental Variables)...............................................................2756.4.4 ADD Statement (Nucleus)............................................................................................................................................... 2776.4.5 ALTER Statement (Nucleus)............................................................................................................................................ 2786.4.6 CALL Statement (Inter-program Communication)........................................................................................................... 2786.4.7 CANCEL Statement (Inter-program Communication).......................................................................................................284
- xv -
-
6.4.8 CLOSE Statement (Sequential, Relative, Indexed, Presentation File(*), and Report Writer Module)...............................2856.4.9 COMPUTE Statement (Nucleus).......................................................................................................................................2886.4.10 CONTINUE Statement (Nucleus).................................................................................................................................... 2896.4.11 DELETE Statement (Relative and Indexed Files)........................................................................................................... 2896.4.12 DISPLAY Statement (Nucleus)....................................................................................................................................... 2906.4.13 DISPLAY Statement (Screen Handling)..........................................................................................................................2926.4.14 DISPLAY Statement (Command Line Arguments and Environmental Variables)........................................................... 2936.4.15 DIVIDE Statement (Nucleus)......................................................................................................................................... 2946.4.16 ENTRY Statement (Inter-program Communication)...................................................................................................... 2976.4.17 EVALUATE Statement (Nucleus).................................................................................................................................... 2986.4.18 EXIT Statement (Nucleus)............................................................................................................................................. 3026.4.19 EXIT PERFORM Statement (Nucleus)............................................................................................................................. 3026.4.20 EXIT PROGRAM Statement (Inter-program Communication)......................................................................................... 3036.4.21 GENERATE Statement (Report writer)............................................................................................................................3036.4.22 GO TO Statement (Nucleus).......................................................................................................................................... 3056.4.23 IF Statement (Nucleus)................................................................................................................................................. 3066.4.24 INITIALIZE Statement (Nucleus).................................................................................................................................... 3076.4.25 INITIATE Statement (Report writer)............................................................................................................................... 3106.4.26 INSPECT Statement....................................................................................................................................................... 3106.4.27 MERGE Statement (Sort-merge)....................................................................................................................................3186.4.28 MOVE Statement (Nucleus)...........................................................................................................................................3236.4.29 MULTIPLY Statement (Nucleus).....................................................................................................................................3256.4.30 OPEN Statement (Sequential File, Relative File, Indexed File)...................................................................................... 3266.4.31 OPEN Statement (Presentation File)............................................................................................................................. 3306.4.32 OPEN Statement (Report Writer)...................................................................................................................................3316.4.33 PERFORM Statement (Nucleus).....................................................................................................................................3326.4.34 READ Statement (Sequential File, Relative File, Indexed File)...................................................................................... 3406.4.35 READ Statement (Presentation File)............................................................................................................................. 3476.4.36 RELEASE Statement (Sort-merge)................................................................................................................................. 3496.4.37 RETURN Statement (Sort-merge).................................................................................................................................. 3496.4.38 REWRITE Statement (Sequential File, Relative File, Indexed File)................................................................................. 3506.4.39 SEARCH Statement (Nucleus)........................................................................................................................................3546.4.40 SET Statement (Nucleus).............................................................................................................................................. 3586.4.41 SORT Statement (Sort-merge).......................................................................................................................................3606.4.42 START Statement (Relative File)....................................................................................................................................3656.4.43 START Statement (Indexed File)....................................................................................................................................3666.4.44 STOP Statement (Nucleus)............................................................................................................................................ 3716.4.45 STRING Statement (Nucleus).........................................................................................................................................3716.4.46 SUBTRACT Statement (Nucleus).................................................................................................................................... 3786.4.47 SUPPRESS Statement (Report Writer)............................................................................................................................3796.4.48 TERMINATE Statement (Report Writer)..........................................................................................................................3806.4.49 UNLOCK Statement (Sequential File, Relative File, Indexed File).................................................................................. 3806.4.50 UNSTRING Statement (Nucleus).................................................................................................................................... 3816.4.51 USE Statement (Sequential, Relative, Indexed, Presentation File, and Report Writer Module)..................................... 3906.4.52 USE BEFORE REPORTING Statement (Report Writer)......................................................................................................3936.4.53 USE FOR DEAD-LOCK Statement.................................................................................................................................... 3936.4.54 WRITE Statement (Sequential File)............................................................................................................................... 3946.4.55 WRITE Statement (Relative and Indexed Files)............................................................................................................. 3996.4.56 WRITE Statement (Presentation File)............................................................................................................................ 402
6.5 General Rules for Functions................................................................................................................................................... 4036.5.1 Function Call Format....................................................................................................................................................... 4036.5.2 Types of Arguments........................................................................................................................................................ 4036.5.3 Rules Applied for Specifying a Table as an Argument......................................................................................................404
- xvi -
-
6.5.4 Function Types................................................................................................................................................................ 4046.6 Functions............................................................................................................................................................................... 405
6.6.1 ACOS Function.................................................................................................................................................................4056.6.2 ADDR Function................................................................................................................................................................ 4056.6.3 ANNUITY Function........................................................................................................................................................... 4066.6.4 ASIN Function................................................................................................................................................................. 4076.6.5 ATAN Function................................................................................................................................................................ 4076.6.6 CAST-ALPHANUMERIC Function....................................................................................................................................... 4076.6.7 CHAR Function................................................................................................................................................................ 4086.6.8 COS Function................................................................................................................................................................... 4086.6.9 CURRENT-DATE Function................................................................................................................................................. 4096.6.10 DATE-OF-INTEGER Function........................................................................................................................................... 4106.6.11 DAY-OF-INTEGER Function.............................................................................................................................................4106.6.12 DISPLAY-OF Function.....................................................................................................................................................4106.6.13 FACTORIAL Function...................................................................................................................................................... 4116.6.14 INTEGER Function..........................................................................................................................................................4126.6.15 INTEGER-OF-DATE Function........................................................................................................................................... 4126.6.16 INTEGER-OF-DAY Function.............................................................................................................................................4136.6.17 INTEGER-PART Function.................................................................................................................................................4136.6.18 LENG Function...............................................................................................................................................................4146.6.19 LENGTH Function.......................................................................................................................................................... 4146.6.20 LOG Function................................................................................................................................................................ 4156.6.21 LOG10 Function.............................................................................................................................................................4166.6.22 LOWER-CASE Function...................................................................................................................................................4166.6.23 MAX Function................................................................................................................................................................4166.6.24 MEAN Function............................................................................................................................................................. 4176.6.25 MEDIAN Function.......................................................................................................................................................... 4176.6.26 MIDRANGE Function......................................................................................................................................................4186.6.27 MIN Function................................................................................................................................................................ 4186.6.28 MOD Function............................................................................................................................................................... 4196.6.29 NATIONAL Function....................................................................................................................................................... 4196.6.30 NATIONAL-OF Function................................................................................................................................................. 4206.6.31 NUMVAL Function......................................................................................................................................................... 4216.6.32 NUMVAL-C Function...................................................................................................................................................... 4216.6.33 ORD Function................................................................................................................................................................ 4226.6.34 ORD-MAX Function........................................................................................................................................................4236.6.35 ORD-MIN Function........................................................................................................................................................ 4236.6.36 PRESENT-VALUE Function..............................................................................................................................................4246.6.37 RANDOM Function.........................................................................................................................................................4246.6.38 RANGE Function............................................................................................................................................................ 4256.6.39 REM Function................................................................................................................................................................4256.6.40 REVERSE Function......................................................................................................................................................... 4266.6.41 SIN Function.................................................................