Date post: | 25-Nov-2015 |
Category: |
Documents |
Upload: | rgarcp2348 |
View: | 137 times |
Download: | 4 times |
iSeriesWebSphere Development Studio:ILE COBOL Reference SummaryVersion 5
SX09-1317-02
iSeriesWebSphere Development Studio:ILE COBOL Reference SummaryVersion 5
SX09-1317-02
Note!Before using this information and the product it supports, be sure to read the general informationunder Notices on page 137.
Third Edition (May 2001)
This edition applies to Version 5, Release 1, Modification Level 0, of IBM WebSphere Development Studio for iSeries(5722-WDS), ILE COBOL compiler, and to all subsequent releases and modifications until otherwise indicated innew editions.
Changes or additions to the text and illustrations are indicated by a vertical line to the left of the change oraddition.
Order publications through your IBM representative or the IBM branch office serving your locality. Publications arenot stocked at the address given below.
IBM welcomes your comments. You can send your comments to:
IBM Canada Ltd. LaboratoryInformation Development2G/KB7/1150/TOR1150 Eglinton Avenue EastNorth York, Ontario, Canada M3C 1H7
You can also send your comments by facsimile (attention: RCF Coordinator), or you can send your commentselectronically to IBM. See How to Send Your Comments for a description of the methods.
When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in anyway it believes appropriate without incurring any obligation to you.
Copyright International Business Machines Corporation 1993, 2001. All rights reserved.US Government Users Restricted Rights Use, duplication or disclosure restricted by GSA ADP Schedule Contractwith IBM Corp.
ContentsAbout This Summary . . . . . . . . . vWho Should Use This Summary . . . . . . . . vPrerequisite and Related Information . . . . . . v
ILE COBOL Syntax Notation . . . . . vii
How to Read the Syntax Diagrams . . . ix
IBM Extensions. . . . . . . . . . . xiii
Documentary Syntax. . . . . . . . . xv
CL Entry Codes . . . . . . . . . . xvii
Industry Standard. . . . . . . . . . xix
Chapter 1. Creating Module andProgram Objects . . . . . . . . . . . 1CRTCBLMOD Command Syntax . . . . . . . 1CRTBNDCBL Command Syntax . . . . . . . . 4PROCESS Statement . . . . . . . . . . . . 8
Chapter 2. COBOL SourceProgramGeneral Structure . . . . . 15
Chapter 3. Identification Division . . . 17
Chapter 4. Environment Division . . . 19Configuration Section . . . . . . . . . . . 20
SOURCE-COMPUTER Paragraph . . . . . . 20OBJECT-COMPUTER Paragraph . . . . . . 20SPECIAL-NAMES Paragraph . . . . . . . 20
Input-Output Section . . . . . . . . . . . 25FILE-CONTROL Paragraph . . . . . . . . 25I-O-CONTROL Paragraph . . . . . . . . 29
Chapter 5. Data Division . . . . . . . 33File Section . . . . . . . . . . . . . . 33Working-Storage Section . . . . . . . . . . 40Linkage Section . . . . . . . . . . . . . 45
Chapter 6. Procedure Division. . . . . 47Procedure Division Statements . . . . . . . . 49
ACCEPT Statement . . . . . . . . . . . 49ACQUIRE Statement . . . . . . . . . . 53ADD Statement . . . . . . . . . . . . 53ALTER Statement . . . . . . . . . . . 54CALL Statement . . . . . . . . . . . . 54CANCEL Statement . . . . . . . . . . 58CLOSE Statement . . . . . . . . . . . 59COMMIT Statement . . . . . . . . . . 59COMPUTE Statement . . . . . . . . . . 59
CONTINUE Statement . . . . . . . . . 60DELETE Statement . . . . . . . . . . . 60DISPLAY Statement . . . . . . . . . . 60DIVIDE Statement . . . . . . . . . . . 63DROP Statement. . . . . . . . . . . . 65ENTER Statement . . . . . . . . . . . 65EVALUATE Statement . . . . . . . . . . 65EXIT Statement . . . . . . . . . . . . 66EXIT PROGRAM Statement . . . . . . . . 66GOBACK Statement . . . . . . . . . . 67GO TO Statement . . . . . . . . . . . 67IF Statement . . . . . . . . . . . . . 67INITIALIZE Statement. . . . . . . . . . 68INSPECT Statement . . . . . . . . . . 68MERGE Statement . . . . . . . . . . . 71MOVE Statement . . . . . . . . . . . 72MULTIPLY Statement . . . . . . . . . . 72OPEN Statement . . . . . . . . . . . 73PERFORM Statement . . . . . . . . . . 74READ Statement . . . . . . . . . . . 75RELEASE Statement . . . . . . . . . . 79RETURN Statement . . . . . . . . . . 80REWRITE Statement . . . . . . . . . . 80ROLLBACK Statement . . . . . . . . . 81SEARCH Statement. . . . . . . . . . . 81SET Statement . . . . . . . . . . . . 82SORT Statement . . . . . . . . . . . . 85START Statement . . . . . . . . . . . 86STOP Statement . . . . . . . . . . . . 87STRING Statement . . . . . . . . . . . 87SUBTRACT Statement . . . . . . . . . . 87UNSTRING Statement . . . . . . . . . . 88WRITE Statement . . . . . . . . . . . 89
Intrinsic Functions . . . . . . . . . . . . 92Function-Identifier . . . . . . . . . . . 93ACOS Function . . . . . . . . . . . . 93ADD-DURATION Function . . . . . . . . 93ASIN Function . . . . . . . . . . . . 93ATAN Function . . . . . . . . . . . . 93CHAR Function . . . . . . . . . . . . 94CONVERT-DATE-TIME Function . . . . . . 94COS Function . . . . . . . . . . . . 94CURRENT-DATE Function . . . . . . . . 94DATE-OF-INTEGER Function . . . . . . . 94DAY-OF-INTEGER Function . . . . . . . . 94DATE-TO-YYYYMMDD Function . . . . . . 95DAY-TO-YYYYDDD Function . . . . . . . 95EXTRACT-DATE-TIME Function . . . . . . 95FIND-DURATION Function . . . . . . . . 95INTEGER-OF-DATE Function . . . . . . . 96INTEGER-OF-DAY Function . . . . . . . . 96LENGTH Function . . . . . . . . . . . 96LOCALE-DATE Function . . . . . . . . . 96LOCALE-TIME Function . . . . . . . . . 96LOG Function . . . . . . . . . . . . 96LOG10 Function . . . . . . . . . . . . 97
Copyright IBM Corp. 1993, 2001 iii
LOWER-CASE Function . . . . . . . . . 97MEAN Function . . . . . . . . . . . . 97NUMVAL Function . . . . . . . . . . . 97NUMVAL-C Function . . . . . . . . . . 98ORD Function . . . . . . . . . . . . 98REVERSE Function . . . . . . . . . . . 98SIN Function . . . . . . . . . . . . . 99SQRT Function . . . . . . . . . . . . 99SUBTRACT-DURATION Function . . . . . . 99TAN Function . . . . . . . . . . . . 99TEST-DATE-TIME Function . . . . . . . . 99UPPER-CASE Function . . . . . . . . . 100WHEN-COMPILED Function . . . . . . . 100YEAR-TO-YYYY Function . . . . . . . . 100
Chapter 7. Conditional Expressions 101
Chapter 8. Qualifying Data ReferenceFormats. . . . . . . . . . . . . . 105Qualification . . . . . . . . . . . . . 105Reference Modification . . . . . . . . . . 106Subscripting . . . . . . . . . . . . . . 107
Chapter 9. Compiler-DirectingStatements . . . . . . . . . . . . 109CONTROL Statement. . . . . . . . . . . 109COPY Statement . . . . . . . . . . . . 109EJECT Statement . . . . . . . . . . . . 111REPLACE Statement . . . . . . . . . . . 111SKIP Statement . . . . . . . . . . . . . 111TITLE Statement . . . . . . . . . . . . 111
USE Statement . . . . . . . . . . . . . 112
Chapter 10. Symbols, Names, andFigurative Constants . . . . . . . . 113Assignment-Names in the ASSIGN Clause. . . . 114Environment-Names in the SPECIAL-NAMESParagraph . . . . . . . . . . . . . . 114Figurative Constants . . . . . . . . . . . 115
Chapter 11. File Structure SupportSummary and Status Key Values . . . 117File Structure Support Tables . . . . . . . . 117File Status Key Values and Meanings . . . . . 122
Chapter 12. ILE COBOLFunction-Name and Context-SensitiveWord List . . . . . . . . . . . . . 129Visual Key . . . . . . . . . . . . . . 129Function-Names . . . . . . . . . . . . 129Context-Sensitive Words. . . . . . . . . . 129
Chapter 13. ILE COBOL ReservedWord List . . . . . . . . . . . . . 131Visual Key . . . . . . . . . . . . . . 131Reserved Words . . . . . . . . . . . . 131
Notices . . . . . . . . . . . . . . 137Programming Interface Information . . . . . . 137Trademarks and Service Marks . . . . . . . 137Acknowledgements . . . . . . . . . . . 138
iv ILE COBOL Reference Summary
About This SummaryThis summary contains all the COBOL statements and related information youmay need to refer to when programming in the Integrated Language Environment(ILE) COBOL language.
Before using this summary, you should have a basic understanding of the ILECOBOL language and of the Operating System/400 (OS/400) operating systemControl Language (CL).
Who Should Use This SummaryThis publication is for programmers familiar with the COBOL language. Thepurpose of this publication is to summarize the formats of the COBOL language asit is used on the ILE COBOL compiler.
In order to use this summary effectively, you should be familiar with the ILECOBOL Programmers Guide and the ILE COBOL Reference. If you need referenceinformation for the Control Language, see the CL and APIs section of theProgramming category in the iSeries 400 Information Center. You should also befamiliar with data management concepts, which are described in the Database andFile Systems category in the iSeries 400 Information Center. The InformationCenter is located at http://www.ibm.com/eserver/iseries/infocenter.
Prerequisite and Related InformationUse the iSeries Information Center as your starting point for looking up iSeries andAS/400e technical information. You can access the Information Center in two ways:v From the following Web site:
http://www.ibm.com/eserver/iseries/infocenter
v From CD-ROMs that ship with your Operating System/400 order:iSeries Information Center, SK3T-4091-00. This package also includes the PDFversions of iSeries manuals, iSeries Information Center: Supplemental Manuals,SK3T-4092-00, which replaces the Softcopy Library CD-ROM.
The iSeries Information Center contains advisors and important topics such as CLcommands, system application programming interfaces (APIs), logical partitions,clustering, Java , TCP/IP, Web serving, and secured networks. It also includeslinks to related IBM Redbooks and Internet links to other IBM Web sites such asthe Technical Studio and the IBM home page.
Copyright IBM Corp. 1993, 2001 v
vi ILE COBOL Reference Summary
ILE COBOL Syntax NotationILE COBOL basic formats are presented in a uniform system of syntax notation.This notation, designed to assist you in writing COBOL source statements, isexplained in the following paragraphs:v COBOL keywords and optional words appear in uppercase letters; for example:
MOVE
They must be spelled exactly as shown. If any keyword is missing, the compilerconsiders it as an error.
v Variables representing user-supplied names or values appear in all lowercaseitalic letters; for example:parmx
v For easier text reference, some words are followed by a hyphen and a digit or aletter, as in:identifier1
This suffix does not change the syntactical definition of the word.v If punctuation marks, parentheses, arithmetic operators, logicaloperators, or such
symbols are shown, they must be entered as part of the syntax.v Arithmetic and logical operators (+, , *, /, **, >,
viii ILE COBOL Reference Summary
How to Read the Syntax DiagramsThroughout this book, syntax is described using the structuredefined below.v Read the syntax diagrams from left to right, from top to bottom, following the
path of the line:
indicates the beginning of a statement.
indicates that the statement syntax is continued on the next line.
indicates that a statement is continued from the previous line.
indicates the end of a statement.
Diagrams of syntactical units other than statements, such as clauses, phrases,and paragraphs, also start with the symbol and end with the symbol.
Note: Statements within a diagram of an entire paragraph will not start with and end with unless their beginning or ending coincides withthat of the paragraph.
v Required items appear on the horizontal line (the main path).
STATEMENT required item
v Optional items appear below the main path.
STATEMENToptional item
v When you can choose from two or more items, they appear vertically, in a stack.If you must choose one of the items, one item of the stack appears on the mainpath.
STATEMENT required-choice-1required-choice-2
If choosing one of the items is optional, the entire stack appears below the mainpath.
STATEMENToptional-choice-1optional-choice-2
v An arrow returning to the left above an item indicates that the item can berepeated.
Copyright IBM Corp. 1993, 2001 ix
STATEMENT repeatable-item
A repeat arrow above a stack of required or optional choices indicates that youcan make more than one choice from the stacked items, or repeat a single choice.
STATEMENT choice-1choice-2
choice-3choice-4
v A syntax fragment is delimited in the main syntax diagram by a set of verticallines. The corresponding definition of the fragment begins with the name of thefragment followed by the syntax, which starts and ends with a vertical line.
STATEMENT fragment
fragment:
syntax items
The following example shows how the syntax is used:
Format
(1)
STATEMENT(2)
identifier-1literal-1
(3)item 1
(4)
TO identifier-mROUNDED
(5)
SIZE ERROR imperative-statement-mON
(6)
END-STATEMENT
x ILE COBOL Reference Summary
item 1:
identifier-2literal-2arithmetic-expression-1
Notes:
1 The STATEMENT key word must be specified and coded as shown.
2 This operand is required. Either identifier-1 or literal-1 must be coded.
3 The item 1 fragment is optional; it can be coded or not, as required by theapplication. If item 1 is coded, it can be repeated with each entry separatedby one or more COBOL separators. Entry selections allowed for this fragmentare described at the bottom of the diagram.
4 The operand identifier-m and associated TO key word are required and canbe repeated with one or more COBOL separators separating each entry. Eachentry can be assigned the key word ROUNDED.
5 The ON SIZE ERROR phrase with associated imperative-statement-m areoptional. If the ON SIZE ERROR phrase is coded, the key word ON isoptional.
6 The END-STATEMENT key word can be coded to end the statement. It is nota required delimiter.
How to Read the Syntax Diagrams xi
xii ILE COBOL Reference Summary
IBM ExtensionsAn IBM extension generally modifies a rule or restriction that immediatelyprecedes it. The standard is presented first, because some programmers use the ILECOBOL language without IBM extensions. The extensions are then presented forthose who do use them.
Clauses and statements illustrated within syntax diagrams that are ILE COBOLlanguage extensions to the American National Standards Institute (ANSI) standardX3.23b-1993, American National Standard for Information Systems - ProgrammingLanguage - COBOL are identified by footnotes.
IBM Extension
ILE COBOL language extensions to ANSI X3.23b-1993 COBOL that are part of thetext description are enclosed in IBM Extension bars, like this paragraph.
End of IBM Extension
Copyright IBM Corp. 1993, 2001 xiii
xiv ILE COBOL Reference Summary
Documentary SyntaxSome COBOL clauses and statements are syntax checked and treated asdocumentation by the ILE COBOL compiler. Such clauses and statements areidentified with a footnote in syntax diagrams.
Copyright IBM Corp. 1993, 2001 xv
xvi ILE COBOL Reference Summary
CL Entry CodesThe code that appears in the upper right corner of each CL syntax diagramcontains the entry codes that specify the environment in which the command canbe entered. The codes indicate whether or not the command can be:v Used in a batch or interactive job (outside a compiled program; Job:B or I)v Used in a batch or interactive compiled program (Pgm:B or I)v Used in a batch or interactive REXX procedure (REXX:B or I)v Used as a parameter for the CALL CL command, or passed as a character string
to the system program QCMDEXC (Exec).
Copyright IBM Corp. 1993, 2001 xvii
xviii ILE COBOL Reference Summary
Industry StandardStandard COBOL refers to the COBOL programming language as defined in thedocument entitled American National Standard for Information Systems -Programming Language - COBOL, ANSI X3.23-1985, ISO 1989:1985, updated withthe content of the following documents, in the order they are listed:v ANSI X3.23a-1989, American National Standard for Information Systems -
Programming Language - Intrinsic Function Module for COBOL and ISO1989:1985/ Amd.1:1992
v Programming Languages - COBOL, AMENDMENT 1: Intrinsic function modulev ANSI X3.23b-1993, American National Standard for Information Systems -
Programming Language - Correction Amendment for COBOLv ISO/IEC 1989 DAM2 Programming Languages - COBOL, AMENDMENT 2:
Correction and clarification amendment for COBOL.
From this point on, the term Standard COBOL will be used to refer to the ANSIstandard just described.
Copyright IBM Corp. 1993, 2001 xix
xx ILE COBOL Reference Summary
Chapter 1. Creating Module and Program ObjectsUse the CRTCBLMOD (Create COBOL Module) command to create one or moremodule objects from ILE COBOL source members. Use the CRTPGM (CreateProgram) command to bind the module objects created by the CRTCBLMODcommand into one or more program objects.
Use the CRTBNDCBL (Create Bound COBOL) command to create one or moreprogram objects directly from ILE COBOL source members.
You can use the PROCESS statement in your source member to override theoptions specified for the CRTCBLMOD or CRTBNDCBL command. The options ofthe PROCESS statement are covered in PROCESS Statement on page 8.
CRTCBLMOD Command SyntaxThe following diagram shows the syntax of the CRTCBLMOD command:
CRTCBLMOD CommandFormat
*CURLIB/ *PGMIDMODULE ( library-name/ module-name )
CRTCBLMOD
*LIBL/ QCBLLESRC
SRCFILE ( *CURLIB/ source-file-name )library-name/
*MODULE
SRCMBR ( source-file-member-name )
OUTPUT ( *NONE )
30
GENLVL ( severity-level-value )
*SRCMBRTXTTEXT ( *BLANK )
'text-description'
Copyright IBM Corp. 1993, 2001 1
OPTION ( OPTION Details ) CVTOPT ( CVTOPT Details )
*NOMAX 30
MSGLMT ( maximum-number severity-level )
*STMT
DBGVIEW ( *SOURCE )*LIST*ALL*NONE
*NONEOPTIMIZE ( *BASIC )
*FULL
*NOFIPS *NOOBSOLETE
FLAGSTD ( )*MINIMUM *OBSOLETE*INTERMEDIATE*HIGH
*DFRWRT *UNDSPCHR *ACCUPDALL
EXTDSPOPT ( )*NODFRWRT *NOUNDSPCHR *ACCUPDNE
0
FLAG ( severity-level )*YES
REPLACE ( *NO )
*LIBCRTAUTAUT ( *ALL )
*CHANGE*USE*EXCLUDEauthorization-list-name
*PGM
LINKLIT ( *PRC )*CURRENT
TGTRLS ( *PRV )target-release
Creating Module and Program Objects
2 ILE COBOL Reference Summary
*HEX
SRTSEQ ( *JOB )*JOBRUN*LANGIDUNQ*LANGIDSHR
*LIBL/ sort-seq-table-name*CURLIB/library-name/
*JOBRUN
LANGID ( *JOB )language-identifier-name
*PEPENBPFRCOL ( *ENTRYEXIT )
*FULL
*NOCOLPRFDTA ( *COL )
*JOBRUN
CCSID ( *JOB )*HEXccsid-number
*NOEXTENDARITHMETIC ( *EXTEND31 )
NTLPADCHAR ( padchar1 )
padchar2padchar3
LICOPT ( options )
OPTION Details:
*SRC*SOURCE
*NOSOURCE*NOSRC
*NOXREF
*XREF
*GEN
*NOGEN
*NOSEQUENCE
*SEQUENCE
*NOVBSUM
*VBSUM
*NONUMBER
*NUMBER*LINENUMBER
*NOMAP
*MAP
*NOOPTIONS
*OPTIONS
*QUOTE
*APOST
*NOSECLVL
*SECLVL
Creating Module and Program Objects
Chapter 1. Creating Module and Program Objects 3
*PRTCORR
*NOPRTCORR
*MONOPRC
*NOMONOPRC
*RANGE
*NORANGE
*NOUNREF
*UNREF
*NOSYNC
*SYNC
*NOCRTF
*CRTF
*NODUPKEYCHK
*DUPKEYCHK
*NOINZDLT
*INZDLT
*NOBLK
*BLK
*STDINZ
*NOSTDINZ
*NODDSFILLER
*DDSFILLER
*NOIMBEDERR
*IMBEDERR
*STDTRUNC
*NOSTDTRUNC
*NOCHGPOSSGN
*CHGPOSSGN
*NOEVENTF
*EVENTF
*MONOPIC
*NOMONOPIC
CVTOPT Details:
*NOVARCHAR
*VARCHAR
*NODATETIME
*DATETIME
*NOPICXGRAPHIC
*PICXGRAPHIC*NOPICGGRAPHIC*PICGGRAPHIC
*NOPICNGRAPHIC
*PICNGRAPHIC
*NOFLOAT
*FLOAT
*NODATE
*DATE
*NOTIME
*TIME
*NOTIMESTAMP
*TIMESTAMP
*NOCVTTODATE
*CVTTODATE
CRTBNDCBL Command SyntaxThe following diagram shows the syntax of the CRTBNDCBL command:
CRTBNDCBL Command - Format
CRTBNDCBL*CURLIB/ *PGMID
PGM ( library-name/ program-name )
*LIBL/ QCBLLESRC
SRCFILE ( *CURLIB/ source-file-name )library-name/
Creating Module and Program Objects
4 ILE COBOL Reference Summary
*PGM
SRCMBR ( source-file-member-name )
OUTPUT ( *NONE )
30
GENLVL ( severity-level-value )
*SRCMBRTXT
TEXT ( *BLANK )'text-description'
OPTION ( OPTION Details ) CVTOPT ( CVTOPT Details )
*NOMAX 30
MSGLMT ( maximum-number severity-level )
*STMT
DBGVIEW ( *SOURCE )*LIST*ALL*NONE
*NONEOPTIMIZE ( *BASIC )
*FULL
*NOFIPS *NOOBSOLETE
FLAGSTD ( )*MINIMUM *OBSOLETE*INTERMEDIATE*HIGH
*DFRWRT *UNDSPCHR *ACCUPDALL
EXTDSPOPT ( )*NODFRWRT *NOUNDSPCHR *ACCUPDNE
0
FLAG ( severity-level )*YES
REPLACE ( *NO )
Creating Module and Program Objects
Chapter 1. Creating Module and Program Objects 5
*USER
USRPRF ( *OWNER )*LIBCRTAUT
AUT ( *ALL )*CHANGE*USE*EXCLUDEauthorization-list-name
*PGM
LINKLIT ( *PRC )*YES
SIMPLEPGM ( *NO )
*CURRENT
TGTRLS ( *PRV )target-release
*HEX
SRTSEQ ( *JOB )*JOBRUN*LANGIDUNQ*LANGIDSHR
*LIBL/ sort-seq-table-name*CURLIB/library-name/
*JOBRUN
LANGID ( *JOB )language-identifier-name
*PEP
ENBPFRCOL ( *ENTRYEXIT )*FULL
*NONE
BNDDIR ( *LIBL/ binding-directory-name )*CURLIB/*USRLIBL/library-name/
Creating Module and Program Objects
6 ILE COBOL Reference Summary
QILE
ACTGRP ( *NEW )*CALLERactivation-group-name
*NOCOL
PRFDTA ( *COL )*JOBRUN
CCSID ( *JOB )*HEXccsid-number
*NOEXTEND
ARITHMETIC ( *EXTEND31 )
NTLPADCHAR ( padchar1 )
padchar2padchar3
LICOPT ( options )
OPTION Details:
*SRC*SOURCE
*NOSOURCE*NOSRC
*NOXREF
*XREF
*GEN
*NOGEN
*NOSEQUENCE
*SEQUENCE
*NOVBSUM
*VBSUM
*NONUMBER
*NUMBER*LINENUMBER
*NOMAP
*MAP
*NOOPTIONS
*OPTIONS
*QUOTE
*APOST
*NOSECLVL
*SECLVL
*PRTCORR
*NOPRTCORR
*MONOPRC
*NOMONOPRC
*RANGE
*NORANGE
*NOUNREF
*UNREF
*NOSYNC
*SYNC
*NOCRTF
*CRTF
*NODUPKEYCHK
*DUPKEYCHK
*NOINZDLT
*INZDLT
*NOBLK
*BLK
*STDINZ
*NOSTDINZ
*NODDSFILLER
*DDSFILLER
*NOIMBEDERR
*IMBEDERR
Creating Module and Program Objects
Chapter 1. Creating Module and Program Objects 7
*STDTRUNC
*NOSTDTRUNC
*NOCHGPOSSGN
*CHGPOSSGN
*NOEVENTF
*EVENTF
*MONOPIC
*NOMONOPIC
CVTOPT Details:
*NOVARCHAR
*VARCHAR
*NODATETIME
*DATETIME
*NOPICXGRAPHIC
*PICXGRAPHIC*NOPICGGRAPHIC*PICGGRAPHIC
*NOPICNGRAPHIC
*PICNGRAPHIC
*NOFLOAT
*FLOAT
*NODATE
*DATE
*NOTIME
*TIME
*NOTIMESTAMP
*TIMESTAMP
*NOCVTTODATE
*CVTTODATE
PROCESS StatementThe syntax of the PROCESS statement is:
PROCESS option-1.
PROCESS Statement Options CRTCBLMOD/CRTBNDCBL
OUTPUT Parameter Options
OUTPUTNOOUTPUT
*PRINT*NONE
PROCESS Statement Option CRTCBLMOD/CRTBNDCBL
GENLVL Parameter Option
GENLVL(nn) nn
PROCESS Statement Options CRTCBLMOD/CRTBNDCBL
OPTION Parameter Options
SOURCESRCNOSOURCENOSRC
*SOURCE*SRC*NOSOURCE*NOSRC
NOXREFXREF
*NOXREF*XREF
Creating Module and Program Objects
8 ILE COBOL Reference Summary
PROCESS Statement Options CRTCBLMOD/CRTBNDCBL
OPTION Parameter Options
GENNOGEN
*GEN*NOGEN
NOSEQUENCESEQUENCE
*NOSEQUENCE*SEQUENCE
NOVBSUMVBSUM
*NOVBSUM*VBSUM
NONUMBERNUMBERLINENUMBER
*NONUMBER*NUMBER*LINENUMBER
NOMAPMAP
*NOMAP*MAP
NOOPTIONSOPTIONS
*NOOPTIONS*OPTIONS
QUOTEAPOST
*QUOTE*APOST
NOSECLVLSECLVL
*NOSECLVL*SECLVL
PRTCORRNOPRTCORR
*PRTCORR*NOPRTCORR
MONOPRCNOMONOPRC
*MONOPRC*NOMONOPRC
RANGENORANGE
*RANGE*NORANGE
NOUNREFUNREF
*NOUNREF*UNREF
NOSYNCSYNC
*NOSYNC*SYNC
NOCRTFCRTF
*NOCRTF*CRTF
NODUPKEYCHKDUPKEYCHK
*NODUPKEYCHK*DUPKEYCHK
NOINZDLTINZDLT
*NOINZDLT*INZDLT
NOBLKBLK
*NOBLK*BLK
STDINZNOSTDINZ
*STDINZ*NOSTDINZ
NODDSFILLERDDSFILLER
*NODDSFILLER*DDSFILLER
Not applicable *NOIMBEDERR*IMBEDERR
STDTRUNCNOSTDTRUNC
*STDTRUNC*NOSTDTRUNC
CHGPOSSGNNOCHGPOSSGN
*CHGPOSSGN*NOCHGPOSSGN
Not applicable *NOEVENTF*EVENTF
Creating Module and Program Objects
Chapter 1. Creating Module and Program Objects 9
PROCESS Statement Options CRTCBLMOD/CRTBNDCBL
OPTION Parameter Options
MONOPICNOMONOPIC
*MONOPIC*NOMONOPIC
PROCESS Statement Options CRTCBLMOD/CRTBNDCBL
CVTOPT Parameter Options
NOVARCHARVARCHAR
*NOVARCHAR*VARCHAR
NODATETIMEDATETIME
*NODATETIME*DATETIME
NOCVTPICXGRAPHICCVTPICXGRAPHICCVTPICGGRAPHICNOCVTPICGGRAPHIC
*NOPICXGRAPHIC*PICXGRAPHIC*PICGGRAPHIC*NOPICGGRAPHIC
NOCVTPICNGRAPHICCVTPICNGRAPHIC
*NOPICNGRAPHIC*PICNGRAPHIC
NOFLOATFLOAT
*NOFLOAT*FLOAT
NODATEDATE
*NODATE*DATE
NOTIMETIME
*NOTIME*TIME
NOTIMESTAMPTIMESTAMP
*NOTIMESTAMP*TIMESTAMP
NOCVTTODATECVTTODATE
*NOCVTTODATE*CVTTODATE
PROCESS Statement Options CRTCBLMOD/CRTBNDCBL
OPTIMIZE Parameter Options
NOOPTIMIZEBASICOPTFULLOPT
*NONE*BASIC*FULL
PROCESS Statement Options CRTCBLMOD/CRTBNDCBL
FLAGSTD Parameter Options
NOFIPSMINIMUMINTERMEDIATEHIGH
*NOFIPS*MINIMUM*INTERMEDIATE*HIGH
NOOBSOLETEOBSOLETE
*NOOBSOLETE*OBSOLETE
PROCESS Statement OptionsEXTDSPOPT(a b c)
CRTCBLMOD/CRTBNDCBL
EXTDSPOPT Parameter Options
DFRWRTNODFRWRT
*DFRWRT*NODFRWRT
Creating Module and Program Objects
10 ILE COBOL Reference Summary
||||
PROCESS Statement OptionsEXTDSPOPT(a b c)
CRTCBLMOD/CRTBNDCBL
EXTDSPOPT Parameter Options
UNDSPCHRNOUNDSPCHR
*UNDSPCHR*NOUNDSPCHR
ACCUPDALLACCUPDNE
*ACCUPDALL*ACCUPDNE
PROCESS Statement Option CRTCBLMOD/CRTBNDCBL
FLAG Parameter Option
FLAG(nn) nn
PROCESS Statement Options CRTCBLMOD/CRTBNDCBL
LINKLIT Parameter Options
LINKPGMLINKPRC
*PGM*PRC
PROCESS Statement Options SRTSEQ(a) CRTCBLMOD/CRTBNDCBL
SRTSEQ Parameter Options
HEXJOBJOBRUNLANGIDUNQLANGIDSHR"LIBL/sort-seq-table-name""CURLIB/sort-seq-table-name""library-name/sort-seq-table-name""sort-seq-table-name"
*HEX*JOB*JOBRUN*LANGIDUNQ*LANGIDSHR*LIBL/sort-seq-table-name*CURLIB/sort-seq-table-namelibrary-name/sort-seq-table-namesort-seq-table-name
PROCESS Statement Options LANGID(a) CRTCBLMOD/CRTBNDCBL
LANGID Parameter Options
JOBRUNJOB"language-identifier-name"
*JOBRUN*JOBlanguage-identifier-name
PROCESS Statement OptionsENBPFRCOL(a)
CRTCBLMOD/CRTBNDCBL
ENBPFRCOL Parameter Options
PEPENTRYEXITFULL
*PEP*ENTRYEXIT*FULL
PROCESS Statement Options PRFDTA(a) CRTCBLMOD/CRTBNDCBL
PRFDTA Parameter Options
NOCOLCOL
*NOCOL*COL
Creating Module and Program Objects
Chapter 1. Creating Module and Program Objects 11
PROCESS Statement Options CCSID(a b c) CRTCBLMOD/CRTBNDCBL
CCSID Parameter Options
a = Locale single-byte data CCSID
JOBRUNJOBHEXcoded-character-set-identifier
*JOBRUN*JOB*HEXcoded-character-set-identifier
b = Non-locale single-byte data CCSID
JOBRUNJOBHEXcoded-character-set-identifier
Not applicable
c = Non-locale double-byte data CCSID
JOBRUNJOBHEXcoded-character-set-identifier
Not applicable
PROCESS Statement Options DATTIM(a b) CRTCBLMOD/CRTBNDCBL
4-digit base century (default 1900)2-digit base year (default 40)
Not applicable
PROCESS Statement Options THREAD(a) CRTCBLMOD/CRTBNDCBL
NOTHREADSERIALIZE
Not applicable
PROCESS Statement OptionsARITHMETIC(a)
CRTCBLMOD/CRTBNDCBL
ARITHMETIC Parameter Options
NOEXTENDEXTEND31
*NOEXTEND*EXTEND31
PROCESS Statement Option CRTCBLMOD/CRTBNDCBL
NOGRAPHICGRAPHIC
Not applicable
PROCESS Statement Option CRTCBLMOD/CRTBNDCBL
NONATIONALNATIONAL
Not applicable
PROCESS Statement Option CRTCBLMOD/CRTBNDCBL
NOLSPTRALIGNLSPTRALIGN
Not applicable
PROCESS Statement Option CRTCBLMOD/CRTBNDCBL
NOCOMPASBINCOMPASBIN
Not applicable
Creating Module and Program Objects
12 ILE COBOL Reference Summary
|||||||||||||||||||||
PROCESS Statement Option OPTVALUE(a) CRTCBLMOD/CRTBNDCBL
NOOPTOPT
Not applicable
PROCESS Statement Option CRTCBLMOD/CRTBNDCBL
NOADJFILLERADJFILLER
Not applicable
PROCESS Statement OptionNTLPADCHAR(a b c)
CRTCBLMOD/CRTBNDCBL
NTLPADCHAR Parameter Options
a = padding character for moving single-byte to national
NX0020a national hexadecimal literalrepresenting one national character
NX0020a national character
b = padding character for moving double-byte to national
NX3000a national hexadecimal literalrepresenting one national character
NX3000a national character
c = padding character for moving national to national
NX3000a national hexadecimal literalrepresenting one national character
NX3000a national character
PROCESS Statement Option LICOPT(a) CRTCBLMOD/CRTBNDCBL
LICOPT Parameter Option
licensed-internal-code-option-string licensed-internal-code-option-string
Creating Module and Program Objects
Chapter 1. Creating Module and Program Objects 13
|||||||||||||||||||||||||
||||||
||||||||||||||
Creating Module and Program Objects
14 ILE COBOL Reference Summary
Chapter 2. COBOL Source ProgramGeneral StructureCOBOL Source ProgramFormat
IDENTIFICATION(1)
ID
DIVISION. PROGRAM-ID. program-name-1(1)
literal-1
INITIAL
IS PROGRAM
.identification-division-content
ENVIRONMENT DIVISION. environment-division-content
DATA DIVISION. data-division-content
PROCEDURE DIVISION. procedure-division-content
END PROGRAM program-name-1 .(1)
literal-1nested program
nested program:
IDENTIFICATION(1)
ID
DIVISION. PROGRAM-ID. program-name-2(1)
literal-2
COMMON
IS INITIAL PROGRAMINITIAL
COMMON
.identification-division-content
ENVIRONMENT DIVISION. environment-division-content
Copyright IBM Corp. 1993, 2001 15
DATA DIVISION. data-division-content
PROCEDURE DIVISION. procedure-division-content
nested program
END PROGRAM program-name-2(1)
literal-2
.
Notes:
1 IBM Extension
COBOL Source ProgramGeneral Structure
16 ILE COBOL Reference Summary
Chapter 3. Identification DivisionIdentification Division - Format
IDENTIFICATION(1)
ID
DIVISION. PROGRAM-ID. program-name(1)
literal
(2)
COMMONIS INITIAL PROGRAM
INITIAL(2)
COMMON
.
AUTHOR.
comment-entry
INSTALLATION.
comment-entry
DATE-WRITTEN.
comment-entry
DATE-COMPILED.
comment-entry
SECURITY.
comment-entry
Notes:
1 IBM Extension
2 Allowed only for nested COBOL programs
Copyright IBM Corp. 1993, 2001 17
Identification Division
18 ILE COBOL Reference Summary
Chapter 4. Environment DivisionEnvironment Division - Format
ENVIRONMENT DIVISION.
CONFIGURATION SECTION. Configuration Section Paragraphs
INPUT-OUTPUT SECTION. Input-Output Section Paragraphs
Configuration Section Paragraphs:
SOURCE-COMPUTER.source-computer-entry
OBJECT-COMPUTER.
object-computer-entry
SPECIAL-NAMES.
special-names-entry
Input-Output Section Paragraphs:
FILE-CONTROL. file-control-entry
I-O-CONTROL.
i-o-control-entry
Copyright IBM Corp. 1993, 2001 19
Configuration Section
SOURCE-COMPUTER ParagraphSOURCE-COMPUTER Paragraph - Format
SOURCE-COMPUTER.computer-name .
DEBUGGING MODEWITH
OBJECT-COMPUTER ParagraphOBJECT-COMPUTER Paragraph - Format
OBJECT-COMPUTER.computer-name Entry .
Entry:
(1)MEMORY integer WORDS
SIZE CHARACTERSMODULES
SEQUENCE alphabet-name
PROGRAM COLLATING IS
(1)
SEGMENT-LIMIT segment-numberIS
Notes:
1 Syntax-checked only.
SPECIAL-NAMES ParagraphSPECIAL-NAMES Paragraph - Format
SPECIAL-NAMES.
Environment Division
20 ILE COBOL Reference Summary
environment-name-1 mnemonic-name-1IS
environment-name-2 mnemonic-name-2IS condcond
ALPHABET Clause
CLASS Clause CONSOLE Clause
(2)
CRT STATUS Clause
(3)CURRENCY SIGN Clause
(2)
CURSOR ClauseDECIMAL-POINT Clause
(2)LINKAGE TYPE Clause
(2)FORMAT Clause
(2)LOCALE Clause
(1).
cond:
ON condition-1STATUS IS off phrase
off phraseON condition-1
STATUS IS
off phrase:
OFF condition-2STATUS IS
Environment Division
Chapter 4. Environment Division 21
Notes:
1 The separator period must be used if any of the optional clauses are selected.Clauses can be entered in any order.
2 IBM Extension
3 Subsequent repetitions are IBM Extensions.
ALPHABET ClauseALPHABET Clause - Format
ALPHABET alphabet-name-1IS
STANDARD-1STANDARD-2NATIVEEBCDIC
(1)NLSSORT
literal-1THROUGH literal-2THRU
ALSO literal-3
Notes:
1 IBM Extension
CLASS ClauseCLASS Clause - Format
CLASS class-name-1IS
literal-4THROUGH literal-5THRU
CONSOLE ClauseCONSOLE Clause - Format
(1)
CONSOLE CRTIS DISPLAY
Notes:
1 IBM Extension
Environment Division
22 ILE COBOL Reference Summary
CRT STATUS ClauseCRT STATUS Clause - Format
(1)
CRT STATUS data-name-2IS
Notes:
1 IBM Extension
CURRENCY ClauseCURRENCY SIGN Clause - Format
CURRENCY literal-6SIGN IS
(1)
PICTURE SYMBOL literal-7WITH
Notes:
1 IBM Extension
CURSOR ClauseCURSOR Clause - Format
(1)
CURSOR data-name-1IS
Notes:
1 IBM Extension
DECIMAL-POINT ClauseDECIMAL-POINT IS COMMA Clause - Format
DECIMAL-POINT COMMAIS
Environment Division
Chapter 4. Environment Division 23
FORMAT Clause
IBM Extension
FORMAT Clause - Format
FORMAT DATEOF TIME IS
literal-8SIZE Phrase 1
LOCALE Phrase 1SIZE integer-4 LOCALE
IS IS mnemonic-name-4
SIZE Phrase 1:
SIZE integer-3IS
LOCALE Phrase 1:
LOCALEIS mnemonic-name-3
End of IBM Extension
LINKAGE-TYPE ClauseLINKAGE TYPE Clause - Format
(1)
LINKAGETYPE IS
environment-name-3PROGRAMPROCEDURE
FOR
literal-7USING linkage-arguments
Environment Division
24 ILE COBOL Reference Summary
linkage-arguments:
ALL DESCRIBEDISARE
integer-1THRU integer-2THROUGH
Notes:
1 IBM Extension
LOCALE Clause
IBM Extension
LOCALE Clause - Format
LOCALE locale-name-1literal-4
LIBRARY literal-5IN
mnemonic-name-5IS
End of IBM Extension
Input-Output SectionNote: The keyword FILE-CONTROL appears only once at the beginning of the
paragraph before the first file-control entry. The keyword I-O-CONTROLappears only once at the being of the paragraph before the firstinput-output-control entry.
FILE-CONTROL ParagraphFILE-CONTROL Paragraph - Format 1 - Sequential
FILE-CONTROL. SELECT file-nameOPTIONAL
(2)
ASSIGN assignment-name-1TO literal-1
Environment Division
Chapter 4. Environment Division 25
(1)
RESERVE integerAREAAREAS
SEQUENTIAL
ORGANIZATIONIS
(1)
PADDING data-name-6CHARACTER IS literal-2
(1)
RECORD DELIMITER STANDARD-1IS assignment-name-2
ACCESS SEQUENTIAL
MODE IS
STATUS data-name-1
FILE IS (3)data-name-5
.
Notes:
1 Syntax-checked only.
2 Subsequent repetitions syntax-checked only.
3 IBM Extension
FILE-CONTROL Paragraph - Format 2 - Relative
FILE-CONTROL. SELECT file-nameOPTIONAL
(1)
ASSIGN assignment-name-1TO literal-1
Environment Division
26 ILE COBOL Reference Summary
(2)
RESERVE integerAREAAREAS
RELATIVEORGANIZATION
IS
ACCESS SEQUENTIAL
MODE IS rel-keyRANDOM rel-keyDYNAMIC
STATUS data-name-1
FILE IS (3)data-name-5
.
rel-key:
RELATIVE data-name-4KEY IS
Notes:
1 Subsequent repetitions syntax-checked only.
2 Syntax-checked only.
3 IBM Extension
FILE-CONTROL Paragraph - Format 3 - Indexed
FILE-CONTROL. SELECT file-name
(2)
ASSIGN assignment-name-1TO literal-1
(3)
RESERVE integerAREAAREAS
INDEXEDORGANIZATION
IS
ACCESS SEQUENTIAL
MODE IS RANDOMDYNAMIC
RECORDKEY IS
Environment Division
Chapter 4. Environment Division 27
(1)
EXTERNALLY-DESCRIBED-KEYdata-name-2 (1)
DUPLICATESWITH
STATUS data-name-1
FILE IS (1)data-name-5
.
Notes:
1 IBM Extension
2 Subsequent repetitions syntax-checked only.
3 Syntax-checked only.
FILE-CONTROL Paragraph - Format 4 - Sort or Merge
(1)
FILE-CONTROL. SELECT file-name ASSIGNTO
assignment-name-1literal-1
.
Notes:
1 Syntax checked only.
IBM Extension
FILE-CONTROL Paragraph - Format 5 - Transaction
FILE-CONTROL. SELECT file-name
(1)
ASSIGN assignment-name-1TO literal-1
TRANSACTIONORGANIZATION
IS
Environment Division
28 ILE COBOL Reference Summary
ACCESS SEQUENTIAL
MODE IS rel-keyDYNAMIC rel-key
STATUS data-name-1
FILE IS data-name-5
CONTROL-AREA data-name-7
IS
.
rel-key:
RELATIVEKEY IS
data-name-4
Notes:
1 Subsequent repetitions syntax checked only.
End of IBM Extension
I-O-CONTROL ParagraphI-O-CONTROL Paragraph - Format 1 - Sequential
I-O-CONTROL.
(1)RERUN records .
ON assignment-name-1file-name-1
SAME filesRECORD AREA FOR
multiple file tape
(2)COMMITMENT CONTROL file-name-6
FOR
Environment Division
Chapter 4. Environment Division 29
records:
integer-1 RECORDS file-name-2EVERY END REEL OF
OF UNITinteger-2 CLOCK-UNITScondition-name-1
files:
file-name-3 file-name-4
multiple file tape:
(1)MULTIPLE FILE
TAPE CONTAINS
file-name-5POSITION integer-2
Notes:
1 Syntax-checked only.
2 IBM Extension
I-O-CONTROL Paragraph - Format 2 - Relative/Indexed
I-O-CONTROL.
(1)RERUN records .
ON assignment-name-1file-name-1
SAME filesRECORD AREA FOR
(2)COMMITMENT CONTROL file-name-6
FOR
Environment Division
30 ILE COBOL Reference Summary
records:
integer-1 RECORDS file-name-2EVERY OF
integer-2 CLOCK-UNITScondition-name-1
files:
file-name-3 file-name-4
Notes:
1 Syntax-checked only.
2 IBM Extension
I-O-CONTROL Paragraph - Format 3 - Sort/Merge
I-O-CONTROL.
SAME RECORD files .(1) AREA FOR
SORT(1)
SORT-MERGE
files:
file-name-3 file-name-4
Notes:
1 Syntax-checked only.
Environment Division
Chapter 4. Environment Division 31
Environment Division
32 ILE COBOL Reference Summary
Chapter 5. Data DivisionData Division - Format
DATA DIVISION.
FILE SECTION.file-section-entries
WORKING-STORAGE SECTION.record-description-entrydata-item-description-entry
LINKAGE SECTION.record-description-entrydata-item-description-entry
file-section-entries:
file-description-entry record-description-entry
File SectionFile Description Entry - Format 1a - Formatfile, Database
FD file-nameEXTERNAL
ISGLOBAL
IS
BLOCK integer2
CONTAINS integer1 TO CHARACTERSRECORDS
Copyright IBM Corp. 1993, 2001 33
RECORD integer3
CONTAINS integer6 TO integer7 CHARACTERS
(1)
LABEL RECORD STANDARDIS OMITTED
RECORDSARE
(1)
VALUE OF system-name-1 data-name-1IS literal-1
(1)
DATA RECORD data-name-2IS
RECORDSARE
.
Notes:
1 Syntax-checked only.
File Description Entry - Format 1b - Disk
FD file-nameEXTERNAL
ISGLOBAL
IS
BLOCK integer2
CONTAINS integer1 TO CHARACTERSRECORDS
RECORD integer3
CONTAINS CHARACTERSinteger6 TO integer7
CONTAINS CHARACTERSvarying
DEPENDING data-name-1ON
Data Division
34 ILE COBOL Reference Summary
(1)
LABEL RECORD STANDARDIS OMITTED
RECORDSARE
(1)
VALUE OF system-name-1 data-name-1IS literal-1
(1)
DATA RECORD data-name-2IS
RECORDSARE
.
varying:
VARYINGIS IN SIZE integer-4
FROM
TO integer-5 CHARACTERS
Notes:
1 Syntax-checked only.
File Description Entry - Format 2 - Diskette
FD file-nameEXTERNAL
ISGLOBAL
IS
(1)
BLOCK integer2CONTAINS integer1 TO CHARACTERS
RECORDS
RECORD integer3
CONTAINS integer6 TO integer7 CHARACTERS
Data Division
Chapter 5. Data Division 35
(1)
LABEL RECORD STANDARDIS OMITTED
RECORDSARE
(1)
VALUE OF system-name-1 data-name-1IS literal-1
(1)
DATA RECORD data-name-2IS
RECORDSARE
CODE-SET alphabet-name-1
IS
.
Notes:
1 Syntax-checked only.
File Description Entry - Format 3 - Tapefile
FD file-nameEXTERNAL
ISGLOBAL
IS
BLOCK integer2
CONTAINS integer1 TO CHARACTERSRECORDS
RECORD integer3
CONTAINS CHARACTERSinteger6 TO integer7
CONTAINS CHARACTERSvarying
DEPENDING data-name-1ON
Data Division
36 ILE COBOL Reference Summary
LABEL RECORD STANDARD
IS OMITTEDRECORDS
ARE
(1)
VALUE OF system-name-1 data-name-1IS literal-1
(1)
DATA RECORD data-name-2IS
RECORDSARE
CODE-SET alphabet-name-1
IS
.
varying:
VARYINGIS IN SIZE integer-4
FROM
TO integer-5 CHARACTERS
Notes:
1 Syntax-checked only.
File Description Entry - Format 4 - Printer
FD file-nameEXTERNAL
ISGLOBAL
IS
BLOCK integer2
CONTAINS integer1 TO CHARACTERSRECORDS
Data Division
Chapter 5. Data Division 37
RECORD integer3
CONTAINS integer6 TO integer7 CHARACTERS
(1)
LABEL RECORD STANDARDIS OMITTED
RECORDSARE
(1)
VALUE OF system-name-1 data-name-1IS literal-1
(1)
DATA RECORD data-name-2IS
RECORDSARE
linage clause CODE-SET alphabet-name-1
IS
.
linage clause:
LINAGEIS
data-name-3integer-8 LINES
FOOTING data-name-4
WITH AT integer-9
TOP data-name-5
LINES AT integer-10
BOTTOM data-name-6
LINES AT integer-11
Notes:
1 Syntax-checked only.
Data Division
38 ILE COBOL Reference Summary
File Description Entry - Format 5 - Sort/Merge
SD file-name
RECORD integer3
CONTAINS CHARACTERSinteger6 TO integer7
CONTAINS CHARACTERSvarying
DEPENDING data-name-1ON
(1)
DATA RECORD data-name-2IS
RECORDSARE
.
varying:
VARYINGIS IN SIZE integer-4
FROM
TO integer-5 CHARACTERS
Notes:
1 Syntax-checked only.
IBM Extension
File Description Entry - Format 6 - Transaction
FD file-nameEXTERNAL
ISGLOBAL
IS
RECORD integer3
CONTAINS integer6 TO integer7 CHARACTERS
Data Division
Chapter 5. Data Division 39
(1)
LABEL RECORD STANDARDIS OMITTED
RECORDSARE
(1)
DATA RECORD data-name-2IS
RECORDSARE
.
Notes:
1 Syntax-checked only.
End of IBM Extension
Working-Storage SectionData Description Entry - General Format 1
level-numberdata-name-1
(1)FILLER
REDEFINES data-name-2(2)
LIKE data-name-3(integer)
(2)TYPEDEF
IS
EXTERNAL
ISBLANK ZERO
WHEN
FORMAT Clause GLOBAL
IS
JUSTJUSTIFIED (3)
RIGHT
OCCURS clause - Format 1OCCURS clause - Format 2
PICTURE character-stringPIC IS SIZE and LOCALE Phrases
Data Division
40 ILE COBOL Reference Summary
LEADING
SIGN TRAILING SEPARATEIS CHARACTER
VALUE literal
ISSYNCHRONIZEDSYNC (3)
LEFT(3)
RIGHT
(2)
TYPE type-name-1
BINARY
USAGE COMPUTATIONALIS COMP
(2)COMPUTATIONAL-1
(2)COMP-1
(2)COMPUTATIONAL-2
(2)COMP-2
(2)COMPUTATIONAL-3
(2)COMP-3
(2)COMPUTATIONAL-4
(2)COMP-4DISPLAY
(2)DISPLAY-1INDEXPACKED-DECIMAL
(2)POINTER
(2)PROCEDURE-POINTER
Notes:
1 Cannot be used with the TYPEDEF clause.
2 IBM Extension
3 Syntax-checked only
Data Division
Chapter 5. Data Division 41
Data Description Entry - General Format 1 (continued)OCCURS clause - Format 1:
OCCURS integer-2 key-indexed-by phraseTIMES
OCCURS clause - Format 2:
OCCURS integer-1 TO integer-2 DEPENDING data-name-1TIMES ON
key-indexed-by phrase
key-indexed-by phrase:
(1)
ASCENDING data-name-2(1) KEY IS
DESCENDING
INDEXED index-name-1BY
Size and Locale Phrases:
(2)SIZE integer-3 LOCALE
IS mnemonic-name-1IS
FORMAT Clause:
(2)FORMAT DATE
OF TIME ISTIMESTAMP
Data Division
42 ILE COBOL Reference Summary
literal-2
phrase 1phrase 2
phrase 1:
SIZE integer-4IS LOCALE
mnemonic-name-2IS
phrase 2:
SIZE integer-5 LOCALEIS mnemonic-name-3
IS
Notes:
1 Cannot be used with boolean data type
2 IBM Extension
Data Description Entry - General Format 2
66 data-name-1 RENAMES data-name-2THROUGH data-name-3THRU
.
Data Description Entry - General Format 3
88 condition-name VALUEIS
VALUESARE
literal-1THROUGH literal-2THRU
.
IBM Extension
Data Description Entry - Format 4 - Boolean Data
Data Division
Chapter 5. Data Division 43
level-numberdata-name-1
(1)FILLER
REDEFINES data-name-2LIKE data-name-3
TYPEDEFIS
EXTERNAL
ISGLOBAL
IS
(2)
JUST RIGHTJUSTIFIED
OCCURS clause - Format 1OCCURS clause - Format 2
INDICATOR integer-3INDICATORSINDIC
PICTURE 1PIC IS
VALUE boolean-literal
IS(2)
SYNCHRONIZED LEFTSYNC RIGHT
TYPE type-name-1 DISPLAY
USAGEIS
.
OCCURS clause - Format 1:
OCCURS integer-2TIMES
INDEXED index-name-1BY
OCCURS clause - Format 2:
OCCURS integer-1 TO integer-2TIMES
DEPENDING data-name-4ON
Data Division
44 ILE COBOL Reference Summary
INDEXED index-name-1BY
Notes:
1 Cannot be used with the TYPEDEF clause.
2 Syntax-checked only
End of IBM Extension
Linkage SectionSee Working-Storage Section on page 40 for data description entry clauseformats.
The EXTERNAL clause cannot be specified in the Linkage Section.
Data Division
Chapter 5. Data Division 45
46 ILE COBOL Reference Summary
Chapter 6. Procedure DivisionProcedure Division - Format 1
PROCEDURE DIVISION
USING Using-phrase
(1)
RETURNING data-name-2ADDRESS OF
(1)GIVING
.
DECLARATIVES. Sections-2 END DECLARATIVES.
Sections-1
Using-phrase:
data-name-1(1)
REFERENCEBY
(1)VALUE
BY
Sections-1:
section-name SECTIONsegment-number
Copyright IBM Corp. 1993, 2001 47
paragraph-name.
sentence
Sections-2:
section-name SECTION . USE statement.segment-number
paragraph-name.
sentence
Notes:
1 IBM Extension
Procedure Division - Format 2
PROCEDURE DIVISION
USING Using-phrase
(1)
RETURNING data-name-2ADDRESS OF
(1)GIVING
.
paragraph-name.
sentence
Notes:
1 IBM Extension
Procedure Division
48 ILE COBOL Reference Summary
Procedure Division StatementsThese statements are presented in alphabetical order.
ACCEPT StatementACCEPT Statement - Format 1 - Data Transfer
ACCEPT identifier-1FROM mnemonic-name
(1)environment-name
(1)
END-ACCEPT
Notes:
1 IBM Extension
ACCEPT Statement - Format 2 - System Info Transfer
ACCEPT identifier-1 FROM DATE(1)
YYYYMMDDDAY
(1)YYYYDDD
DAY-OF-WEEKTIME
(1)
END-ACCEPT
Notes:
1 IBM Extension
IBM Extension
ACCEPT Statement - Format 3 - Feedback
ACCEPT identifier-1 FROM mnemonic-nameFOR file-name-1
(1)
END-ACCEPT
Procedure Division Statements
Chapter 6. Procedure Division 49
Notes:
1 IBM Extension
ACCEPT Statement - Format 4 - Local Data Area
ACCEPT identifier-1 FROM mnemonic-name(1)
FOR identifier-2literal-1
END-ACCEPT
Notes:
1 Syntax-checked only.
ACCEPT Statement - Format 5 - PIP Data Area
ACCEPT identifier-1 FROM mnemonic-name
EXCEPTION imperative-statement-1
ON
NOT EXCEPTION imperative-statement-2
ONEND-ACCEPT
ACCEPT Statement - Format 6 - Attribute Data
ACCEPT identifier-1 FROM mnemonic-name
FOR identifier-2
literal-1 FOR file-name-1END-ACCEPT
ACCEPT Statement - Format 7 - Workstation I/O
ACCEPT identifier-1
line-column-phraseFROM CRTMODE BLOCK
ISwith-phrase
Procedure Division Statements
50 ILE COBOL Reference Summary
EXCEPTION imperative-statement-1
ON
NOT EXCEPTION imperative-statement-2
ONEND-ACCEPT
line-column-phrase:
LINE identifier-2AT COLUMN NUMBER integer-1
COLAT identifier-3
integer-2
Procedure Division Statements
Chapter 6. Procedure Division 51
with-phrase:
WITH AUTOAUTO-SKIPBELLBEEP
BLINKFULLLENGTH-CHECK
HIGHLIGHTREQUIREDEMPTY-CHECK
REVERSE-VIDEOSECURENO-ECHO
UNDERLINERIGHT-JUSTIFYSPACE-FILLTRAILING-SIGNUPDATEZERO-FILLSIZE identifier-4
IS integer-3(1)
PROMPT identifier-5CHARACTER IS literal-1
(1)FOREGROUND-COLOR integer-4FOREGROUND-COLOUR IS
(1)BACKGROUND-COLOR integer-5BACKGROUND-COLOUR IS
(1)LEFT-JUSTIFY
Notes:
1 Syntax-checked only.
ACCEPT Statement - Format 8 - Session I/O
ACCEPT identifier-1FROM DISPLAY END-ACCEPT
ACCEPT Statement - Format 9 - Data Area
ACCEPT identifier-1 FROM mnemonic-name FOR identifier-2literal-1
Procedure Division Statements
52 ILE COBOL Reference Summary
LIBRARY identifier-3
IN literal-2AT identifier-4
integer-1
WITH LOCK EXCEPTION imperative-statement-1
ON
NOT EXCEPTION imperative-statement-2
ONEND-ACCEPT
End of IBM Extension
ACQUIRE StatementIBM Extension
ACQUIRE Statement - Format - TRANSACTION
ACQUIRE identifierliteral
FOR file-name
End of IBM Extension
ADD StatementADD Statement - Format 1 - ADD
ADD identifier-1literal-1
TO identifier-2ROUNDED
SIZE ERROR imperative-statement-1
ON
NOT SIZE ERROR imperative-statement-2
ONEND-ADD
ADD Statement - Format 2 - ADD GIVING
ADD identifier-1literal-1 TO
identifier-2literal-2
Procedure Division Statements
Chapter 6. Procedure Division 53
GIVING identifier-3ROUNDED
SIZE ERROR imperative-statement-1
ON
NOT SIZE ERROR imperative-statement-2
ONEND-ADD
ADD Statement - Format 3 - ADD CORRESPONDING
ADD CORRESPONDINGCORR
identifier-4 TO identifier-5ROUNDED
SIZE ERROR imperative-statement-1
ON
NOT SIZE ERROR imperative-statement-2
ONEND-ADD
ALTER StatementALTER Statement - Format
ALTER procedure-name-1 TO procedure-name-2PROCEED TO
CALL StatementCALL Statement - Format 1
CALL
Procedure Division Statements
54 ILE COBOL Reference Summary
identifier-1literal-1
(1)LINKAGE environment-name-1
TYPE IS PROGRAM(1)
PROGRAM
(1)
LIBRARY identifier-5IN literal-4 USING BY Phrase
ON EXCEPTION Phrase NOT ON EXCEPTION Phrase
OVERFLOW imperative statement-3ON
END-CALL
BY Phrase:
identifier-2REFERENCE (1)
BY ADDRESS OF(1)
file-name-1
CONTENT identifier-2BY (1)
ADDRESS OF(1)
LENGTH OF(1)
literal-2(1)
file-name-1
ON EXCEPTION Phrase:
EXCEPTION imperative statement-1ON
Procedure Division Statements
Chapter 6. Procedure Division 55
NOT ON EXCEPTION Phrase:
NOT EXCEPTION imperative statement-2ON
Notes:
1 IBM Extension
CALL Statement - Format 2
CALL
identifier-1literal-1
(1)LINKAGE environment-name-1
TYPE IS PROCEDURE(1)
PROCEDURE
USING BY Phrase
(1)
RETURNING identifier-4(1) INTO ADDRESS OF
GIVING
ON EXCEPTION Phrase NOT ON EXCEPTION Phrase
OVERFLOW imperative statement-3ON
END-CALL
BY Phrase:
Procedure Division Statements
56 ILE COBOL Reference Summary
identifier-2REFERENCE (1)
BY ADDRESS OF(1)
file-name-1(1)
OMITTED
CONTENT identifier-2BY (1)
ADDRESS OF(1)
LENGTH OF(1)
literal-2(1)
file-name-1(1)
OMITTEDBY VALUE Phrase
BY VALUE Phrase:
(1)
VALUE identifier-3BY ADDRESS OF
LENGTH OFliteral-3
float-literal-1 SIZE IS Phraseinteger-1
SIZE IS Phrase:
SIZE integer-2IS
ON EXCEPTION Phrase:
EXCEPTION imperative statement-1ON
NOT ON EXCEPTION Phrase:
NOT EXCEPTION imperative statement-2ON
Procedure Division Statements
Chapter 6. Procedure Division 57
Notes:
1 IBM Extension
IBM Extension
CALL GDDM Statement - Format
(1)
CALL GDDM USING routine-name
data-name-1
Notes:
1 IBM Extension
End of IBM Extension
CANCEL StatementCANCEL Statement - Format
CANCEL
identifier-1 In Library Phraseliteral-1
Linkage Phrase
Linkage Phrase:
(1)LINKAGE environment-name-1
TYPE IS PROGRAMPROCEDURE
(1)PROGRAM
(1)PROCEDURE
In Library Phrase:
(1)LIBRARY identifier-2
IN literal-2
Procedure Division Statements
58 ILE COBOL Reference Summary
Notes:
1 IBM Extension
CLOSE StatementCLOSE Statement - Format 1
CLOSE file-name-1LOCK
WITH
CLOSE Statement - Format 2 - Tape Files
CLOSE file-name-1REELUNIT REMOVAL
FORNO REWIND
WITH LOCK
COMMIT StatementIBM Extension
COMMIT Statement - Format
COMMIT
End of IBM Extension
COMPUTE StatementCOMPUTE Statement - Format
COMPUTE identifier-1ROUNDED
=EQUAL
arithmetic-expression
SIZE ERROR imperative-statement-1
ON
Procedure Division Statements
Chapter 6. Procedure Division 59
NOT SIZE ERROR imperative-statement-2
ONEND-COMPUTE
CONTINUE StatementCONTINUE Statement - Format
CONTINUE
DELETE StatementDELETE Statement - Format
DELETE file-nameRECORD (1)
FORMAT identifier-1IS literal-1
(1)
NULL-KEY-MAP identifier-2IS
INVALID imperative-statement-1
KEY
NOT INVALID imperative-statement-2
KEYEND-DELETE
Notes:
1 IBM Extension
DISPLAY StatementDISPLAY Statement - Format 1 - Data Transfer
DISPLAY identifier-1literal-1 mnemonic-name
UPON (1)environment-name
Procedure Division Statements
60 ILE COBOL Reference Summary
(2)
NO ADVANCINGWITH
(1)END-DISPLAY
Notes:
1 IBM Extension
2 Syntax-checked only.
IBM Extension
DISPLAY Statement - Format 2 - Local Data Area
DISPLAY identifier-1literal-1
UPON mnemonic-name
(1)
FOR identifier-2literal-2
END-DISPLAY
Notes:
1 Syntax-checked only.
DISPLAY Statement - Format 3 - Workstation I/O
DISPLAY identifier-1literal-1line-column-phrase
UPON CRTCRT-UNDER
MODE BLOCKIS
with-phrase
END-DISPLAY
line-column-phrase:
LINE identifier-2AT COLUMN NUMBER integer-1
COLAT identifier-3
integer-2
Procedure Division Statements
Chapter 6. Procedure Division 61
with-phrase:
WITH BELLBEEP
BLINKHIGHLIGHTREVERSE-VIDEOUNDERLINEBLANK SCREEN
LINESIZE identifier-4
IS integer-3(1)
FOREGROUND-COLOR integer-4(1) IS
FOREGROUND-COLOUR(1)
BACKGROUND-COLOR integer-5(1) IS
BACKGROUND-COLOUR
Notes:
1 Syntax-checked only.
DISPLAY Statement - Format 4 - Session I/O
DISPLAY identifier-1literal-1 UPON DISPLAY
NO ADVANCING
WITHEND-DISPLAY
DISPLAY Statement - Format 5 - Data Area
DISPLAY identifier-1literal-1
UPON mnemonic-name FOR identifier-2literal-2
LIBRARY identifier-3
IN literal-3AT identifier-4
integer-1
Procedure Division Statements
62 ILE COBOL Reference Summary
WITH LOCK EXCEPTION imperative-statement-1
ON
NOT EXCEPTION imperative-statement-2
ONEND-DISPLAY
End of IBM Extension
DIVIDE StatementDIVIDE Statement - Format 1 - INTO
DIVIDE identifier-1literal-1
INTO identifier-2ROUNDED
SIZE ERROR imperative-statement-1
ON
NOT SIZE ERROR imperative-statement-2
ONEND-DIVIDE
DIVIDE Statement - Format 2 - INTO GIVING
DIVIDE identifier-1literal-1
INTO identifier-2literal-2
GIVING identifier-3ROUNDED
SIZE ERROR imperative-statement-1
ON
NOT SIZE ERROR imperative-statement-2
ONEND-DIVIDE
Procedure Division Statements
Chapter 6. Procedure Division 63
DIVIDE Statement - Format 3 - BY GIVING
DIVIDE identifier-1literal-1
BY identifier-2literal-2
GIVING identifier-3ROUNDED
SIZE ERROR imperative-statement-1
ON
NOT SIZE ERROR imperative-statement-2
ONEND-DIVIDE
DIVIDE Statement - Format 4 - INTO GIVING REMAINDER
DIVIDE identifier-1literal-1
INTO identifier-2literal-2
GIVING identifier-3ROUNDED
REMAINDER identifier-4
SIZE ERROR imperative-statement-1
ON
NOT SIZE ERROR imperative-statement-2
ONEND-DIVIDE
DIVIDE Statement - Format 5 - BY GIVING REMAINDER
DIVIDE identifier-1literal-1
BY identifier-2literal-2
GIVING identifier-3ROUNDED
REMAINDER identifier-4
SIZE ERROR imperative-statement-1
ON
Procedure Division Statements
64 ILE COBOL Reference Summary
NOT SIZE ERROR imperative-statement-2
ONEND-DIVIDE
DROP StatementIBM Extension
DROP Statement - Format
DROP identifierliteral
FROM file-name
End of IBM Extension
ENTER StatementENTER Statement - Format
(1)
ENTER language-name .routine-name
Notes:
1 Syntax-checked only.
EVALUATE StatementEVALUATE Statement - Format
EVALUATE identifier-1literal-1expression-1TRUEFALSE
ALSO identifier-2literal-2expression-2TRUEFALSE
WHEN phrase imperative-stmt-1
ALSO phrase
Procedure Division Statements
Chapter 6. Procedure Division 65
WHEN OTHER imperative-stmt-2 END-EVALUATE
WHEN phrase:
WHEN ANYcondition-1TRUEFALSE
identifier-3NOT literal-3 THROUGH identifier-4
arith-expr-1 THRU literal-4arith-expr-2
ALSO phrase:
ALSO ANYcondition-2TRUEFALSE
identifier-5NOT literal-5 THROUGH identifier-6
arith-expr-3 THRU literal-6arith-expr-4
EXIT StatementEXIT Statement - Format
EXIT
EXIT PROGRAM StatementEXIT PROGRAM Statement
EXIT PROGRAM(1)
AND CONTINUE RUN UNIT
Notes:
1 IBM Extension
Procedure Division Statements
66 ILE COBOL Reference Summary
GOBACK StatementIBM Extension
GOBACK Statement - Format
GOBACK
End of IBM Extension
GO TO StatementGO TO Statement - Format 1 - Unconditional
GO procedure-nameTO
GO TO Statement - Format 2 - Conditional
GOTO
procedure-name-1 DEPENDING identifierON
GO TO Statement - Format 3 - Altered
GO .TO
IF StatementIF Statement Format
IF conditionTHEN
Procedure Division Statements
Chapter 6. Procedure Division 67
statement-1NEXT SENTENCE
ELSE statement-2NEXT SENTENCE
statement-1 ELSE statement-2END-IF
END-IF
INITIALIZE StatementINITIALIZE Statement - Format
INITIALIZE identifier-1
REPLACING ALPHABETIC BY PhraseALPHANUMERICNUMERICALPHANUMERIC-EDITEDNUMERIC-EDITED
(1)DBCS
(1)DBCS-EDITED
(1)NATIONAL
BY Phrase:
BYDATA
identifier-2literal-1
Notes:
1 IBM Extension
INSPECT StatementINSPECT Statement - Format 1
INSPECT identifier-1 TALLYING
Procedure Division Statements
68 ILE COBOL Reference Summary
identifier-2 FOR CHARACTERSphrase 1
ALL phrase 2LEADING
phrase 1:
BEFOREAFTER INITIAL
identifier-4literal-2
phrase 2:
identifier-3literal-1
BEFORE identifier-4AFTER INITIAL literal-2
INSPECT Statement - Format 2
INSPECT identifier-1 REPLACING
CHARACTERS BY identifier-5literal-3 phrase 1
ALL phrase 2LEADINGFIRST
phrase 1:
BEFOREAFTER INITIAL
identifier-4literal-2
phrase 2:
identifier-3literal-1
BY identifier-5literal-3
Procedure Division Statements
Chapter 6. Procedure Division 69
BEFORE identifier-4AFTER INITIAL literal-2
INSPECT Statement - Format 3
INSPECT identifier-1 TALLYING
identifier-2 FOR CHARACTERSphrase 1
ALL phrase 2LEADING
REPLACING
CHARACTERS BY identifier-5literal-3 phrase 1
ALL phrase 3LEADINGFIRST
phrase 1:
BEFOREAFTER INITIAL
identifier-4literal-2
phrase 2:
identifier-3literal-1
BEFORE identifier-4AFTER INITIAL literal-2
Procedure Division Statements
70 ILE COBOL Reference Summary
phrase 3:
identifier-3literal-1
BY identifier-5literal-3
BEFORE identifier-4AFTER INITIAL literal-2
INSPECT Statement - Format 4
INSPECT identifier-1 CONVERTING identifier-6literal-4
TO identifier-7literal-5
BEFORE identifier-4AFTER INITIAL literal-2
MERGE StatementMERGE Statement Format
MERGE file-name-1
ASCENDING data-name-1ON DESCENDING KEY
SEQUENCE alphabet-name
COLLATING IS
USING file-name-2 file-name-3
OUTPUT PROCEDURE Phrase
GIVING file-name-4
OUTPUT PROCEDURE Phrase:
OUTPUT PROCEDURE procedure-name-1IS
Procedure Division Statements
Chapter 6. Procedure Division 71
THROUGH procedure-name-2THRU
MOVE StatementMOVE Statement - Format 1
MOVE identifier-1literal-1
TO identifier-2
MOVE Statement Format 2
MOVE CORRESPONDINGCORR
identifier-1 TO identifier-2
MULTIPLY StatementMULTIPLY Statement - Format 1
MULTIPLY identifier-1literal-1
BY identifier-2ROUNDED
SIZE ERROR imperative-statement-1
ON
NOT SIZE ERROR imperative-statement-2
ONEND-MULTIPLY
MULTIPLY Statement - Format 2 - GIVING
MULTIPLY identifier-1literal-1
BY identifier-2literal-2
GIVING identifier-3ROUNDED
Procedure Division Statements
72 ILE COBOL Reference Summary
SIZE ERROR imperative-statement-1
ON
NOT SIZE ERROR imperative-statement-2
ONEND-MULTIPLY
OPEN StatementOPEN Statement Format 1 Sequential
OPEN
INPUT file-name-1REVERSED
NO REWINDWITH
OUTPUT file-name-2NO REWIND
WITH
I-O file-name-3
EXTEND file-name-4
OPEN Statement - Format 2 - Indexed and Relative
OPEN
INPUT file-name-1
OUTPUT file-name-2
I-O file-name-3
Procedure Division Statements
Chapter 6. Procedure Division 73
IBM Extension
OPEN Statement - Format 3 - TRANSACTION
OPEN I-O file-name-3
End of IBM Extension
PERFORM StatementPERFORM Statement - Format 1
PERFORM procedure-name-1THROUGH procedure-name-2THRU
imperative-statement END-PERFORM
PERFORM Statement - Format 2
PERFORM
procedure-name-1 phrase 1THROUGH procedure-name-2THRU
phrase 1 imperative-statement END-PERFORM
phrase-1:
identifier-1integer-1
TIMES
PERFORM Statement - Format 3
PERFORM
procedure-name-1 phrase 2THROUGH procedure-name-2THRU
phrase 2 imperative-statement END-PERFORM
Procedure Division Statements
74 ILE COBOL Reference Summary
phrase 2:
TEST BEFOREWITH AFTER
UNTIL condition-1
PERFORM Statement - Format 4
PERFORM
procedure-name-1 phrase 3THROUGH procedure-name-2THRU
phrase 3 imperative-statement-1 END-PERFORM
phrase 3:
TEST BEFOREWITH AFTER
VARYING identifier-2index-name-1
FROM
identifier-3index-name-2literal-1
BY identifier-4literal-2
UNTIL condition-1
phrase 4
phrase 4:
AFTER identifier-5index-name-3
FROM identifier-6index-name-4literal-3
BY identifier-7literal-4
UNTIL condition-2
READ StatementREAD - Format 1 - Sequential Retrieval/Access
READ file-nameNEXT RECORD INTO identifier-1
Procedure Division Statements
Chapter 6. Procedure Division 75
(1)
NO LOCKWITH
(1)FORMAT identifier-2
IS literal-1
(1)
NULL-KEY-MAP identifier-5IS
(1)
NULL-MAP identifier-6IS
END imperative-statement-1
AT
NOT END imperative-statement-2
ATEND-READ
Notes:
1 IBM Extension.
READ - Format 2 - Sequential Ret./Dynamic Access
READ file-name NEXT(1)
FIRST(1)
LAST(1)
PRIOR
RECORD INTO identifier-1
(1)
NO LOCKWITH
(1)FORMAT identifier-2
IS literal-1
(1)
NULL-KEY-MAP identifier-5IS
Procedure Division Statements
76 ILE COBOL Reference Summary
(1)
NULL-MAP identifier-6IS
END imperative-statement-1
AT
NOT END imperative-statement-2
ATEND-READ
Notes:
1 IBM Extension
READ Statement - Format 3 - Random Retrieval
READ file-nameRECORD INTO identifier-1
(1)
NO LOCKWITH
(2)KEY data-name-1
IS
(1)
FORMAT identifier-2IS literal-1
(1)
NULL-KEY-MAP identifier-5IS
(1)
NULL-MAP identifier-6IS
INVALID imperative-statement-1
KEY
Procedure Division Statements
Chapter 6. Procedure Division 77
NOT INVALID imperative-statement-2
KEYEND-READ
Notes:
1 IBM Extension
2 Syntax-checked only.
IBM Extension
READ Statement - Format 4 - Transaction (Nonsubfile)
READ file-nameRECORD INTO identifier-1
FORMAT identifier-2
IS literal-1TERMINAL identifier-3
IS literal-2
INDICATOR identifier-4INDICATORS ISINDIC ARE
NO DATA imperative-statement-1 END imperative-statement-2
AT
NOT END imperative-statement-3
ATEND-READ
READ - Format 5a - Transaction (Subfile Sequential)
READ SUBFILE file-name MODIFIEDNEXT RECORD
INTO identifier-1 FORMAT identifier-2
IS literal-1
TERMINAL identifier-3
IS literal-2
Procedure Division Statements
78 ILE COBOL Reference Summary
INDICATOR identifier-4INDICATORS ISINDIC ARE
END imperative-statement-3
AT
NOT END imperative-statement-4
ATEND-READ
READ - Format 5b - Transaction (Subfile Random)
READ SUBFILE file-nameRECORD INTO identifier-1
FORMAT identifier-2
IS literal-1TERMINAL identifier-3
IS literal-2
INDICATOR identifier-4INDICATORS ISINDIC ARE
INVALID imperative-statement-1
KEY
NOT INVALID imperative-statement-2
KEYEND-READ
End of IBM Extension
RELEASE StatementRELEASE Statement - Format
RELEASE record-name-1FROM identifier-1
Procedure Division Statements
Chapter 6. Procedure Division 79
RETURN StatementRETURN Statement - Format
RETURN file-name-1RECORD INTO identifier-1
END imperative-statement-1AT
NOT END imperative-statement-2
ATEND-RETURN
REWRITE StatementREWRITE Statement - Format 1
REWRITE record-name-1FROM identifier-1
(1)
FORMAT identifier-2IS literal-1
(1)
NULL-KEY-MAP identifier-5IS
(1)
NULL-MAP identifier-6IS
INVALID imperative-statement-1
KEY
NOT INVALID imperative-statement-2
KEYEND-REWRITE
Notes:
1 IBM Extension
Procedure Division Statements
80 ILE COBOL Reference Summary
IBM Extension
REWRITE Statement - Format 2 - Transaction (Subfile)
REWRITE SUBFILE record-name-1FROM identifier-1
FORMAT identifier-2
IS literal-1TERMINAL identifier-3
IS literal-2
INDICATOR identifier-4INDICATORS ISINDIC ARE
INVALID imperative-statement-1
KEY
NOT INVALID imperative-statement-2
KEYEND-REWRITE
End of IBM Extension
ROLLBACK StatementIBM Extension
ROLLBACK Statement - Format
ROLLBACK
End of IBM Extension
SEARCH StatementSEARCH Statement - Format 1 - Serial Search
SEARCH identifier-1VARYING identifier-2
index-name-1
END imperative-statement-1
AT
Procedure Division Statements
Chapter 6. Procedure Division 81
WHEN condition-1 imperative-statement-2NEXT SENTENCE
WHEN condition-1 imperative-statement-2END-SEARCH
SEARCH Statement - Format 2 - Binary Search
SEARCH ALL identifier-1END imperative-statement-1
AT
WHEN equal phrase 1condition-name-1
AND equal phrase 2condition-name-2
imperative-statement-2
NEXT SENTENCEEND-SEARCH
equal phrase 1:
data-name-1IS
EQUALTO
=
identifier-3literal-1arithmetic-expression-1
equal phrase 2:
data-name-2IS
EQUALTO
=
identifier-4literal-2arithmetic-expression-2
SET StatementSET Statement - Format 1
SET index-name-1identifier-1
TO index-name-2identifier-2integer-1
Procedure Division Statements
82 ILE COBOL Reference Summary
SET Statement - Format 2
SET index-name-3 UP BYDOWN BY
identifier-3integer-2
SET Statement - Format 3
SET mnemonic-name-1 TO ONOFF
SET Statement - Format 4
SET condition-name-1 TO TRUE
IBM Extension
SET Statement - Format 5
SET identifier-4ADDRESS OF identifier-5
TO identifier-6ADDRESS OF identifier-7NULLNULLS
SET Statement - Format 6
SET procedure-pointer-data-item-1
TO procedure-pointer-data-item-2ENTRY identifier-1 Library Phrase
literal-1Linkage Phrase
NULLNULLS
Linkage Phrase:
Procedure Division Statements
Chapter 6. Procedure Division 83
LINKAGE environment-name-1TYPE IS PROGRAM
PROCEDUREPROGRAMPROCEDURE
Library Phrase:
LIBRARY identifier-2IN literal-2
SET Statement - Format 7
SET pointer-data-item UP BYDOWN BY
identifier-8integer-3LENGTH OF identifier-9
Set Statement - Format 8
SET LOCALE LC_ALLLC_COLLATELC_CTYPELC_MESSAGESLC_MONETARYLC_NUMERICLC_TIMELC_TOD
INTO identifier-10
LIBRARY identifier-11IN
FROM DEFAULT
identifier-12LIBRARY identifier-13
INmnemonic-name-2
End of IBM Extension
Procedure Division Statements
84 ILE COBOL Reference Summary
SORT StatementSORT Statement - Format
SORT file-name-1
ASCENDING data-name-1ON DESCENDING KEY
DUPLICATES
WITH IN ORDER
SEQUENCE alphabet-name
COLLATING IS
USING file-name-2input procedure phrase
GIVING file-name-3output procedure phrase
input procedure phrase:
INPUT PROCEDURE procedure-name-1IS
THROUGH procedure-name-2THRU
output procedure phrase:
OUTPUT PROCEDURE procedure-name-3IS
THROUGH procedure-name-4THRU
Procedure Division Statements
Chapter 6. Procedure Division 85
START StatementSTART Statement - Format
START file-name-1(1)
NO LOCKWITH
KEY EQUAL data
IS TO=GREATER
THAN>NOT LESS
THANNOT =
(1) (2)
FORMAT identifier-1IS literal-1
(1)
NULL-KEY-MAP identifier-2IS
INVALID imperative-statement-1
KEY
NOT INVALID imperative-statement-2
KEYEND-START
data:
(1)EXTERNALLY-DESCRIBED-KEY
data-name-1
Notes:
1 IBM Extension
Procedure Division Statements
86 ILE COBOL Reference Summary
2 Applies only to indexed files on DATABASE devices
STOP StatementSTOP Statement - Format
STOP RUNliteral
STRING StatementSTRING Statement - Format
STRING identifier-1 DELIMITED identifier-2literal-1 BY literal-2
SIZE
INTO identifier-3POINTER identifier-4
WITH
OVERFLOW imperative-statement-1
ON
NOT OVERFLOW imperative-statement-2
ONEND-STRING
SUBTRACT StatementSUBTRACT Statement - Format 1
SUBTRACT identifier-1literal-1
FROM identifier-2ROUNDED
SIZE ERROR imperative-statement-1
ON
Procedure Division Statements
Chapter 6. Procedure Division 87
NOT SIZE ERROR imperative-statement-2
ONEND-SUBTRACT
SUBTRACT Statement - Format 2 - GIVING
SUBTRACT identifier-1literal-1
FROM identifier-2literal-2
GIVING identifier-3ROUNDED
SIZE ERROR imperative-statement-1
ON
NOT SIZE ERROR imperative-statement-2
ONEND-SUBTRACT
SUBTRACT Statement - Format 3 - CORRESPONDING
SUBTRACT CORRESPONDINGCORR
identifier-1 FROM identifier-2ROUNDED
SIZE ERROR imperative-statement-1
ON
NOT SIZE ERROR imperative-statement-2
ONEND-SUBTRACT
UNSTRING StatementUNSTRING Statement - Format
UNSTRING identifier-1
Procedure Division Statements
88 ILE COBOL Reference Summary
DELIMITED identifier-2 OR Phrase
BY ALL literal-1
INTO
identifier-4 DELIMITER Phrase COUNT Phrase
POINTER identifier-7
WITHTALLYING identifier-8
IN
OVERFLOW imperative-statement-1
ON
NOT OVERFLOW imperative-statement-2
ONEND-UNSTRING
OR Phrase:
OR identifier-3ALL literal-2
DELIMITER Phrase:
DELIMITER identifier-5IN
COUNT Phrase:
COUNT identifier-6IN
WRITE StatementWRITE Statement - Format 1 - Sequential Files
WRITE record-name-1FROM identifier-1
Procedure Division Statements
Chapter 6. Procedure Division 89
BEFORE identifier-2AFTER ADVANCING integer-1 LINE
LINESmnemonic-name-1PAGE
(1)
NULL-MAP identifier-9IS
END-OF-PAGE imperative-statement-1
AT EOP
NOT END-OF-PAGE imperative-statement-2
AT EOPEND-WRITE
Notes:
1 IBM Extension.
WRITE - Format 2 - Indexed and Relative Files
WRITE record-name-1FROM identifier-1
(1)
FORMAT identifier-2IS literal-1
(1)
NULL-KEY-MAP identifier-8IS
(1)
NULL-MAP identifier-9IS
INVALID imperative-statement-1
KEY
Procedure Division Statements
90 ILE COBOL Reference Summary
NOT INVALID imperative-statement-2
KEYEND-WRITE
Notes:
1 IBM Extension
IBM Extension
WRITE Statement - Format 3 - FORMATFILE
WRITE record-name-1FROM identifier-1
FORMAT identifier-2
IS literal-1
INDICATOR identifier-3INDICATORS ISINDIC ARE
END-OF-PAGE imperative-statement-1
AT EOP
NOT END-OF-PAGE imperative-statement-2
AT EOPEND-WRITE
WRITE - Format 4 - TRANSACTION (Nonsubfile)
WRITE record-name-1FROM identifier-1
FORMAT identifier-2IS literal-1 TERMINAL identifier-3
IS literal-2
STARTING identifier-4
AT LINE literal-3Rolling Phrase
Procedure Division Statements
Chapter 6. Procedure Division 91
INDICATOR identifier-8INDICATORS ISINDIC ARE
END-WRITE
Rolling Phrase:
BEFOREAFTER
ROLLINGLINESLINE
identifier-5literal-4 THROUGH
THRU
identifier-6literal-5
UPDOWN
identifier-7literal-6 LINES
LINE
WRITE Statement - Format 5 - TRANSACTION (Subfile)
WRITE SUBFILE record-name-1FROM identifier-1
FORMAT identifier-2IS literal-1 TERMINAL identifier-3
IS literal-2
INDICATOR identifier-4INDICATORS ISINDIC ARE
INVALID imperative-statement-1
KEY
NOT INVALID imperative-statement-2
KEYEND-WRITE
End of IBM Extension
Intrinsic FunctionsThis is the general syntax for intrinsic functions.
Procedure Division Statements
92 ILE COBOL Reference Summary
Function-IdentifierFormat
FUNCTION function-name-1
( argument-1 )
reference-modifier
These following intrinsic functions are presented in alphabetical order.
ACOS FunctionFormat
FUNCTION ACOS (argument-1)
ADD-DURATION FunctionIBM Extension
Format
FUNCTION ADD-DURATION ( argument-1 argument-2 argument-3 )
End of IBM Extension
ASIN FunctionFormat
FUNCTION ASIN (argument-1)
ATAN FunctionFormat
FUNCTION ATAN (argument-1)
Intrinsic Functions
Chapter 6. Procedure Division 93
CHAR FunctionFormat
FUNCTION CHAR (argument-1)
CONVERT-DATE-TIME FunctionIBM Extension
Format
FUNCTION CONVERT-DATE-TIME
( argument-1 argument-2 )argument-3
argument-4
End of IBM Extension
COS FunctionFormat
FUNCTION COS (argument-1)
CURRENT-DATE FunctionFormat
FUNCTION CURRENT-DATE
DATE-OF-INTEGER FunctionFormat
FUNCTION DATE-OF-INTEGER (argument-1)
DAY-OF-INTEGER FunctionFormat
FUNCTION DAY-OF-INTEGER (argument-1)
Intrinsic Functions
94 ILE COBOL Reference Summary
DATE-TO-YYYYMMDD FunctionIBM Extension
Format
FUNCTION DATE-TO-YYYYMMDD (argument-1 )argument-2
End of IBM Extension
DAY-TO-YYYYDDD FunctionIBM Extension
Format
FUNCTION DAY-TO-YYYYDDD (argument-1 )argument-2
End of IBM Extension
EXTRACT-DATE-TIME FunctionIBM Extension
Format
FUNCTION EXTRACT-DATE-TIME ( argument-1 argument-2 )
End of IBM Extension
FIND-DURATION FunctionIBM Extension
Format
FUNCTION FIND-DURATION ( argument-1 argument-2 argument-3 )
End of IBM Extension
Intrinsic Functions
Chapter 6. Procedure Division 95
INTEGER-OF-DATE FunctionFormat
FUNCTION INTEGER-OF-DATE (argument-1)
INTEGER-OF-DAY FunctionFormat
FUNCTION INTEGER-OF-DAY (argument-1)
LENGTH FunctionFormat
FUNCTION LENGTH (argument-1)
LOCALE-DATE FunctionIBM Extension
FUNCTION LOCALE-DATE ( argument-1 )mnemonic-name-1
End of IBM Extension
LOCALE-TIME FunctionIBM Extension
FUNCTION LOCALE-TIME ( argument-1 )mnemonic-name-1
End of IBM Extension
LOG FunctionFormat
FUNCTION LOG (argument-1)
Intrinsic Functions
96 ILE COBOL Reference Summary
LOG10 FunctionFormat
FUNCTION LOG10 (argument-1)
LOWER-CASE FunctionFormat
FUNCTION LOWER-CASE (argument-1)
MEAN FunctionFormat
FUNCTION MEAN ( argument-1 )
NUMVAL FunctionFormat
FUNCTION NUMVAL (argument-1)
Argument-1 can have one of the following formats:
space +
-space
digit.
digit. digit
space
space
digit.
digit. digit
space +-CRDB
space
Intrinsic Functions
Chapter 6. Procedure Division 97
NUMVAL-C FunctionFormat
FUNCTION NUMVAL-C ( argument-1 )argument-2
The format for argument-1 is one of the following two formats, where cs is thecurrency sign specified in argument-2:
space +
-space cs space
digit.
digit, digit
. digit
space
space cs space
digit.
digit, digit
. digit
space +-CRDB
space
ORD FunctionFormat
FUNCTION ORD (argument-1)
REVERSE FunctionFormat
FUNCTION REVERSE (argument-1)
Intrinsic Functions
98 ILE COBOL Reference Summary
SIN FunctionFormat
FUNCTION SIN (argument-1)
SQRT FunctionFormat
FUNCTION SQRT (argument-1)
SUBTRACT-DURATION FunctionIBM Extension
Format
FUNCTION SUBTRACT-DURATION
( argument-1 argument-2 argument-3 )
End of IBM Extension
TAN FunctionFormat
FUNCTION TAN (argument-1)
TEST-DATE-TIME FunctionIBM Extension
Format
FUNCTION TEST-DATE-TIME
Intrinsic Functions
Chapter 6. Procedure Division 99
( argument-1 )argument-2
argument-3argument-4
End of IBM Extension
UPPER-CASE FunctionFormat
FUNCTION UPPER-CASE (argument-1)
WHEN-COMPILED FunctionFormat
FUNCTION WHEN-COMPILED
YEAR-TO-YYYY FunctionIBM Extension
Format
FUNCTION YEAR-TO-YYYY (argument-1 )argument-2
End of IBM Extension
Intrinsic Functions
100 ILE COBOL Reference Summary
Chapter 7. Conditional ExpressionsClass Condition - Format
identifierIS NOT
NUMERICALPHABETICALPHABETIC-LOWERALPHABETIC-UPPER
(1)DBCS
(1)KANJIclass-name
Notes:
1 IBM Extension
Condition-Name Condition - Format
condition-name
Relation Condition - Format
operand-1IS (1)
NOT
GREATERTHAN
>LESS
THAN=LESS OR EQUAL
THAN TO=, NOT LESS THAN OR EQUAL TO, and NOT
IBM Extension
The following two syntax diagrams apply to pointer data items andprocedure-pointer data items, respectively.
ADDRESS Comparison - Format
ADDRESS OF identifier-1identifier-2NULLNULLS
IS NOTEQUAL
TO=
ADDRESS OF identifier-3identifier-4NULLNULLS
Procedure-Pointer Comparison - Format
identifier-1NULLNULLS
IS NOTEQUAL
TO=
identifier-2NULLNULLS
End of IBM Extension
Sign Condition - Format
operand-1IS NOT
POSITIVENEGATIVEZERO
Switch-Status Condition - Format
condition-name
Negated Simple Condition - Format
NOT simple-condition
Combined Conditions - Format
condition-1 AND condition-2OR
102 ILE COBOL Reference Summary
Abbreviated Combined Relation Conditions - Format
relation-condition
AND objectOR IS (1) GREATER
NOT THAN>LESS
THAN=
less or equal=, NOT LESS THAN OR EQUAL TO, and NOT
104 ILE COBOL Reference Summary
Chapter 8. Qualifying Data Reference FormatsFormat 1 - Identifier
data-name-1
IN data-name-2OF
IN file-name-1OF
( subscript )
( leftmost-character-position: )
length
Format 2 - LINAGE-COUNTER
LINAGE-COUNTERIN file-name-2OF
Format 3 - condition-name
condition-name-1
IN data-name-1OF
IN file-name-1OF
( subscript )
QualificationReferences to Data Division Names - Format 1
data-name-1condition-name
IN data-name-2OF
Copyright IBM Corp. 1993, 2001 105
IN file-name-1OF
References to Data Division Names - Format 2
LINAGE-COUNTERIN file-name-2OF
References to Procedure Division Names - Format 1
paragraph-nameIN section-nameOF
References to Procedure Division Names - Format 2
section-name
References to COPY Libraries - Format 3
text-name(1)
library-name- file-nameINOF
Notes:
1 Required hyphen between library-name-file-name to qualify
Reference ModificationFormat
data-name-1FUNCTION function-name-1
( argument-1 )
( leftmost-character-position: )length
106 ILE COBOL Reference Summary
SubscriptingSubscripting - Format
condition-name-1data-name-1
IN data-name-2OF
IN file-name-1OF
( integer-1 )ALLdata-name-3
+ integer-2
index-name-1+ integer-3
Chapter 8. Qualifying Data Reference Formats 107
108 ILE COBOL Reference Summary
Chapter 9. Compiler-Directing StatementsCONTROL Statement
IBM Extension
*CONTROL (*CBL) Statement - Format
*CONTROL*CBL
SOURCENOSOURCE
(1)LIST
(1)NOLIST
(1)MAP
(1)NOMAP
.
Notes:
1 Syntax-checked only.
End of IBM Extension
COPY StatementCOPY Statement - Format 1
COPY text-nameOF file-nameIN (1)
library-name-
(2)
SUPPRESS
.REPLACING Phrase
Notes:
1 Required hyphen between library-name-file-name to qualify.
2 IBM Extension
REPLACING Phrase - Format
Copyright IBM Corp. 1993, 2001 109
REPLACING ==pseudo-text-1== BY ==pseudo-text-2==identifier-1 identifier-2literal-1 literal-2word-1 word-2
IBM Extension
COPY Statement - Format 2 - DDS Translate
COPY DD-format-nameDD-ALL-FORMATSDDR-format-nameDDR-ALL-FORMATSDDS-format-nameDDS-ALL-FORMATSDDSR-format-nameDDSR-ALL-FORMATS
-I-O-I-O
-INDICATOR-INDICATORS-INDIC
OFIN
file-name(1) WITH
library-name-
I-FIELDSO-FIELDSI-O-FIELDSINDICATORINDICATORSINDIC
NULL-MAPNULL-MAP-ALPHANUMNULL-KEY-MAPPREFIX BY literalALIAS
SUBSTITUTE PhraseVLR
.SUPPRESS REPLACING Phrase
SUBSTITUTE Phrase:
SUBSTITUTEALL
EXCEPT literal-2
Notes:
1 Required hyphen between library-name-file-name to qualify.
End of IBM Extension
110 ILE COBOL Reference Summary
EJECT StatementIBM Extension
EJECT Statement - Format
EJECT.
End of IBM Extension
REPLACE StatementREPLACE Statement - Format 1
REPLACE ==pseudo-text-1== BY ==pseudo-text-2== .
REPLACE Statement - Format 2
REPLACE OFF .
SKIP StatementIBM Extension
SKIP1/2/3 Statements - Format
SKIP1SKIP2SKIP3
.
End of IBM Extension
TITLE Statemen