Technical Standard COBOL Language - The Open Group

Transcription

Technical StandardNICALHSTANDARDT ECCOBOL Language

[This page intentionally left blank]

X/Open CAE SpecificationCOBOL LanguageX/Open Company, Ltd.

December 1991, X/Open Company LimitedAll rights reserved. No part of this publication may be reproduced, stored in a retrievalsystem, or transmitted, in any form or by any means, electronic, mechanical,photocopying, recording or otherwise, without the prior permission of the copyrightowners.X/Open CAE SpecificationCOBOL LanguageISBN:X/Open Document Number:1 872630 09 XXO/CAE/91/200Set in Palatino by X/Open Company Ltd., U.K.Printed by Maple Press, U.K.Published by X/Open Company Ltd., U.K.Any comments relating to the material contained in this document may be submitted toX/Open at:X/Open Company LimitedApex PlazaForbury RoadReadingBerkshire, RG1 1AXUnited Kingdomor by Electronic Mail to:XoSpecs@xopen.co.ukPage : iiX/Open CAE Specification (1991)COBOL Language

ContentsCOBOL LANGUAGEChapterChapter1INTRODUCTION1.1THE X/OPEN COBOL DEFINITION1.2HISTORY OF THIS DOCUMENT1.31.3.11.3.2FORMAT OF ENTRIES2COBOL DEFINITION2.1GENERAL FORMAT FOR A SEQUENCE OFSOURCE PROGRAMS2.22.2.1GENERAL FORMAT FOR NESTED SOURCE PROGRAMS2.3GENERAL FORMAT FOR IDENTIFICATION DIVISION2.4GENERAL FORMAT FOR ENVIRONMENT DIVISION2.5GENERAL FORMAT FOR SOURCE-COMPUTER-ENTRY2.6GENERAL FORMAT FOR OBJECT-COMPUTER-ENTRY2.7GENERAL FORMAT FOR ENERAL FORMAT FOR FILE-CONTROL-ENTRY2.9GENERAL FORMAT FOR SAME-AREA-ENTRY2.10GENERAL FORMAT FOR DATA DIVISION2.112.11.12.11.22.11.3GENERAL FORMAT FOR L FORMAT FOR DATA DESCRIPTION ENTRYX/Open CAE Specification (1991)COBOL LanguageTypographical ial FileLine Sequential FileRelative FileIndexed FileSort or Merge FileSequential or Line Sequential FileRelative or Indexed FileSort or Merge FileFormat 1Format 2Format 3Page : iii

Contents2.132.13.12.13.22.13.3GENERAL FORMAT FOR SCREEN-DESCRIPTION-ENTRY2.142.14.12.14.2GENERAL FORMAT FOR PROCEDURE DIVISION2.15GENERAL FORMAT FOR ACCEPT STATEMENT2.16GENERAL FORMAT FOR ADD STATEMENT2.17GENERAL FORMAT FOR CALL STATEMENT2.18GENERAL FORMAT FOR CANCEL STATEMENT2.192.19.12.19.2GENERAL FORMAT FOR CLOSE STATEMENT2.20GENERAL FORMAT FOR COMPUTE STATEMENT2.21GENERAL FORMAT FOR CONTINUE STATEMENT2.22GENERAL FORMAT FOR COPY STATEMENT2.23GENERAL FORMAT FOR DELETE STATEMENT2.24GENERAL FORMAT FOR DISPLAY STATEMENT2.25GENERAL FORMAT FOR DIVIDE STATEMENT2.26GENERAL FORMAT FOR EVALUATE STATEMENT2.27GENERAL FORMAT FOR EXIT STATEMENT2.28GENERAL FORMAT FOR GO TO STATEMENT2.29GENERAL FORMAT FOR IF STATEMENT2.30GENERAL FORMAT FOR INITIALIZE STATEMENT2.31GENERAL FORMAT FOR INSPECT STATEMENT2.32GENERAL FORMAT FOR MERGE STATEMENT2.33GENERAL FORMAT FOR MOVE STATEMENT2.34GENERAL FORMAT FOR MULTIPLY STATEMENT2.352.35.12.35.2GENERAL FORMAT FOR OPEN STATEMENT2.36GENERAL FORMAT FOR PERFORM STATEMENT2.372.37.1GENERAL FORMAT FOR READ STATEMENT2.37.2Page : ivFormat 1Format 2Format 3Format 1Format 2Sequential or Line Sequential FileRelative or Indexed FileSequential or Line Sequential FileRelative or Indexed FileSequential, Line Sequential, Relative or IndexedFileRelative FileX/Open CAE Specification (1991)COBOL Language

ContentsChapter2.37.3Indexed File2.38GENERAL FORMAT FOR RELEASE STATEMENT2.39GENERAL FORMAT FOR REPLACE STATEMENT2.40GENERAL FORMAT FOR RETURN STATEMENT2.412.41.12.41.2GENERAL FORMAT FOR REWRITE STATEMENT2.42GENERAL FORMAT FOR SEARCH STATEMENT2.43GENERAL FORMAT FOR SET STATEMENT2.44GENERAL FORMAT FOR SORT STATEMENT2.45GENERAL FORMAT FOR START STATEMENT2.46GENERAL FORMAT FOR STOP STATEMENT2.47GENERAL FORMAT FOR STRING STATEMENT2.48GENERAL FORMAT FOR SUBTRACT STATEMENT2.49GENERAL FORMAT FOR UNLOCK STATEMENT2.50GENERAL FORMAT FOR UNSTRING STATEMENT2.51GENERAL FORMAT FOR USE STATEMENT2.522.52.12.52.2GENERAL FORMAT FOR WRITE .53.72.53.8GENERAL FORMAT FOR CONDITIONS2.54GENERAL FORMAT FOR CONCATENATION-EXPRESSION2.55GENERAL FORMAT FOR QUALIFICATION2.562.56.12.56.2GENERAL FORMAT FOR IDENTIFIER2.57GENERAL FORMAT FOR INTRINSIC FUNCTIONS3DEFINITION OF EXTENSIONS3.1INTRODUCTIONX/Open CAE Specification (1991)COBOL LanguageSequential FileRelative or Indexed FileSequential or Line Sequential FileRelative or Indexed FileRelation ConditionClass ConditionSign ConditionCondition-Name ConditionSwitch-Status ConditionNegated ConditionCombined ConditionAbbreviated Combined ConditionSubscriptReference-ModifierPage : v

ContentsChapterPage : vi3.2NUMERIC DATA TYPES AND REPRESENTATIONS3.3LINE SEQUENTIAL I-O3.4PASSING PARAMETERS BY VALUE3.5SPECIAL REGISTER RETURN-CODE3.6EBCDIC CHARACTER CODE SET3.7CONCATENATION EXPRESSIONS3.83.8.13.8.23.8.33.8.43.8.5FREE FORM REFERENCE FORMAT4SCREEN HANDLING MODULE4.1INTRODUCTION4.24.2.1ENVIRONMENT DIVISIONThe SPECIAL-NAMES A DIVISIONThe Screen SectionThe Screen Description EntryThe AUTO ClauseThe BACKGROUND-COLOR ClauseThe BELL ClauseThe BLANK ClauseThe BLANK WHEN ZERO ClauseThe BLINK ClauseThe COLUMN ClauseThe ERASE ClauseThe FOREGROUND-COLOR ClauseThe FULL ClauseThe HIGHLIGHT ClauseThe JUSTIFIED ClauseThe LINE ClauseThe LOWLIGHT ClauseThe PICTURE ClauseThe REQUIRED ClauseThe REVERSE-VIDEO ClauseThe SECURE ClauseThe SIGN ClauseThe UNDERLINE ClauseThe USAGE ClauseThe VALUE Clause4.44.4.1PROCEDURE DIVISIONThe ACCEPT StatementGeneral DescriptionContinuation of LinesComment LinesDebugging LinesRestrictionsX/Open CAE Specification (1991)COBOL Language

ContentsChapterChapterChapter4.4.2The DISPLAY Statement5FILE SHARING AND RECORD LOCKING5.1INTRODUCTION5.2CONCEPTS AT FILE LEVEL5.35.3.15.3.2CONCEPTS AT RECORD LEVEL5.4DEFAULT FILE LOCKS5.5I-O STATUS5.65.6.1ENVIRONMENT 8PROCEDURE DIVISIONThe CLOSE StatementThe DELETE StatementThe OPEN StatementThe READ StatementThe REWRITE StatementThe START StatementThe UNLOCK StatementThe WRITE 2.16.2.2SINGLE-BYTE INTERNATIONALISATION SUPPORT6.36.3.16.3.2NATIONAL-CHARACTER SUPPORTSingle, Automatic Record LockingMultiple Record LockingThe File Control EntrySyntax ConsiderationsSemantic ter Support in a COBOL SourceProgramReference FormatsNational-character Support in COBOL Operations7PORTABILITY ISSUES7.17.1.17.1.27.1.3RESTRICTIONS FOR PORTABLE PROGRAMS7.2EXCLUSIONS7.37.3.1OBSOLETE ELEMENTSX/Open CAE Specification (1991)COBOL LanguageArithmetic ExpressionsMemory AllocationIntrinsic FunctionsContinuation Using the HyphenPage : vii

ContentsChapterAppendixPage : viii7.4LIMITS8COBOL IN AN X/OPEN ENVIRONMENT8.1INTRODUCTION8.2FILES8.3FILE ASSIGNMENT AND REASSIGNMENT8.4SPECIAL FILES8.5ERROR REPORTING8.6ACCESS TO COMMAND LINE ARGUMENTS ANDENVIRONMENT VARIABLES8.7CALLING OTHER LANGUAGES8.8COBOL DATA TYPES8.9RETURN CODE8.10EXTERNAL NAMES AND CASE CONVENTIONS8.11COPY LIBRARY LOCATIONAFUTURE DIRECTIONSA.1FILE SHARING AND RECORD LOCKINGA.2FREE FORM REFERENCE FORMATA.3INTERNATIONALISATIONX/Open CAE Specification (1991)COBOL Language

PrefaceThis DocumentThis document is a CAE Specification (see above). It provides the X/Open definition ofthe COBOL Language, which is that set of COBOL language facilities that programmersshould follow when using COBOL compilers on X/Open-compliant systems.The X/Open definition is based on the International Standard ISO 1989:1985Programming Languages - COBOL (endorsement of ANSI Standard X3.23-1985). Itcontains all the required modules of the high level of Standard COBOL as well as the ISO1989/Amendment 1 Intrinsic Function Module (endorsement of ANSI Standard X3.23a1989). However, it contains none of the other optional modules of Standard COBOL. Asseveral language items in ISO 1989:1985 are marked as obsolete, and will be removed inthe next revision of Standard COBOL, these language items are not part of the X/Opendefinition.This X/Open specification contains language enhancements that supplement StandardCOBOL: the specification of a Screen Section and its use in ACCEPT and DISPLAY verbs formore complete interaction with the on-line user language extensions that allow sharing of files and locking of files and records a method to allow COBOL applications to use some of the internationalisationfacilities defined in the X/Open Basic Definitions specification (see ReferencedDocuments) language extensions that enable multi-byte data to be handled in COBOL applicationsX/Open CAE Specification (1991)COBOL LanguagePage : ix

PrefacePage : xX/Open CAE Specification (1991)COBOL Language

TrademarksX/Open and the ‘X’ device are trademarks of X/Open Company Limited in the U.K. andother countries.UNIX is a registered trademark of UNIX System Laboratories Inc. in the U.S.A. and othercountries.Palatino is a trademark of Linotype AG and/or its subsidiaries.X/Open CAE Specification (1991)COBOL LanguagePage : xi

AcknowledgementsX/Open gratefully acknowledges the assistance given by the following companies in thepreparation of the COBOL definition: Liant Software Corporation Micro Focus Ltd.COBOL is an industry language and is not the property of any company or group ofcompanies, or of any organisation or group of organisations.No warranty, expressed or implied, is made by any contributor, or by the CODASYLCOBOL Committee, as to the accuracy and functioning of the programming system andlanguage. Moreover, no responsibility is assumed by any contributor, or by thecommittee, in connection therewith.The authors and copyright holders of the copyrighted materials used herein: FLOW-MATIC(trademark of Sperry Rand Corporation), Programming for the UNIVAC(R) I and II, Data Automation Systems, copyrighted 1958, 1959 by Sperry RandCorporation IBM CommercialTranslater Form No. F28-8013, copyrighted 1959 by IBM FACT, DSI 27A5260-2760, copyrighted 1960by Minneapolis-Honeywellhave specially authorised the use of this material, in whole or in part, in the COBOLspecifications. Such authorisation extends to the reproduction and use of COBOLspecifications in programming manuals or similar publications.Page : xiiX/Open CAE Specification (1991)COBOL Language

Referenced DocumentsThe following documents are referenced in this specification: Basic Definitions, Snapshot, X/Open Company Ltd., November 1991 (expected to besuperseded by the CAE Specification, 1992) CODASYL COBOL Journal of Development, 1988 Code of Japanese Graphic Character Set for Information Interchange (JIS KANJIFUGOUKEI, JIS X0208-1983) Indexed Sequential Access Method (ISAM), Developers’ Specification, X/OpenCompany Ltd., 1990 (re-categorised as a CAE Specification) ISO1989:1985 Programming Languages - COBOL (endorsement of ANSI StandardX3.23-1985) ISO1989/Amendment 1 Intrinsic Function Module (endorsement of ANSI StandardX3.23a-1989) Multivendor Integration Architecture (MIA), Technical Requirements of theApplication Program Interface Specification for the Programming Language COBOL,Version 1.0, February 1991 Terminal Interfaces, CAE Specification, X/Open Company Ltd., 1992 X/Open C Language definition contained in Programming Languages, CAESpecification, X/Open Company Ltd., 1992 X/Open Portability Guide, Issue 1, 2 and 3X/Open CAE Specification (1991)COBOL LanguagePage : xiii

Referenced DocumentsPage : xivX/Open CAE Specification (1991)COBOL Language

Chapter 1Introduction1.1THE X/OPEN COBOL DEFINITIONThe X/Open COBOL definition identifies a common set of language facilities thatprogrammers should follow when using COBOL compilers on X/Open-compliantsystems.The X/Open definition is based on the International Standard ISO 1989:1985Programming Languages - COBOL (endorsement of ANSI Standard X3.23-1985). Itcontains all the required modules of the high level of Standard COBOL as well as the ISO1989/Amendment 1 Intrinsic Function Module (endorsement of ANSI Standard X3.23a1989). Both standards are commonly referred to as ‘‘Standard COBOL’’ throughout thisspecification. However, it contains none of the other optional modules of StandardCOBOL. As several language items in ISO 1989:1985 are marked as obsolete, and will beremoved in the next revision of Standard COBOL, these language items are not part of theX/Open definition. Although implementations are required to support these features,application writers should avoid using them.Standard COBOL is incomplete in the area of facilities for interaction with the on-lineuser. This X/Open specification defines a Screen Section and its use in ACCEPT andDISPLAY verbs, as this is the most common language realisation among COBOLcompilers. Standard COBOL does not define facilities for efficient and consistent filesharing in a multi-user environment. This X/Open specification defines languageextensions that allow sharing of files and locking of files and records. This X/Openspecification furthermore defines a method to allow COBOL applications to use theinternationalisation facilities defined in the X/Open Basic Definitions specification (seeReferenced Documents). Finally enhancements to the COBOL language are defined thatenable multi-byte data to be handled in COBOL applications.As X/Open specifies more or less a common subset of the languages of various compilerproducts, there are extensions supported on specific X/Open-compliant systems that arenot included in the X/Open definition. Also the means of implementation acrossX/Open-compliant systems may vary.For certain elements in the implementor-defined element list in Standard COBOL,X/Open defines a standard implementation across all X/Open-compliant systems.Where this has been done, the clause is annotated in the syntax definition.The X/Open COBOL definition is given in Chapter 2, COBOL Definition. It is derivedfrom the Syntax Summary of Standard COBOL plus extensions taken from commonimplementations. The semantics of the language are those of Standard COBOL. In thegeneral formats the facilities that are additional to Standard COBOL, and included in theX/Open definition, are indicated by shading. With the exception of those extensions thatare fully defined by their syntax, a full definition of their semantics is contained inChapter 3, Definition of Extensions. The major extensions mentioned above arecontained in Chapter 4, Screen Handling Module, Chapter 5, File Sharing and RecordLocking and Chapter 6, Internationalisation.X/Open CAE Specification (1991)COBOL LanguagePage : 1

The X/Open COBOL DefinitionIntroductionChapter 7, Portability Issues summarises the functions in Standard COBOL that are notto be used in a conforming X/Open COBOL source program. These are described inrelation to the ‘‘modules’’ defined in Standard COBOL. This information is included toallow those familiar with Standard COBOL to obtain a quick appreciation of the X/Opendefinition.Chapter 8, COBOL in an X/Open Environment addresses the special characteristics ofX/Open-compliant systems and the effects these have on the functionality of COBOLcompilers, with recommended techniques for ensuring the maximum portability ofCOBOL programs between X/Open-compliant implementations.A conforming implementation of X/Open COBOL shall fully support any of the threesubsets of ISO 1989:1985 (including ISO 1989/Amendment 1), and additionally thestandard extensions defined in Chapter 3, Definition of Extensions, Chapter 4, ScreenHandling Module, Chapter 5, File Sharing and Record Locking, Chapter 6,Internationalisation and Chapter 8, COBOL in an X/Open Environment. Elements ofthe implementor-defined element list in Standard COBOL that are defined by X/Openhave to be supported in the X/Open way. However, X/Open-compliantimplementations only need to provide support for handling of multi-byte character sets ifthe environment provides support for it. Elements of Standard COBOL that are notmentioned shall be supported by a conforming implementation, but are not guaranteedto be portable.A conforming X/Open COBOL source program is a program that only uses languagefeatures of the high subset of Standard COBOL (including ISO 1989/Amendment 1) orthose defined in Chapter 3, Definition of Extensions, Chapter 4, Screen HandlingModule, Chapter 5, File Sharing and Record Locking and Chapter 6,Internationalisation, and does not use language features of Chapter 7, PortabilityIssues. However, the obsolete language features specified in this chapter are permittedin conforming source programs. Where, in Chapter 8, COBOL in an X/OpenEnvironment, further definitions are made concerning the X/Open environment orelements in the implementor-defined element list, the program should conform to these.However, X/Open-compliant applications should not use internationalisation support ormulti-byte character facilities if the environment does not provide support for it.Page : 2X/Open CAE Specification (1991)COBOL Language

Introduction1.2History of this DocumentHISTORY OF THIS DOCUMENTThe X/Open Portability Guide, Issue 1 and Issue 2 are based on the ANSI StandardX3.23-1974 with extensions for interaction with the on-line user. The X/Open PortabilityGuide, Issue 3 is based on ISO 1989:1985 Programming Languages - COBOL(endorsement of ANSI Standard X3.23-1985) with a changed extension for interactionwith the on-line user. In addition, other minor extensions to Standard COBOL aredefined.This specification continues alignment with Standard COBOL by including the ISO1989/Amendment 1 Intrinsic Function Module (endorsement of ANSI Standard X3.23a1989). Moreover, it contains the following additional extensions: file sharing and record locking (replacing the implementation-dependent optiondefined in the X/Open Portability Guide, Issue 3) support for internationalisation facilities support for multi-byte character sets free form reference format (in order to facilitate handling of multi-byte character sets) concatenation of nonnumeric and national-character literals (in order to facilitatehandling of multi-byte character sets) passing parameters by value (in order to facilitate interaction with other componentsof the Common Applications Environment (CAE))In this CAE Specification, the continuation of COBOL words, PICTURE character stringsand literals is an obsolete element because it will be deleted in a future edition, i.e.,application writers should avoid using this feature.X/Open CAE Specification (1991)COBOL LanguagePage : 3

Format of Entries1.3IntroductionFORMAT OF ENTRIESThe clauses and statements described in Chapter 3, Definition of Extensions, Chapter 4,Screen Handling Module, Chapter 5, File Sharing and Record Locking, Chapter 6,Internationalisation and Chapter 8, COBOL in an X/Open Environment are based on acommon format, aligned with that of Standard COBOL.FunctionStates briefly the purpose of the clause or statement.General Format Summarises the use of the clause or statement being described. It isthe specific arrangement of its elements. When more than one specificarrangement is permitted that need to be referred to specifically, thegeneral format is separated into numbered formats.Syntax RulesDefines or clarifies the order in which words or elements are arrangedto form larger elements such as phrases, clauses or statements. Syntaxrules may also either impose restrictions on individual words orelements, or relax restrictions implied by words, elements or StandardCOBOL.These rules are used to define or clarify how the statement must bewritten, i.e., the order of the elements of the statement and therestrictions or amplifications of what each element may represent.General RulesDefines or clarifies the meaning, or relationship of meanings, of anelement or set of elements. It is used to define or clarify the semanticsof the statement, and the effect that it has on either execution orcompilation.ExamplesGives examples of usage, where appropriate.Application UsageGives warnings and advice to application writers about the clause orstatement.The formal description consists only of Function, General Format, Syntax Rules andGeneral Rules sections.1.3.1Typographical ConventionsThe General Formats use Standard COBOL notation to define the language syntax.Upper caseCOBOL language keywords and implementation-dependent nameswhich are defined by X/Open. Those underlined must be present ifthe clause is present; those not underlined are optional words, whichmay be included to improve readability but are otherwise notprocessed by the compiler.Lower caseGeneric terms which represent substitutable arguments, for example,data-names and literal values.Square brackets Used to enclose optional alternatives; any clause not so enclosed ismandatory. One or none of the alternatives enclosed within the squarebrackets may be selected. Square brackets may also be used togetherwith ellipses to delimit a repeatable construct.Page : 4X/Open CAE Specification (1991)COBOL Language

IntroductionFormat of EntriesBracesUsed to enclose alternatives. One of the alternatives enclosed withinthe braces must be used. Braces may also be used together withellipses to delimit a repeatable construct.EllipsesThe preceding element may be repeated a number of times. Theremust be at least one occurrence, unless the element is optional(enclosed in square brackets).Choice indicators { and }Used to enclose alternatives. One or more of the unique optionscontained within the choice indicators must be used, but a singleoption may be specified only once.Shaded areasAreas where the X/Open definition extends or clarifies StandardCOBOL.The reason for the shading is indicated in the right margin by:1.3.2Eextension included in the definitionIan element which is in the implementor-defined element list inStandard COBOL, but which is defined by X/OpenTerminologyThe following terms are used in this specification:implementation-dependentThe feature is not consistent across all implementations, and eachimplementation shall provide documentation of its behaviour.Implementation-dependent elements shall conform to the rules set byStandard COBOL.mayWith respect to implementations, the feature is optional. Applicationsshould not rely on its existence.With respect to applications, the word is used to give guidelines forrecommended practice if the described functionality is desired in theapplication. These guidelines should be followed if maximumportability is desired.mustThe rule must be obeyed by conforming applications.shouldWith respect to implementations, the feature is recommended, but it isnot a mandatory requirement. Applications should not rely on theexistence of the feature.With respect to applications, the word is used to give guidelines forrecommended practice. These guidelines should be followed ifmaximum portability is desired.undefinedX/Open CAE Specification (1991)COBOL LanguageA feature is undefined if this specification imposes no portabilityrequirements on applications for erroneous program constructs orerroneous data. Implementations may specify the result of using thefeature, but such specifications are not guaranteed to be consistentacross all implementations. However, undefined elements shallPage : 5

Format of EntriesIntroductionconform to the rules set by Standard COBOL.Page : 6unspecifiedA feature is unspecified if this specification imposes no portabilityrequirements on applications for correct program constructs or correctdata. Implementations may specify the result of using the feature, butsuch specifications are not guaranteed to be consistent across allimplementations. However, unspecified elements shall conform to therules set by Standard COBOL.shallThe feature must be implemented and applications can rely on itsexistence.X/Open CAE Specification (1991)COBOL Language

Chapter 2COBOL DefinitionThe definition is derived from Section V (Composite Language Skeleton) of ISO1989:1985, together with the changes to this section from ISO 1989/Amendment 1(Changes to Standard COBOL).X/Open CAE Specification (1991)COBOL LanguagePage : 7

Sequence of Source Programs2.1COBOL DefinitionGENERAL FORMAT FOR A SEQUENCE OF SOURCE PROGRAMS{ IDENTIFICATION DIVISION .PROGRAM-ID . program-name-1 [ IS INITIAL PROGRAM ] .[ ENVIRONMENT DIVISION . [ environment-division-content ] ][ DATA DIVISION . [ data-division-content ] ][ PROCEDURE DIVISION . procedure-division-content ][ nested-source-program ] . . .END PROGRAM program-name-1 . } . . .IDENTIFICATION DIVISION .PROGRAM-ID . program-name-2 [ IS INITIAL PROGRAM ] .[ ENVIRONMENT DIVISION . [ environment-division-content ] ][ DATA DIVISION . [ data-division-content ] ][ PROCEDURE DIVISION . procedure-division-content ][ [ nested-source-program ] . . .END PROGRAM program-name-2 . ]Page : 8X/Open CAE Specification (1991)COBOL Language

COBOL Definition2.2Nested Source ProgramsGENERAL FORMAT FOR NESTED SOURCE PROGRAMSIDENTIFICATION DIVISION .PROGRAM-ID . program-name-1 [ IS INITIAL PROGRAM ] .[ ENVIRONMENT DIVISION . [ environment-division-content ] ][ DATA DIVISION . [ data-division-content ] ][ PROCEDURE DIVISION . procedure-division-content ][ [ nested-source-program ] . . .END PROGRAM program-name-1 . ]2.2.1Nested-Source-ProgramIDENTIFICATION DIVISION .PROGRAM-ID . program-name-1 IS COMMONINITIAL PROGRAM .[ ENVIRONMENT DIVISION . [ environment-division-content ] ][ DATA DIVISION . [ data-division-content ] ][ PROCEDURE DIVISION . procedure-division-content ][ nested-source-program ] . . .END PROGRAM program-name-1 .X/Open CAE Specification (1991)COBOL LanguagePage : 9

Identification Division2.3COBOL DefinitionGENERAL FORMAT FOR IDENTIFICATION DIVISIONIDENTIFICATION DIVISION .PROGRAM-ID . program-name-1Page : 10 IS COMMONINITIAL PROGRAM .X/Open CAE Specification (1991)COBOL Language

COBOL Definition2.4Environment DivisionGENERAL FORMAT FOR ENVIRONMENT DIVISIONENVIRONMENT DIVISION .[ CONFIGURATION SECTION .[ SOURCE-COMPUTER . [ source-computer-entry ] ][ OBJECT-COMPUTER . [ object-computer-entry ] ][ SPECIAL-NAMES . [ special-names-contents ] ] ][ INPUT-OUTPUT SECTION .FILE-CONTROL . { file-control-entry } . . .[ I-O-CONTROL . [ same-area-entry ] ] ]X/Open CAE Specification (1991)COBOL LanguagePage : 11

Source-Computer-Entry2.5COBOL DefinitionGENERAL FORMAT FOR SOURCE-COMPUTER-ENTRYcomputer-name-1 [ WITH DEBUGGING MODE ] .Page : 12X/Open CAE Specification (1991)COBOL Language

COBOL Definition2.6Object-Computer-EntryGENERAL FORMAT FOR OBJECT-COMPUTER-ENTRYcomputer-name-1 [ PROGRAM COLLATING SEQUENCE IS alphabet-name-1 ] .X/Open CAE Specification (1991)COBOL LanguagePage : 13

Special-Names-Content2.7COBOL DefinitionGENERAL FORMAT FOR SPECIAL-NAMES-CONTENT SYSIN ENVIRONMENT-NAMEENVIRONMENT-VALUESWITCH-8 IS mnemonic-name-1 .I[ IS mnemonic-name-2 ]I ON STATUS IS condition-name-1OFF STATUS IS condition-name-2 . [ ALPHABET alphabet-name-1 IS STANDARD-1STANDARD-2NATIVEEBCDIC literal-1 THROUGHTHRU literal-2{ ALSO literal-3 } . . . .I[ SYMBOLIC CHARACTERS { symbolic-character-1 } . . . ISARE { integer-1 } . . . .[ IN alphabet-name-2 ] ] . . .(continued overleaf)Page : 14X/Open CAE Specification (1991)COBOL Language

COBOL DefinitionSpecial-Names-ContentGeneral Format for Special-Names-Content (continued) CLASS class-name-1 IS literal-4 THROUGHTHRU literal-5 . . [ CURRENCY SIGN IS literal-6 ][ DECIMAL-POINT IS COMMA ][ CURSOR IS data-name-1 ]E[ CRT STATUS IS data-name-2 ] .EX/Open CAE Specification (1991)COBOL LanguagePage : 15

File-Control-EntryCOBOL Definition2.8GENERAL FORMAT FOR FILE-CONTROL-ENTRY2.8.1Sequential FileSELECT [ OPTIONAL ] file-name-1ASSIGN TO DISKPRINTERliteral-1data-name-1 IE[ [ ORGANIZATION IS ] SEQUENTIAL ][ ACCESS MODE IS SEQUENTIAL ] LOCK MODE IS AUTOMATIC [ WITH LOCK ON RECORD ]EXCLUSIVE E[ FILE STATUS IS data-name-2 ] .2.8.2Line Sequential FileSELECT [ OPTIONAL ] file-name-1ASSIGN TO DISKliteral-1data-name-1 [ ORGANIZATION IS ] LINE SEQUENTIALE[ ACCESS MODE IS SEQUENTIAL ] LOCK MODE IS AUTOMATIC [ WITH LOCK ON RECORD ]EXCLUSIVE [ FILE STATUS IS data-name-2 ] .Page : 16X/Open CAE Specification (1991)COBOL Language

COBOL Definition2.8.3File-Control-EntryRelative FileSELECT [ OPTIONAL ] file-name-1ASSIGN TO DISKliteral-1data-name-3 IE[ ORGANIZATION IS ] RELATIVE ACCESS LOCK MODE ISMODE IS SEQUENTIAL [ RELATIVE KEY IS data-name-1 ] RANDOMDYNAMIC RELATIVE KEY IS data-name-1MANUAL WITH LOCK ON MULTIPLE RECORDSAUTOMATIC [ WITH LOCK ON RECORD ]EXCLUSIVE E[ FILE STATUS IS data-name-2 ] .2.8.4Indexed FileSELECT [ OPTIONAL ] file-name-1ASSIGN TO DISKliteral-1data-name-4 IE[ ORGANIZATION IS ] INDEXED ACCESS MODE IS SEQUENTIALRANDOMDYNAMIC RECORD KEY IS data-name-1[ ALTERNATE RECORD KEY IS data-name-2 [ WITH DUPLICATES ] ] . . . LOCK MODE IS MANUAL WITH LOCK ON MULTIPLE RECORDSAUTOMATIC [ WITH LOCK ON RECORD ]EXCLUSIVE E[ FILE STATUS IS data-name-3 ] .X/Open CAE Specification (1991)COBOL LanguagePage : 17

File-Control-Entry2.8.5COBOL DefinitionSort or Merge FileSELECT file-name-1ASSIGN TOPage : 18 DISKliteral-1data-name-1 I.EX/Open CAE Specification (1991)COBOL Language

COBOL Definition2.9Same-Area-EntryGENERAL FORMAT FOR SAME-AREA-ENTRY SAME RECORDSORTSORT-MERGEX/Open CAE Specification (

Preface This Document This document is a CAE Specification (see above). It provides the X/Open definition of the COBOL Language, which is that set of COBOL language facilities that programmers should follow when using COBOL compilers on X/Open-compliant systems. The X/Open definition is based on the International Standard ISO 1989:1985 Programming Languages - COBOL (endorsement of ANSI .