Application Development Solutions COBOL ANSI-85 Programming Reference Manual Volume 1: Basic Implementation ClearPath MCP Release 8.0 Printed in USA February 2003 8600 1518–307 . Application Development Solutions COBOL ANSI-85 Programming Reference Manual Volume 1: Basic Implementation UNISYS © 2003 Unisys Corporation. All rights reserved. ClearPath MCP Release 8.0 Printed in USA February 2003 8600 1518–307 NO WARRANTIES OF ANY NATURE ARE EXTENDED BY THIS DOCUMENT. Any product or related information described herein is only furnished pursuant and subject to the terms and conditions of a duly executed agreement to purchase or lease equipment or to license software. The only warranties made by Unisys, if any, with respect to the products described in this document are set forth in such agreement. Unisys cannot accept any financial or other responsibility that may be the result of your use of the information in this document or software material, including direct, special, or consequential damages. You should be very careful to ensure that the use of this information and/or software material complies with the laws, rules, and regulations of the jurisdictions with respect to which it is used. The information contained herein is subject to change without notice. Revisions may be issued to advise of such changes and/or additions. Notice to Government End Users: This is commercial computer software or hardware documentation developed at private expense. Use, reproduction, or disclosure by the Government is subject to the terms of Unisys standard commercial license for the products, and where applicable, the restricted/limited rights provisions of the contract data rights clauses. Correspondence regarding this publication can be e-mailed to [email protected]. Unisys and ClearPath are registered trademarks of Unisys Corporation in the United States and other countries. All other brands and products referenced in this document are acknowledged to be the trademarks or registered trademarks of their respective holders. Application Development Application Development Solutions Solutions COBOL ANSI-85 COBOL ANSI-85 Programming Programming Reference Reference Manual Manual Volume 1: Volume 1: Basic Basic Implementation Implementation ClearPath MCP ClearPath MCP Release 8.0 Release 8.0 8600 1518–307 8600 1518–307 Bend here, peel upwards and apply to spine. . Contents Section 1. Program Structure and Language Elements About This Manual................................................................................1–1 Purpose................................................................................1–1 Audience..............................................................................1–1 Conventions.........................................................................1–2 Acknowledgments...............................................................1–2 Program Overview................................................................................1–3 Divisions of a Source Program..............................................................1–3 Contents of a Division...........................................................................1–4 Reference Format.................................................................................1–5 Division and Section Headers................................................................1–7 Level-Numbers......................................................................................1–8 Special-Purpose Lines—Fixed Indicators..............................................1–9 Continuation Lines...............................................................1–9 Comment Lines.................................................................1–10 Floating Comment Indicator...............................................1–11 Debugging Lines................................................................1–11 Compiler Control Option Lines...........................................1–12 Blank Lines.........................................................................1–12 Pseudotext.........................................................................1–12 COBOL Character Set.........................................................................1–13 Using Separator Characters for Punctuation.......................................1–14 Types of COBOL Words......................................................................1–16 Reserved Words................................................................1–16 Connectives...............................................................1–17 Figurative Constants..................................................1–17 Functions...................................................................1–19 Special Registers.......................................................1–20 Arithmetic and Relational Operators.........................1–22 System-Names..................................................................1–23 User-Defined Words..........................................................1–24 Identifiers.............................................................................................1–28 Literals.................................................................................................1–29 Nonnumeric Literals...........................................................1–30 National Literals.................................................................1–31 Numeric Literals.................................................................1–32 Undigit Literals...................................................................1–33 Floating-Point Literals.........................................................1–34 Boolean Literals.................................................................1–35 8600 1518–307 iii Contents Section 2. Identification Division General Format.....................................................................................2–1 Identification Division Header...............................................................2–1 PROGRAM-ID Paragraph......................................................................2–2 IS COMMON PROGRAM Clause........................................2–3 IS INITIAL PROGRAM Clause.............................................2–3 IS LIBRARY PROGRAM Clause...........................................2–3 IS DEFINITION PROGRAM Clause......................................2–3 AUTHOR Paragraph..............................................................................2–4 INSTALLATION Paragraph....................................................................2–5 DATE-WRITTEN Paragraph...................................................................2–6 DATE-COMPILED Paragraph................................................................2–7 Security Paragraph................................................................................2–8 Section 3. Environment Division General Format.....................................................................................3–1 Environment Division Header...............................................................3–1 Configuration Section............................................................................3–2 Configuration Section Header..............................................3–2 SOURCE-COMPUTER Paragraph........................................3–3 OBJECT-COMPUTER Paragraph.........................................3–4 MEMORY SIZE Clause...............................................3–5 DISK SIZE Clause........................................................3–5 PROGRAM COLLATING SEQUENCE Clause.............3–6 SPECIAL-NAMES Paragraph...............................................3–7 CHANNEL Clause.....................................................3–10 ODT Clause...............................................................3–10 SWITCH-NAME Clause.............................................3–10 ALPHABET Clause....................................................3–11 SYMBOLIC CHARACTERS Clause...........................3–16 CLASS Clause...........................................................3–17 CURRENCY SIGN Clause..........................................3–18 Literal-7 IS MNEMONIC-NAME Clause....................3–19 DECIMAL-POINT Clause...........................................3–19 DEFAULT DISPLAY SIGN and DEFAULT COMPUTATIONAL SIGN Clauses........................3–19 Input-Output Section...........................................................................3–21 Input-Output Section Header.............................................3–21 FILE-CONTROL Paragraph................................................3–22 General Format of the FILE-CONTROL Paragraph..............................................................3–22 File Control Entry Format 1: Sequential Organization..........................................................3–23 File Control Entry Format 2: Relative Organization..........................................................3–30 File Control Entry Format 3: Indexed I/O..................3–34 File Control Entry Format 4: Sort-Merge...................3–39 iv 8600 1518–307 Contents I-O-CONTROL Paragraph...................................................3–41 Input-Output Control Entry Format 1: Sequential I/O.......................................................3–41 Input-Output Control Entry Format 2: Relative and Indexed Organization.....................................3–44 Input-Output Control Entry Format 3: Sort- Merge....................................................................3–46 I-O Status Codes................................................................3–49 Recovering from I-O Errors................................................3–56 How the Recovery Process Occurs...................................3–57 Modifying the Recovery Process for COBOL74 Compatibility..................................................................3–58 Section 4. Data Division Structure of the Data Division...............................................................4–1 Record Concepts.................................................................4–2 Level Concepts....................................................................4–3 Level-Numbers............................................................4–4 Level Indicators (FD, SD).............................................4–4 Classes and Categories of Data Items.................................4–5 Class and Category of Figurative Constants and Intrinsic Functions............................................4–6 Long Numeric Data Items...........................................4–7 Algebraic Signs....................................................................4–8 Standard Alignment Rules...................................................4–8 Increasing Object-Code Efficiency.......................................4–9 Uniqueness of Reference....................................................4–9 Qualification.......................................................................4–10 Reference Modifiers..........................................................4–14 General Format....................................................................................4–17 Record Description Entry....................................................................4–18 Data Description Entry Format 1.........................................................4–19 Data-Name or FILLER Clause............................................4–22 REDEFINES Clause............................................................4–23 ALIGNED Clause................................................................4–24 BLANK WHEN ZERO Clause.............................................4–24 COMMON Clause..............................................................4–25 INTEGER and STRING Clauses..........................................4–26 JUSTIFIED (JUST) Clause..................................................4–26 LOCAL Clause....................................................................4–26 LOWER-BOUNDS Clause..................................................4–27 OCCURS Clause................................................................4–28 OWN Clause......................................................................4–31 PICTURE Clause................................................................4–32 Restrictions...............................................................4–32 Symbols.....................................................................4–33 Categories of Items...................................................4–38 Determining the Size of an Elementary Item............4–40 Editing Rules.............................................................4–41 Precedence Rules.....................................................4–47 8600 1518–307 v Contents RECEIVED BY Clause........................................................4–49 RECORD AREA Clause......................................................4–50 SIGN Clause.......................................................................4–50 SYNCHRONIZED Clause...................................................4–52 TYPE Clause......................................................................4–53 USAGE Clause...................................................................4–54 USAGE IS BINARY....................................................4–55 USAGE IS BIT...........................................................4–56 USAGE IS COMPUTATIONAL and USAGE IS COMP...................................................................4–57 USAGE IS COMPUTATIONAL-5 and USAGE IS COMP-5............................................................4–57 USAGE IS CONTROL-POINT....................................4–57 USAGE IS DISPLAY..................................................4–58 USAGE IS DOUBLE..................................................4–58 USAGE IS EVENT......................................................4–59 USAGE IS INDEX......................................................4–60 USAGE IS LOCK.......................................................4–61 USAGE IS KANJI (Obsolete).....................................4–61 USAGE IS NATIONAL...............................................4–62 USAGE IS PACKED-DECIMAL..................................4–62 USAGE IS REAL........................................................4–62 USAGE IS TASK........................................................4–63 VALUE Clause....................................................................4–64 Data Description Entry Format 2: Level-66 RENAMES Entry.............4–67 RENAMES Clause..............................................................4–68 Data Description Entry Format 3: Level-88 Condition-Name Entry................................................................................................4–70 VALUE Clause....................................................................4–71 Data Description Entry Format 4: IPC.................................................4–75 Data-Name or FILLER Clause............................................4–77 COMMON Clause..............................................................4–77 EXTERNAL Clause.............................................................4–77 GLOBAL Clause.................................................................4–78 OWN Clause......................................................................4–78 REDEFINES Clause............................................................4–79 VALUE Clause....................................................................4–79 Data Division Header..........................................................................4–80 File Section..........................................................................................4–81 File Description Entry Format 1: Sequential I-O..................................4–82 BLOCK CONTAINS Clause................................................4–84 CODE-SET Clause..............................................................4–86 DATA RECORDS Clause...................................................4–87 LABEL RECORDS Clause..................................................4–87 LINAGE Clause..................................................................4–88 RECORD Clause................................................................4–91 VALUE OF Clause..............................................................4–95 File Description Entry Format 2: Relative I-O, Indexed I-O.................4–98 BLOCK CONTAINS Clause................................................4–99 Variable Length Records..................................................4–100 vi 8600 1518–307
Description: