HP COBOL reference manual

682 214 0
HP COBOL reference manual

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

HPCOBOL ReferenceManual Order Number: AA–Q2G0H–TK January 2005 This manual provides reference information and syntax for the HP COBOL programming language on its platforms: OpenVMS Alpha, OpenVMS Industry Standard 64, OpenVMS VAX, and Tru64 UNIX Alpha. Revision/Update Information: This manual supersedes the Compaq COBOL Reference Manual, Version 2.8 and the VAX COBOL Reference Manual, Version 5.4, as well as the online-only Compaq COBOL Reference Manual, Version 2.8 and Version 5.7. Operating System and Version: OpenVMS I64 Version 8.2 OpenVMS Alpha Version 6.2 or higher OpenVMS VAX Version 6.2 or higher Tru64 UNIX Version 5.1 or higher Software Version: HP COBOL for OpenVMS I64 Version 2.8 HP COBOL for OpenVMS Alpha Version 2.8 HP COBOL for Tru64 UNIX Version 2.8 HP COBOL for OpenVMS VAX Version 5.7A Hewlett-Packard Company Palo Alto, California © Copyright 2005 Hewlett-Packard Development Company, L.P. Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor’s standard commercial license. The information contained herein is subject to change without notice. The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein. Intel and Itanium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Motif, UNIX®, and X/Open® are trademarks of The Open Group in the U.S. and/or other countries. All other product names mentioned herein may be trademarks of their respective companies. Printed in the US ZK6296 This manual is available on CD–ROM. This document was prepared using DECdocument, Version 3.3-1b. Contents Preface xiii 1 Overview of the COBOL Language 1.1 The COBOL Character Set 1–1 1.2 Character Strings 1–3 1.2.1 COBOL Words . . . 1–3 1.2.1.1 User-Defined Words 1–3 1.2.1.2 System-Names 1–5 1.2.1.3 Reserved Words 1–6 1.2.1.4 Function-Names 1–10 1.2.2 Literals 1–10 1.2.2.1 Numeric Literals 1–10 1.2.2.2 Nonnumeric Literals . . . 1–12 1.2.3 Figurative Constants 1–14 1.2.4 PICTURE Character-Strings 1–16 1.2.5 Separators 1–16 1.3 Source Reference Format 1–17 1.3.1 ANSI Format 1–18 1.3.2 Terminal Format . 1–22 1.4 Sample Entry Format 1–23 2 Organization of a COBOL Program 2.1 Program Structure . . . 2–2 2.1.1 Division Header . . 2–3 2.1.2 Section Header . . . 2–4 2.1.3 Paragraph, Paragraph Header, Paragraph-Name . 2–5 2.2 Data Division Entries 2–5 2.3 Declaratives 2–6 3 Identification Division PROGRAM-ID 3–2 AUTHOR . . 3–4 DATE-COMPILED . . . 3–5 OPTIONS (Alpha, I64) 3–6 iii 4 Environment Division 4.1 CONFIGURATION Section 4–2 SOURCE-COMPUTER 4–3 OBJECT-COMPUTER 4–4 SPECIAL-NAMES 4–6 4.2 INPUT-OUTPUT Section . . 4–20 FILE-CONTROL 4–21 ASSIGN 4–28 BLOCK CONTAINS 4–31 CODE-SET 4–32 LOCK MODE (Alpha, I64) . 4–33 ORGANIZATION 4–34 PADDING CHARACTER . . 4–35 RECORD DELIMITER (OpenVMS) . . 4–36 RESERVE 4–37 I-O-CONTROL . . 4–38 5 Data Division 5.1 Logical Concepts of Data Storage 5–1 5.1.1 Record Description Entries 5–2 5.1.2 Level-Numbers 5–3 5.1.3 Multiple Record Description Entries for the Same Data 5–4 5.2 Physical Concepts of Data Storage . . . 5–5 5.2.1 Categories and Classes of Data . . 5–6 5.2.2 COBOL Standard Alignment Rules 5–7 5.2.3 Additional Alignment Rules for Record Allocation 5–7 5.2.4 Alpha and I64 Alignment and Padding 5–15 5.3 DATA DIVISION General Format and Rules 5–16 FD (File Description) 5–20 SD (Sort-Merge File Description) 5–26 RD (Report Description) . . . 5–27 Data Description 5–30 Report Group Description . 5–34 Screen Description (Alpha, I64) 5–38 ACCESS MODE . 5–43 ALTERNATE RECORD KEY 5–45 AUTO . 5–48 BACKGROUND-COLOR (Alpha, I64) 5–49 BELL . 5–50 BLANK 5–51 BLANK WHEN ZERO 5–52 BLINK (Alpha, I64) 5–53 CODE . 5–54 COLUMN NUMBER 5–55 CONTROL 5–58 Data-Name 5–61 DATA RECORDS 5–63 iv ERASE (Alpha, I64) . . 5–64 EXTERNAL 5–65 FILE STATUS 5–67 FOREGROUND-COLOR (Alpha, I64) 5–68 FULL (Alpha, I64) . . . 5–69 GLOBAL . . 5–70 GROUP INDICATE . . 5–71 HIGHLIGHT (Alpha, I64) 5–73 JUSTIFIED 5–74 LABEL RECORDS . . . 5–75 Level-Number 5–76 LINAGE . . . 5–78 LINE NUMBER (Alpha, I64) . . . 5–82 LOWLIGHT (Alpha, I64) 5–85 NEXT GROUP 5–86 OCCURS . . 5–88 PAGE 5–92 PICTURE . . 5–96 RECORD . . 5–108 RECORD KEY 5–111 REDEFINES 5–113 RENAMES . 5–117 REPORT . . 5–119 REQUIRED (Alpha, I64) 5–120 REVERSE-VIDEO (Alpha, I64) . 5–121 SECURE (Alpha, I64) 5–122 SIGN 5–123 SOURCE . . 5–126 SUM 5–127 SYNCHRONIZED . . . 5–130 TYPE 5–132 UNDERLINE 5–137 USAGE . . . 5–138 VALUE IS . 5–150 VALUE OF ID 5–156 6 Procedure Division 6.1 Verbs, Statements, and Sentences 6–1 6.1.1 Compiler-Directing Statements and Sentences . . . 6–4 6.1.2 Imperative Statements and Sentences . . 6–5 6.1.3 Conditional Statements and Sentences . 6–5 6.1.4 Scope of Statements 6–6 6.2 Uniqueness of Reference 6–7 6.2.1 Qualification 6–7 6.2.2 Subscripts and Indexes 6–10 6.2.3 Reference Modification 6–13 6.2.4 Identifiers 6–15 6.2.5 Ensuring Unique Condition-Names 6–15 v 6.2.6 Scope of Names 6–15 6.2.6.1 Conventions for Resolving Program-Name References 6–17 6.2.6.2 Conventions for Resolving Other References 6–21 6.2.7 External and Internal Data 6–23 6.3 Explicit and Implicit Specifications . . 6–24 6.3.1 Explicit and Implicit Procedure Division References . . . 6–24 6.3.2 Explicit and Implicit Control Transfers 6–24 6.3.3 Explicit and Implicit Attributes . . 6–25 6.3.4 Explicit and Implicit Scope Terminators 6–25 6.4 Arithmetic Expressions . . . 6–26 6.4.1 Arithmetic Operators . . 6–26 6.4.2 Formation and Evaluation of Arithmetic Expressions . . 6–27 6.4.3 Standard Arithmetic (Alpha, I64) . 6–28 6.4.4 Native Arithmetic (Alpha, I64) . . . 6–29 6.4.4.1 FLOAT Arithmetic (Alpha, I64) 6–29 6.4.4.2 CIT3 Arithmetic (Alpha, I64) . 6–30 6.4.4.3 CIT4 Arithmetic (Alpha, I64) . 6–30 6.5 Conditional Expressions . . . 6–31 6.5.1 Relation Conditions . . . 6–31 6.5.1.1 Comparison of Numeric Operands 6–32 6.5.1.2 Comparison of Nonnumeric Operands . . . 6–32 6.5.2 Class Condition 6–33 6.5.3 Condition-Name Condition 6–34 6.5.4 Switch-Status Condition 6–35 6.5.5 Sign Condition 6–36 6.5.6 Success/Failure Condition 6–36 6.5.7 Complex Conditions . . . 6–38 6.5.8 Abbreviated Combined Relation Conditions . . 6–39 6.5.9 Condition Evaluation Rules 6–40 6.6 Common Rules and Options for Data Handling . . 6–41 6.6.1 Arithmetic Operations . 6–41 6.6.2 Multiple Receiving Fields in Arithmetic Statements . . . 6–42 6.6.3 ROUNDED Phrase 6–42 6.6.4 ON SIZE ERROR Phrase 6–42 6.6.5 CORRESPONDING Phrase 6–43 6.6.6 ON EXCEPTION Phrase 6–44 6.6.7 Overlapping Operands and Incompatible Data 6–45 6.6.8 I-O Status . . 6–46 6.6.9 AT END Phrase 6–50 6.6.10 INVALID KEY Phrase . 6–51 6.6.11 FROM Phrase 6–53 6.6.12 INTO Phrase 6–53 6.7 Segmentation . . . 6–53 6.8 General Formats and Rules for Statements 6–54 ACCEPT 6–59 ADD 6–84 ALTER 6–87 CALL . 6–89 CANCEL 6–95 CLOSE 6–97 COMPUTE 6–101 CONTINUE 6–103 DELETE 6–104 vi DISPLAY . . 6–107 DIVIDE . . . 6–120 EVALUATE 6–124 EXIT 6–130 EXIT PROGRAM 6–131 GENERATE 6–132 GOTO 6–134 IF 6–136 INITIALIZE 6–139 INITIATE . . 6–142 INSPECT . . 6–143 MERGE . . . 6–151 MOVE 6–156 MULTIPLY . 6–161 OPEN 6–164 PERFORM . 6–173 READ 6–186 RECORD (OpenVMS Only) 6–193 RELEASE . 6–195 RETURN . . 6–196 REWRITE . 6–198 SEARCH . . 6–202 SET 6–209 SORT 6–214 START 6–222 STOP 6–228 STRING . . . 6–229 SUBTRACT 6–234 SUPPRESS 6–237 TERMINATE 6–238 UNLOCK . . 6–239 UNSTRING 6–244 USE 6–250 WRITE 6–254 END PROGRAM 6–261 7 Intrinsic Functions Intrinsic Function . . . 7–2 ACOS 7–8 ANNUITY . 7–9 ARGCOUNT (OpenVMS Only) . . 7–10 ASIN 7–11 ATAN 7–12 CHAR 7–13 COS 7–14 CURRENT-DATE . . . 7–15 vii DATE-OF-INTEGER 7–17 DATE-TO-YYYYMMDD . . . 7–18 DAY-OF-INTEGER 7–19 DAY-TO-YYYYDDD 7–20 FACTORIAL . . . 7–21 INTEGER 7–22 INTEGER-OF-DATE 7–23 INTEGER-OF-DAY 7–24 INTEGER-PART 7–25 LENGTH 7–26 LOG 7–27 LOG10 7–28 LOWER-CASE . 7–29 MAX 7–30 MEAN 7–32 MEDIAN 7–33 MIDRANGE . . . 7–34 MIN 7–35 MOD 7–36 NUMVAL 7–37 NUMVAL-C 7–38 ORD 7–39 ORD-MAX 7–40 ORD-MIN 7–41 PRESENT-VALUE 7–42 RANDOM 7–43 RANGE 7–44 REM 7–45 REVERSE 7–46 SIN 7–47 SQRT 7–48 STANDARD-DEVIATION . 7–49 SUM 7–50 TAN 7–52 TEST-DATE-YYYYMMDD . 7–53 TEST-DAY-YYYYDDD 7–54 UPPER-CASE . . 7–55 VARIANCE 7–56 WHEN-COMPILED 7–57 YEAR-TO-YYYY . 7–59 viii 8 Source Text Manipulation 8.1 Text-Word Definition Rules 8–1 COPY 8–3 REPLACE . 8–21 A HP COBOL Reserved Words B Character Sets C File Status Values D Report Writer Presentation Rules and Tables D.1 Organization D–1 D.2 LINE NUMBER Clause Notation D–2 D.3 LINE NUMBER Clause Sequence Substitutions D–2 D.4 Saved-Next-Group-Integer Description D–2 D.5 REPORT HEADING Group Presentation Rules D–3 D.6 PAGE HEADING Group Presentation Rules D–5 D.7 Body Group Presentation Rules . D–6 D.8 PAGE FOOTING Group Presentation Rules D–11 D.9 REPORT FOOTING Group Presentation Rules D–13 E RTL Routines for Accessing the RAB and FAB Structures (OpenVMS Alpha and I64 Only) DCOB$RMS_CURRENT_FAB . . E–2 DCOB$RMS_CURRENT_RAB . . E–3 Glossary Index Examples 5–1 Multiple Record Definition Structure 5–5 6–1 Subscripting Example 6–11 6–2 Indexing Example 6–13 6–3 Separately Compiled Program 1 6–18 6–4 Separately Compiled Program 2 6–19 6–5 Separately Compiled Program 3 6–19 6–6 Separately Compiled Program 1 6–20 6–7 Separately Compiled Program 2 6–21 6–8 Separately Compiled Program 3 6–21 6–9 Resolving References to Miscellaneous Names 6–22 8–1 COPY with No REPLACING Phrase . . . 8–12 8–2 Replacing a Word with a Literal 8–12 8–3 Replacing a Word by a Literal and Pseudo-Text by Pseudo-Text 8–13 ix 8–4 Matching a Nonnumeric Literal . . 8–13 8–5 Multiple-Line Pseudo-Text Replacement Item 8–14 8–6 Matching Pseudo-Text That Includes Separators 8–15 8–7 Command File That Creates Oracle CDD/Repository Directories and Objects in Figure 8-1 (OpenVMS) 8–16 8–8 Using a Logical Name in a COPY Statement (OpenVMS) 8–18 8–9 Using a Full Pathname in a COPY Statement (OpenVMS) 8–19 8–10 Command File That Creates Oracle CDD/Repository Directories and Objects in Figure 8-2 (OpenVMS) 8–20 Figures 1–1 Source Program Line . . 1–18 2–1 Structure of a COBOL Program . . 2–2 5–1 Hierarchical Record Structure . . . 5–3 5–2 Level-Number Record Structure . . 5–4 5–3 Record Alignment Boundaries . . . 5–8 5–4 Effect of Boundary and Location Equivalence Rules on Sample Record 5–11 5–5 Storage Allocation for Sample Record 5–11 5–6 Storage Allocation Without and With Boundary Equivalence 5–12 5–7 Format 3 Clause Combinations . . 5–37 5–8 Control Break Levels and Their Printed Report Groups 5–59 5–9 Logical Page Areas Resulting from a LINAGE Clause . . 5–81 5–10 PICTURE Symbol Precedence Rules 5–107 6–1 Possible Combinations of Status Keys 1 and 2 6–47 6–2 Valid and Invalid Nested PERFORM Statements 6–177 6–3 PERFORM . . . VARYING with the TEST BEFORE Phrase and One Condition . . . 6–179 6–4 PERFORM . . . VARYING with the TEST BEFORE Phrase and Two Conditions . . 6–180 6–5 PERFORM . . . VARYING with the TEST AFTER Phrase and One Condition . . . 6–181 6–6 PERFORM . . . VARYING with the TEST AFTER Phrase and Two Conditions . . 6–183 8–1 Hierarchical Repository Structure (OpenVMS) 8–15 8–2 Nonhierarchical Repository Structure (OpenVMS) 8–19 D–1 REPORT HEADING Group Presentation Rules D–3 D–2 PAGE HEADING Group Presentation Rules Table D–5 D–3 Body Group Presentation Rules . . D–7 D–4 PAGE FOOTING Group Presentation Rules . D–12 D–5 REPORT FOOTING Group Presentation Rules D–14 x [...]... known as Compaq COBOL, DEC COBOL, DIGITAL COBOL, and VAX COBOL HP COBOL, unmodified, refers to the following products: HP HP HP HP COBOL COBOL COBOL COBOL for for for for OpenVMS Industry Standard 64 OpenVMS Alpha Tru64 UNIX OpenVMS VAX Any references to the former names in product documentation or other components should be construed as references to the HP COBOL names Intended Audience This manual is intended... Installation Guide This manual provides instructions for installing HP COBOL on the Tru64 UNIX operating system HP COBOL for OpenVMS Alpha and I64 Systems Installation Guide This manual provides instructions for installing HP COBOL on the OpenVMS Alpha and OpenVMS I64 operating systems xiv Compaq COBOL for OpenVMS VAX Systems Installation Guide This manual provides instructions for installing HP COBOL on the... Glossary contains an alphabetical listing of common HP COBOL terms and their definitions • The Index indexes and references terms and concepts in this manual Associated Documents The following documents contain additional information directly related to various topics covered in this manual: HP COBOL User Manual This manual describes how to use features of the HP COBOL language to develop programs on the Tru64... Company implementation of COBOL (COmmon Business-Oriented Language) for the OpenVMS and Tru64 UNIX platforms It includes information about language syntax and semantics, as well as information about adherence and extensions to various COBOL standards This documentation set also includes the HP COBOL User Manual and, optionally, the HP COBOL DBMS Database Programming Manual HP COBOL is the new name for... Compaq COBOL, DIGITAL COBOL, or DEC xvii COBOL HP COBOL for OpenVMS VAX was formerly known as Compaq COBOL for OpenVMS VAX, VAX COBOL or as DIGITAL VAX COBOL Acknowledgement COBOL is an industry language and is not the property of any company or group of companies, or of any organization or group of organizations No warranty, expressed or implied, is made by any contributor or by the CODASYL COBOL Committee... thorough understanding of the COBOL language and some familiarity with their operating system This is not a tutorial manual If you are a new COBOL user, you may need to read introductory COBOL textbooks or take COBOL courses Structure of This Document This manual is organized as follows: • Chapter 1 presents the elements of the COBOL language, describes two format options for a COBOL program, and explains... operating system and its tools The Alpha Architecture Reference Manual This manual is available from Digital Press Related Documents For additional information about HP OpenVMS products and services, visit the following World Wide Web address: http://www .hp. com/go/openvms Conventions Used in This Document The following product names may appear in this manual: • HP OpenVMS Industry Standard 64 for Integrity... instructions for installing HP COBOL on the OpenVMS VAX operating system HP COBOL DBMS Database Programming Manual This manual provides information on using HP COBOL for database programming with Oracle CODASYL DBMS on the OpenVMS Alpha, the OpenVMS I64, or OpenVMS VAX operating systems The OpenVMS Calling Standard and other manuals in the OpenVMS Documentation Set This set contains information about... files (Refer to the section on segmented keys in the HP COBOL User Manual. ) Segment-Number Is a 1- or 2-digit number that classifies a Procedure Division section for segmentation In HP COBOL programs, segment-numbers specify independent and fixed segments (See Section 6.7.) (continued on next page) 1–4 Overview of the COBOL Language Table 1–2 (Cont.) COBOL User-Defined Words User-Defined Word Purpose Symbolic-Character... prompt References The following table shows certain references and their respective meanings in this manual: Reference Meaning Alpha OpenVMS Alpha or Tru64 UNIX Alpha operating system OpenVMS OpenVMS Alpha, OpenVMS I64, or OpenVMS VAX operating system Tru64 UNIX Tru64 UNIX Alpha operating system VAX OpenVMS VAX operating system Tru64 UNIX was formerly known as DEC OSF/1 or as DIGITAL UNIX HP COBOL was . as Compaq COBOL, DEC COBOL, DIGITAL COBOL, and VAX COBOL. HP COBOL, unmodified, refers to the following products: HP COBOL for OpenVMS Industry Standard 64 HP COBOL for OpenVMS Alpha HP COBOL for. Information: This manual supersedes the Compaq COBOL Reference Manual, Version 2.8 and the VAX COBOL Reference Manual, Version 5.4, as well as the online-only Compaq COBOL Reference Manual, Version. UNIX. HP COBOL was formerly known as Compaq COBOL, DIGITAL COBOL, or DEC xvii COBOL. HP COBOL for OpenVMS VAX was formerly known as Compaq COBOL for OpenVMS VAX, VAX COBOL or as DIGITAL VAX COBOL. Acknowledgement COBOL

Ngày đăng: 23/10/2014, 11:59

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan