HP 3000 Manuals

HP COBOL II/XL Reference Manual : COPYRIGHT NOTICE [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation


HP COBOL II/XL Reference Manual


HP COBOL II/XL Reference Manual Printed in U.S.A. Series 900 HP 3000 Computer Systems HP Part No. 31500-90001 Edition E0791
Printed 19910701 Notice The information contained in this document is subject to change without notice. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance or use of this material. Hewlett-Packard assumes no responsibility for the use or reliability of its software on equipment that is not furnished by Hewlett-Packard. This document contains proprietary information which is protected by copyright. All rights are reserved. No part of this document may be photocopied, reproduced or translated to another language without the prior written consent of Hewlett-Packard Company Copyright (c) 1987, 1988, 1991 by HEWLETT-PACKARD COMPANY RESTRICTED RIGHTS LEGEND Use, duplication or disclosure by the U.S. Government is subject to restrictions as set forth in subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 for DoD agencies, Computer Software Restricted Rights clause at FAR 52.227-19 for other agencies. Hewlett-Packard Company 3000 Hanover Street Palo Alto, CA 94304 U.S.A. Printing History New editions are complete revisions of the manual. Update packages, which are issued between editions, contain additional and replacement pages to be merged into the manual by the customer. The dates on the title page change only when a new edition or a new update is published. No information is incorporated into a reprinting unless it appears as a prior update; the edition does not change when an update is incorporated. The software code printed alongside the data indicates the version level of the software product at the time the manual or update was issued. Many product updates and fixes do not require manual changes and, conversely, manual corrections may be done without accompanying product changes. Therefore, do not expect a one to one correspondence between product updates and manual updates. First Edition November 1987 31500A.00.12 Second Edition October 1988 31500A.01.06 Third Edition July 1991 31500A.04.03 Preface This reference manual documents the HP COBOL II language for programming on Hewlett-Packard computer systems. HP COBOL II is based on the 1974 and ANSI COBOL'1985 Standard X3.23-1985. This manual is a reference text for programmers who have a working knowledge of COBOL. The objective of the HP COBOL II Reference Manual is to guide you in writing source programs in HP COBOL II, compiling them into object programs, preparing and executing them.
NOTE The information in the main body of this manual is generic. Machine-dependent information is in Appendix H , "MPE XL System Dependencies."
This manual is organized as follows: Chapter 1 Introduces HP COBOL II. Summarizes standard capabilities, HP extensions, and new features. Chapter 2 Describes constructs of COBOL. Chapter 3 Describes COBOL program elements. Chapter 4 Explains how data is described and referenced in COBOL. Chapter 5 Describes the Identification Division. Chapter 6 Describes the Environment Division. Chapter 7 Describes the Data Division. Chapter 8 Gives a general description of the Procedure Division. Chapter 9 Describes specific Procedure Division statements. Chapter 10 Describes all the COBOL functions and how to call them. Chapter 11 Explains interprogram communication in COBOL. Chapter 12 Describes SORT-MERGE operations. Chapter 13 Describes the COBOL debugging facility. Chapter 14 Describes source-text manipulation statements. Appendix A Lists the error messages produced by the COBOL compiler and by COBOL programs. Appendix B Lists preprocessor commands and $CONTROL options. Appendix C Describes differences between COBOL'85 and COBOL'74 and lists incompatibilities and obsolete features of the language. Appendix D Defines the ASCII and EBCDIC character sets. Appendix E Contains the COBOL glossary. Appendix F Lists COBOL reserved words. Appendix G Describes the COBEDIT program and COPY libraries. Appendix H Describes machine-dependent information for MPE XL systems. Additional Documentation More information on HP COBOL II/XL is in the following manuals: * HP COBOL II/XL Programmer's Guide (31500-90002) * HP COBOL II/XL Quick Reference Guide (31500-90003) This manual references the following manuals: * HP Toolset/XL Reference Manual (36044-90001)[REV BEG] * HP Symbolic Debugger/XL Reference Manual (31508-90003) * Using KSAM/XL (32650-90168)[REV END] * KSAM/3000 Reference Manual (30000-90079) * MPE XL Intrinsics Reference Manual (32650-90028)[REV BEG] * MPE XL Commands Reference Manual (32650-90003) * Account Structure and Security Reference Manual (32650-90041)[REV END] * Native Language Programmer's Guide (32650-90022) * System Startup, Configuration, and Shutdown Reference Manual (32650-90042) * HP Screen Management Intrinsic Library Reference Manual (32424-90002) * HP System Dictionary/XL General Reference Manual (32256-90004) * HP SQL/XL COBOL Application Programming Guide (36216-90006) * Link Editor/XL Reference Manual(32650-90030) * System Debug Reference Manual (32650-90013) * TurboIMAGE/XL Reference Manual (30391-90001)[REV BEG] * Compiler Library/XL Reference Manual (32650-90029) * Trap Handling Programmer's Guide (32650-90026)[REV END] The following book, not available from HP, contains more information about the COBOL functions: * COBOL Functions: An Introduction, by Donald A. Sordillo, published in 1990 by Prentice Hall, Inc. Information on migrating COBOL programs from HP COBOL II/V to HP COBOL II/XL is in the following manual: * HP COBOL II/XL Migration Guide (31500-90004) What's New in This Release[REV BEG] This section briefly describes what is new in this release of HP COBOL II/XL and where to find more information. Addendum to ANSI COBOL'85: Built-In COBOL Functions This version of the HP COBOL II/XL compiler introduces the 42 built-in COBOL functions recently defined by Addendum 1 of the ANSI COBOL'85 standard. Chapter 10 , "COBOL Functions," describes all the functions. Compatibility and the $CONTROL POST85 Option To use the new COBOL functions, you must use the $CONTROL option POST85. This option was added because the COBOL functions introduce a new reserved word, FUNCTION. If your existing COBOL programs use the word FUNCTION as an identifier, those programs will continue to compile without $CONTROL POST85. However, if you want to use the new COBOL functions in a program that uses the word FUNCTION, you must change the word to another word and use $CONTROL POST85. For more information, see Chapter 10 , "COBOL Functions." The TZ Environment Variable Use the TZ environment variable to set the time zone. The COBOL functions CURRENT-DATE and WHEN-COMPILED use the value of this variable and the value of the hardware clock when reporting their results. For more information, see Chapter 10 , "COBOL Functions." HP COBOL II/XL Reference Manual Supplement The HP COBOL II/XL Reference Manual Supplement (31500-90005) is no longer a separate manual. It has been moved into Appendix H of this manual.[REV END] [REV BEG] Previous HP COBOL II/XL Documents Information from the HP COBOL II/XL Technical Addendum, published in April, 1990 for MPE XL Release 2.1 and the HP Communicator article, published for MPE XL Release 3.0 have been incorporated into this manual. These documented the following features: * The $CONTROL NLS option. See Appendix H , "MPE XL System Dependencies," for more information. * Dynamic file assignment with the USING phrase of the ASSIGN clause. See the "ASSIGN Clause" in chapter 6 for more information. * An additional position in the COBRUNTIME variable for handling run-time errors. See Appendix H , "MPE XL System Dependencies" for more information. * The RETURN-CODE special register. See Chapter 11 "Interprogram Communication" for more information. Appendix G, "Summary of COBOL II Syntax," in the previous edition of this manual was duplicated in the HP COBOL II/XL Quick Reference Guide. It has been removed. See the Quick Reference Guide for this information. Appendix H, "HPTOOLSET Program Development System," in the previous edition of this manual has been moved to the HP COBOL II/XL Programmer's Guide.[REV END] Acknowledgement At the request of the American National Standards Institute (ANSI), the following acknowledgement is reproduced in its entirety: Any organization interested in reproducing the COBOL standard and specifications in whole or in part, using ideas from this document as the basis for an instruction manual or for any other purpose, is free to do so. However, all such organizations are requested to reproduce the following acknowledgement paragraphs in their entirety as part of the preface to any such publication (any organization using a short passage from this document, such as in a book review, is requested to mention "COBOL" in acknowledgement of the source, but need not quote the 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 Programming Language Committee as to the accuracy and functioning of the programming system and language. Moreover, no responsibility is assumed by any contributor, or by the committee, in connection therewith. The authors and copyright holders of the copyrighted material used herein have specifically authorized the use of this material in whole or in part, in the COBOL specifications. Such authorization extends to the reproduction and use of COBOL specifications in programming manuals or similar publications. FLOW-MATIC (trademark of Sperry Rand Corporation), Programming for the Univac++ I and II, Data Automation Systems copyrighted 1958, 1959, by Sperry Rand Corporation; IBM Commercial Translator Form No. F 28-8013, copyrighted 1959 by IBM, FACT, DSI 27A5260-2760, copyrighted 1960 by Minneapolis-Honeywell. Conventions Notation Description [REV BEG] Change bars in the margin show where substantial changes have been made to this manual since the last edition.[REV END] (Chapter 10 and Appendix H are new to this manual, but are not marked with change bars.) UPPERCASE and Within syntax statements, characters in uppercase must UNDERLINING be entered in exactly the order shown. Uppercase words that are underlined are keywords that are always required when the clause or statement in which they appear is used in your program. Uppercase words that are not underlined are optional, and may be included or omitted. They have no effect on program execution and serve only to make source program listings more readable. The following example illustrates this: [FILE STATUS IS stat-item]. STATUS must be entered, FILE may be either included or omitted. See also "Underlining in dialog" on the following page. italics Within syntax statements, a word in italics represents a formal parameter, argument, or literal that you must replace with an actual value. In the following example, you must replace filename with the name of the file you want to release: RELEASE filename punctuation Within syntax statements, punctuation characters (other than brackets, braces, vertical parallel lines, and ellipses) must be entered exactly as shown. { } Within syntax statements, when several elements within braces are stacked, you must select one. In the following equivalent examples, you select ON or OFF: {ON } SETMSG {OFF} SETMSG {ON } {OFF} {| |} Within syntax statements, bars in braces are choice indicators. One or more of the items within the choice indicators must be specified, but a single option may be specified only once. [ ] Within syntax statements, brackets enclose optional elements. In the following example, brackets around ,TEMP indicate that the parameter and its delimiter are not required: PURGE filename[,TEMP] When several elements within brackets are stacked, you can select any one of the elements or none. In the following equivalent examples, you can select devicename or deviceclass or neither: [devicename] SHOWDEV [deviceclass] SHOWDEV [devicename ] [deviceclass] Underlining in When it is necessary to distinguish user input from dialog computer output, the input is underlined. See also underlining on the previous page. NEW NAME? ALPHA [ ] ... Brackets followed by a horizontal ellipsis indicate either that a previous bracketed element may be repeated zero or more times, or that elements have been omitted from the description. [WITH DUPLICATES] ... The ellipsis shows that the preceding clause may be repeated indefinitely. { } ... Braces followed by a horizontal ellipses indicate either that the item within braces may be repeated one or more times, or that elements have been omitted from the description. _ Within syntax statements, the space symbol _ shows a required blank. In the following example, you must separate modifier and variable with a blank: SET [(modifier)]_(variable); <, >, =, <=, These symbols are used in conditional statements to >=, <> represent the keywords LESS THAN, GREATER THAN, EQUAL TO, LESS THAN OR EQUAL TO, GREATER THAN OR EQUAL TO, and NOT EQUAL TO, respectively. Although these symbols represent keywords, they are not underlined. ; The semicolon is used only to improve readability and is always optional. , The comma is used only to improve readability, and is always optional. . The period is a terminator or delimiter that is always required where shown; it must always be entered at the end of every division name, section name, paragraph name, and sentence. ^ The caret is occasionally used in examples to represent an implied decimal point in computer memory. Shading Features that are part of the 1985 ANSI standard are shaded. They are accessible through the ANSI85 entry point. LG200026_198 In some diagrams and tables, a number appears in the lower left corner. This number is for HP control purposes only and should not be interpreted as part of the diagram or table.


MPE/iX 5.0 Documentation