ILE COBOL Language Reference
COBOL Language Structure
Characters
Character-Strings
COBOL Words with DBCS Character
COBOL Words
Literals
PICTURE Character-Strings
Comment-Entry Text
Separators
Rules for Separators
Sections and Paragraphs
SECTION
Entries
Clauses
Sentences
Statements
Phrases
Reference Format
Sequence Number Area (Columns 1 through 6)
Indicator Area (Column 7)
Area A (Columns 8 through 11)
Division Header
Section Header
Paragraph Header or Paragraph Name
Level Indicator (FD and SD) or Level-Number (01 and 77)
DECLARATIVES and END DECLARATIVES
END PROGRAM Header
Area B (Columns 12 through 72)
Entries, Sentences, Statements, Clauses
Continuation Lines
Area A or Area B
Comment Lines
Debugging Lines
Blank Lines
Pseudo-Text
Compiler-Directing Statements
Comment Area (Columns 73 through 80)
Data Reference and Name Scoping
Methods of Data Reference
Identifier
Qualification
Subscripting
Reference Modification
Function-Identifier
User-Defined Data Types
Scope of Names
Types of Names
Nested Programs
Global and Local Names
External and Internal Objects
Data Attribute Specification
Resolution of Names
Conventions for Program-Names
Transfer of Control
Next Executable Statement
COBOL Program Structure
General Structure
END PROGRAM Header
Identification Division
Identification Division
PROGRAM-ID Paragraph
program-name
literal
RECURSIVE Clause
COMMON Clause
INITIAL Clause
Optional Paragraphs
comment-entry
Environment Division
Configuration Section
Coding Example
SOURCE-COMPUTER Paragraph
computer-name
WITH DEBUGGING MODE Clause
OBJECT-COMPUTER Paragraph
SPECIAL-NAMES Paragraph
Coding Example
ALPHABET Clause
Coding Examples
CLASS Clause
CONSOLE Clause
CRT STATUS Clause
CRT STATUS Clause Considerations
CURRENCY SIGN Clause
CURSOR Clause
CURSOR Clause Considerations
DECIMAL-POINT IS COMMA Clause
FORMAT
FORMAT Clause
SIZE Phrase
LOCALE Phrases
LOCALE Phrase
LINKAGE TYPE Clause
LINKAGE TYPE Clause Considerations
LOCALE Clause
PROGRAM STATUS Clause
Input-Output Section
File Categories
Database Files
Device Files
DDM Files
Save Files
Paragraphs
FILE-CONTROL Paragraph
FILE-CONTROL Paragraph - Format 1 - Sequential Files
FILE-CONTROL Paragraph - Format 2 - Relative Files
FILE-CONTROL Paragraph - Format 3 - Indexed Files
FILE-CONTROL Paragraph - Format 4 - Sort or Merge Files
FILE-CONTROL Paragraph - Format 5 - Transaction Files
SELECT Clause
ASSIGN Clause
Device
File Name
Attribute
RESERVE Clause
ORGANIZATION Clause
ORGANIZATION IS SEQUENTIAL (Format 1)
ORGANIZATION IS RELATIVE (Format 2)
ORGANIZATION IS INDEXED (Format 3)
ORGANIZATION IS TRANSACTION (Format 4)
PADDING CHARACTER Clause
RECORD DELIMITER Clause
ACCESS MODE Clause
ACCESS MODE Clause - Format 1 - Sequential Files
ACCESS MODE Clause - Format 2 - Relative Files
ACCESS MODE Clause - Format 3 - Indexed Files
ACCESS MODE Clause - Format 4 - Transaction Files
Data Organization and Access Modes
Data Organization
Access Modes
Relationship Between Data Organizations and Access Modes
RECORD KEY Clause
DUPLICATES Phrase
EXTERNALLY-DESCRIBED-KEY
ALTERNATE RECORD KEY
Usage Considerations
RELATIVE KEY Clause
FILE STATUS Clause
CONTROL-AREA Clause
I-O-CONTROL Paragraph
I-O-CONTROL Paragraph - Format 1 - Sequential Files
I-O-CONTROL Paragraph - Format 2 - Relative and Indexed Files
I-O-CONTROL Paragraph - Format 3 - Sort or Merge Files
RERUN Clause
SAME AREA Clause
SAME RECORD AREA Clause
SAME SORT AREA Clause
SAME SORT-MERGE AREA Clause
MULTIPLE FILE TAPE Clause
COMMITMENT CONTROL Clause
Data Division
Data Division Overview
Data Division Structure
File Section
Working-Storage Section
Local-Storage Section
Linkage Section
ADDRESS OF
Types of Data
File Data
Program Data
Data Relationships
Levels of Data
Classes and Categories of Data
Alignment Rules
Standard Data Format
Character-String and Item Size
Signed Data
Data Division--File and Sort Description Entries
File Description Entry - Format 1 - Sequential File
File Description Entry - Format 2 - Diskette File
File Description Entry - Format 3 - Tapefile
File Description Entry - Format 4 - Printer File
Sort Description Entry - Format 5 - Sort or Merge Files
File Description Entry - Format 6 - Transaction Files
File Section
EXTERNAL Clause
Considerations for External Files
GLOBAL Clause
BLOCK CONTAINS Clause
RECORD Clause
RECORD clause - Format 1
RECORD clause - Format 2
RECORD clause - Format 3
For Tape Files
For All Other Files
General Considerations for all Formats
LABEL RECORDS Clause
VALUE OF Clause
DATA RECORDS Clause
LINAGE Clause
Illustration of LINAGE clause phrases
LINAGE-COUNTER Special Register
CODE-SET Clause
Data Division--Data Description Entry
Format 1
Format 2
Format 3
Format 4
Format 5
CONSTANT Clause
LIKE Clause
OCCURS Clause
INDICATOR Clause
VALUE Clause
Level-Numbers
BLANK WHEN ZERO Clause
EXTERNAL Clause
FORMAT Clause
SIZE Phrase
USAGE For a Class Date-Time Item
FORMAT Clause and PICTURE CLAUSE Similarities
GLOBAL Clause
Sharing Data
JUSTIFIED Clause
LIKE Clause
Comments Generated Based on Inherited USAGE Characteristics
Rules and Restrictions
Coding Examples
OCCURS Clause
Table Handling Concepts
Limitations
Defining Tables
Referencing Table Elements
Fixed-Length Tables
ASCENDING/DESCENDING KEY Phrase
ASCENDING/DESCENDING KEY Phrase Rules
ASCENDING/DESCENDING KEY Phrase Coding Example
INDEXED BY Phrase
Variable-Length Tables
Subscripting
Restrictions on Subscripting
PICTURE Clause
LOCALE Phrase
Symbols Used in the PICTURE Clause
Character-String Representation
Data Categories and PICTURE Rules
PICTURE Clause Editing
REDEFINES Clause
Redefinition Process
REDEFINES Clause Considerations
Coding Examples
Undefined Results
RENAMES Clause
Illustrations of Valid and Invalid RENAMES Clause Specifications
SIGN Clause
SEPARATE CHARACTER
SYNCHRONIZED Clause
Benefits of Synchronized Data
Specifying the SYNCHRONIZED Clause with the OCCURS Clause
Specifying the SYNCHRONIZED Clause with the REDEFINES Clause
FILLER Items
Example of Implicit FILLER
TYPE Clause
TYPEDEF Clause
USAGE Clause
Computational Items
BINARY Phrase
PACKED-DECIMAL Phrase
COMPUTATIONAL or COMP Phrase
COMPUTATIONAL-1 or COMP-1 Phrase
COMPUTATIONAL-2 or COMP-2 Phrase
COMPUTATIONAL-3 or COMP-3 Phrase (Internal Decimal)
COMPUTATIONAL-4 or COMP-4 Phrase (Binary)
DISPLAY Phrase
DISPLAY-1 Phrase
INDEX Phrase
NATIONAL Phrase
POINTER Phrase
PROCEDURE-POINTER Phrase
VALUE Clause
VALUE Clause - Format 1 - Literal Value
VALUE Clause - Format 2 - Condition-Name Value
VALUE Clause - Format 3 - NULL Value
VALUE
Procedure Division
Procedure Division
Format 1 - with Sections and Paragraphs
Format 2 - with Paragraphs Only
The Procedure Division Header
The USING Phrase
BY REFERENCE
BY VALUE
GIVING/RETURNING Phrase
Declaratives
Procedures
Section
Paragraph
Sample Procedure Division Statements
Arithmetic Expressions
Exponential Expressions
Arithmetic Operators
Conditional Expressions
Simple Conditions
Comparison of Numeric and Nonnumeric Operands
Sign Condition
Switch-Status Condition
Complex Conditions
Statement Categories
Statement Operations
Procedure Division Statements
ACCEPT Statement
Format 1 - Data Transfer
Format 2 - System Information Transfer
Format 3 - Feedback
Format 4 - Local Data Area
Format 5 - Program Initialization Parameters
Format 6 - Attribute Data
Workstation I/O
Format 8 - Session I/O
Format 9 - Data Area
ACQUIRE Statement
ADD Statement
ROUNDED Phrase
SIZE ERROR Phrases
CORRESPONDING Phrase (Format 3)
END-ADD Phrase
ALTER Statement
Coding Example
CALL Statement
LINKAGE TYPE Phrase
IN LIBRARY Phrase
USING Phrase
BY REFERENCE Phrase
BY CONTENT Phrase
BY VALUE Phrase
LENGTH OF Special Register
GIVING/RETURNING phrase
ON EXCEPTION Phrase
NOT ON EXCEPTION Phrase
ON OVERFLOW Phrase
END-CALL Phrase
CALL Statement Considerations
Program Termination Statements
OS/400 Graphics Support
CANCEL Statement
IN LIBRARY Phrase
LINKAGE TYPE Phrase
CLOSE Statement
CLOSE Statement - Format 1
CLOSE Statement - Format 2 - Tape Files
CLOSE Statement Considerations
Special Considerations for Device Type TAPEFILE Only
NO REWIND Phrase
REEL or UNIT Phrase
FOR REMOVAL Phrase
COMMIT Statement
COMPUTE Statement
ROUNDED Phrase
SIZE ERROR Phrases
END-COMPUTE Phrase
CONTINUE Statement
DELETE Statement
DELETE Statement Considerations
Sequential Access Mode
Random or Dynamic Access Mode
FORMAT Phrase
NULL-KEY-MAP IS Phrase
INVALID KEY Phrase
NOT INVALID KEY Phrase
END-DELETE Phrase
DISPLAY Statement
Format 1 - Data Transfer
DISPLAY Statement Behavior
Format 2 - Local Data Area
Format 3 - Extended DISPLAY Statement
Format 4 - Session I/O
Format 5 - Data Area
DIVIDE Statement
ROUNDED Phrase
REMAINDER Phrase
SIZE ERROR Phrases
END-DIVIDE Phrase
DROP Statement
ENTER Statement
EVALUATE Statement
Coding Examples
Interpreting Selection Subjects and Selection Objects
END-EVALUATE Phrase
Determining Values
Comparing Selection Subjects and Objects
Executing the EVALUATE Statement
EXIT Statement
EXIT PROGRAM Statement
AND CONTINUE RUN UNIT Phrase
GOBACK Statement
GO TO Statement
Unconditional GO TO
Conditional GO TO
Altered GO TO
IF Statement
END-IF Phrase
Transferring Control
Nested IF Statements
INITIALIZE Statement
REPLACING Phrase
INITIALIZE Statement Rules
INSPECT Statement
INSPECT Statement - Format 1
INSPECT Statement - Format 2
INSPECT Statement - Format 3
INSPECT Statement - Format 4
INSPECT Statement Considerations
Comparison Rules
INSPECT Example
TALLYING Phrase (Formats 1 and 3)
REPLACING Phrase (Formats 2 and 3)
BEFORE and AFTER Phrases (All Formats)
CONVERTING Phrase (Format 4)
INSPECT Statement Examples
MERGE Statement
ASCENDING/DESCENDING KEY Phrase
COLLATING SEQUENCE Phrase
USING Phrase
GIVING Phrase
OUTPUT PROCEDURE Phrase
SORT-RETURN Special Register
MOVE Statement
MOVE Statement - Format 1
MOVE Statement - Format 2
MOVE Statement Rules
Elementary Moves
Group Moves
WHEN-COMPILED Special Register
MULTIPLY Statement
ROUNDED Phrase
SIZE ERROR Phrases
END-MULTIPLY Phrase
OPEN Statement
OPEN Statement - Format 1 - Sequential
OPEN Statement - Format 2 - Indexed and Relative
OPEN Statement - Format 3 - TRANSACTION
OPEN Statement Considerations
INPUT Phrase (Sequential Files)
OUTPUT Phrase (Sequential Files)
I-O Phrase (Sequential Files)
NO REWIND Phrase (Sequential Files)
REVERSED Phrase (Sequential Files)
EXTEND Phrase (Sequential Files)
INPUT Phrase (Indexed and Relative Files)
OUTPUT Phrase (Indexed and Relative Files)
I-O Phrase (Indexed and Relative Files)
OPEN Statement Programming Notes
PERFORM Statement
Basic PERFORM Statement
PERFORM with TIMES Phrase
PERFORM with UNTIL Phrase
PERFORM with VARYING Phrase
READ Statement
Special Considerations for Device Types DISK and DATABASE
Sequential Access Mode
Dynamic Access Mode
Random Access Mode
READ Statement - Format 1 - Sequential Retrieval/Sequential Access
READ Statement - Format 2 - Sequential Retrieval/Dynamic Access
READ Statement - Format 3 - Random Retrieval
Sequential Files
Relative Files
Indexed Files
Multiple Record Processing
Multivolume Files
Transaction Files
RELEASE Statement
RETURN Statement
AT END Phrases
END-RETURN Phrase
REWRITE Statement
REWRITE Statement - Format 1
REWRITE Statement Considerations
Transaction (Subfile) Format
ROLLBACK Statement
SEARCH Statement
SEARCH Statement - Format 1 - Serial Search
SEARCH Statement - Format 2 - Binary Search
AT END/WHEN Phrases
Condition-1
NEXT SENTENCE Phrase
END-SEARCH Phrase
Serial Search
VARYING Phrase
Binary Search
WHEN Phrase
Search Statement Considerations
SEARCH Example
SET Statement
Format 1 - Initializing Index-names, Identifiers
Format 2 - Adjusting Index Values
Format 3 - Setting External Switches
Format 4 - Condition-names
Format 5 - Pointer Data Item
Format 6 - Procedure-Pointer Data Item
Format 7 - Adjusting Pointers
Format 8 - Locale
SORT Statement
ASCENDING/DESCENDING KEY Phrase
DUPLICATES Phrase
COLLATING SEQUENCE Phrase
USING Phrase
INPUT PROCEDURE Phrase
GIVING Phrase
OUTPUT PROCEDURE Phrase
START Statement
NO LOCK Phrase
KEY Phrase
FORMAT Phrase
NULL-KEY-MAP IS Phrase
INVALID KEY Phrase
NOT INVALID KEY Phrase
END-START Phrase
Indexed Files
Relative Files
STOP Statement
RETURN-CODE Special Register
STRING Statement
DELIMITED BY Phrase
INTO Phrase
POINTER Phrase
ON OVERFLOW Phrases
END-STRING Phrase
Data Flow
STRING Statement Example
SUBTRACT Statement
ROUNDED Phrase
SIZE ERROR Phrases
CORRESPONDING Phrase (Format 3)
END-SUBTRACT Phrase
UNSTRING Statement
DELIMITED BY Phrase
INTO Phrase
POINTER Phrase
TALLYING IN Phrase
ON OVERFLOW Phrases
END-UNSTRING Phrase
Data Flow
UNSTRING Statement Example
WRITE Statement
Sequential Files
Indexed and Relative Files
XML GENERATE Statement
Nested XML GENERATE or XML PARSE statements
Operation of XML GENERATE
XML element name formation
XML PARSE Statement
Control flow
Processing procedures
Coded character sets for XML documents
Special Registers
Intrinsic Functions
Function Definition and Evaluation
Specifying a Function
Types of Functions
Rules for Usage
Arguments
Order of Precedence for the Evaluation of Function Arguments
ALL Subscripting
Function Definitions
ACOS
ADD-DURATION
Examples
ANNUITY
ASIN
ATAN
CHAR
CONVERT-DATE-TIME
Examples
COS
CURRENT-DATE
DATE-OF-INTEGER
DAY-OF-INTEGER
DATE-TO-YYYYMMDD
Examples
DAY-TO-YYYYDDD
Examples
DISPLAY-OF
EXTRACT-DATE-TIME
Examples
FACTORIAL
FIND-DURATION
Examples
INTEGER
INTEGER-OF-DATE
INTEGER-OF-DAY
INTEGER-PART
LENGTH
LOCALE-DATE
Returned Values
LOCALE-TIME
Returned Values
LOG
LOG10
LOWER-CASE
MAX
MEAN
MEDIAN
MIDRANGE
MIN
MOD
NATIONAL-OF
NUMVAL
NUMVAL-C
ORD
ORD-MAX
ORD-MIN
PRESENT-VALUE
RANDOM
RANGE
REM
REVERSE
SIN
SQRT
STANDARD-DEVIATION
SUBTRACT-DURATION
Examples
SUM
TAN
TEST-DATE-TIME
Examples
TRIM
Returned Values
Examples:
TRIML
TRIMR
UPPER-CASE
UTF8STRING
VARIANCE
WHEN-COMPILED
YEAR-TO-YYYY
Examples
Compiler-Directing Statements
Compiler-Directing Statements
*CONTROL (*CBL) Statement
*CONTROL (*CBL) and the COPY Statement
COPY Statement
COPY Statement - Format 1 - Basic
SUPPRESS Phrase
REPLACING Phrase
Replacement and Comparison Rules
Coding Examples
COPY Statement - Format 2 - DDS Translate
COPY Statement - Format 3 - Basic IFS
EJECT Statement
REPLACE Statement
Replacing Algorithm
Programming Notes
SKIP1/2/3 Statements
TITLE Statement
USE Statement
USE Statement - Format 1 - EXCEPTION/ERROR
USE Statement Programming Notes
Precedence Rules for Nested Programs
USE FOR DEBUGGING
Appendixes
Appendix A. ILE COBOL Compiler Limits
Appendix B. Intermediate Results and Arithmetic Precision
Calculating Precision of Intermediate Results
Compiler Calculation of Intermediate Results
Integer Functions
Mixed Functions
Floating-Point Data and Intermediate Results
Appendix C. EBCDIC and ASCII Collating Sequences
EBCDIC Collating Sequence
ASCII Collating Sequence
Appendix D. ILE COBOL Function-Name and Context-Sensitive Word List
Visual Key
Function-Names
Context-Sensitive Words
Appendix E. ILE COBOL Reserved Word List
Visual Key
Reserved Words
Appendix F. File Structure Support Summary and Status Key Values
File Structure Support Tables
File Status Key Values and Meanings
Attribute Data Formats
Appendix G. PROCESS Statement
Corresponding Create Command Options.
option-1
PROCESS Statement Rules
OUTPUT / NOOUTPUT
GENLVL(nn)
GEN / NOGEN
NOMAP / MAP
NONUMBER / NUMBER / LINENUMBER
NOSECLVL / SECLVL
NOOPTIONS / OPTIONS
QUOTE / APOST
NOSEQUENCE / SEQUENCE
NOVBSUM / VBSUM
NOXREF / XREF
PRTCORR / NOPRTCORR
NOINZDLT / INZDLT
NODDSFILLER / DDSFILLER
NOSYNC / SYNC
NOCRTF / CRTF
NODUPKEYCHK / DUPKEYCHK
NOBLK / BLK
STDINZ / NOSTDINZ / STDINZHEX00
RANGE / NORANGE
NOUNREF / UNREF
MONOPRC / NOMONOPRC
NOVARCHAR / VARCHAR
NODATETIME / DATETIME
NOCVTPICXGRAPHIC / CVTPICXGRAPHIC
NOCVTPICGGRAPHIC / CVTPICGGRAPHIC
NOCVTPICNGRAPHIC / CVTPICNGRAPHIC
NOOPTIMIZE / BASICOPT / FULLOPT
NOFIPS / MINIMUM / INTERMEDIATE / HIGH
NOOBSOLETE / OBSOLETE
EXTDSPOPT(a b c)
FLAG(nn)
LINKPGM / LINKPRC
SRTSEQ(a)
LANGID(a)
SOURCE / SRC / NOSOURCE / NOSRC
STDTRUNC / NOSTDTRUNC
NOCHGPOSSGN / CHGPOSSGN
NOFLOAT / FLOAT
NODATE / DATE
NOTIME / TIME
NOTIMESTAMP / TIMESTAMP
NOCVTTODATE / CVTTODATE
ENBPFRCOL(a)
CCSID(a b c)
DATTIM(a b)
NOGRAPHIC / GRAPHIC
ARITHMETIC(a)
NOLSPTRALIGN / LSPTRALIGN
NOCOMPASBIN / COMPASBIN
NOADJFILLER / ADJFILLER
PRFDTA(a)
LICOPT(a)
OPTVALUE(a)
NONATIONAL / NATIONAL
THREAD(a)
NTLPADCHAR(a b c)
NOCOMPRESSDBG/COMPRESSDBG
NOCRTARKIDX/CRTARKIDX
Appendix H. Complex OCCURS DEPENDING ON
Effects of a Change in ODO Value
Preventing Errors when Changing the ODO Object Value
Preventing Overlay When Adding Elements to a Variable Table
Appendix I. ACCEPT/DISPLAY and COBOL/2 Considerations
Bibliography
Index
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.