Glossary of Terms
9. Glossary of Terms
There are many terms that are used throughout this document (as well as throughout ANY document dealing with the COBOL language) that are used to make discussions of syntax and semantics more concise. The following is a list of such terms and their definitions.
Alphanumeric
A string of characters enclosed within a pair of quotation marks (“) or apostrophes (‘). See section
The sequence in which the characters that are acceptable to a computer are ordered for purposes
sequence
of all types of sorting, merging, comparing, and processing. OpenCOBOL programs may utilize standard character-set collating sequences (such as that defined by the ASCII or EBCDIC charactersets) or programmer-defined custom sequences as specified in the OBJECT-COMPUTER
paragraph (section 4.1.2 ) and defined in the SPECIAL-NAMES paragraph (section 4.1.4 ).
Compilation unit
A single source file being compiled by the OpenCOBOL compiler. A compilation unit may contain one or more program units .
Division
COBOL programs are broken into four major areas, called DIVISIONS. Divisions are used to collect program components oriented toward specific similar goals together in a single place. The COBOL divisions are:
IDENTIFICATION DIVISION – names the program and, optionally, if it is a subprogram, defines it’s high-level data initialization policy and/or global availability to other programs
compiled in the same compilation unit. ENVIRONMENT DIVISION – defines characteristics of the environment in which the
program will be executed, such as files the program will be reading and/or writing, run- time switches that may be used to pass information into the program from the operating system environment and any special options that may be needed in order for the program to properly compile; typically, those special options are used to enable COBOL programs created using some other version of COBOL to be compiled and executed under a different version.
DATA DIVISION – provides detailed descriptions of the files, data and data structures the
program will be working with. PROCEDURE DIVISION – contains the actual executable program code.
Dynamically-
The OpenCOBOL compiler can create dynamically-loadable library files when compiling
loadable library
subprograms as their own separate compilation units . On UNIX systems, these will be “.so” files while on Windows systems these will be DLLs. Main programs can be created in this manner also. The “-m” compiler switch is used to create dynamically-loadable libraries.
Dynamically-
A synonym for Dynamically-loadable library .
loadable module Elementary Item
A data item described as not being further logically subdivided.
Entry-point
A spot in the PROCEDURE DIVISION where a program may begin execution when it is executed from the operating system or CALLed by another program. Every program has at least one entry- point – known as the primary entry-point – which corresponds to the first executable statement in the PROCEDURE DIVISION following the DECLARATIVES area, if any. Additional entry-points may
be defined via the ENTRY statement (see section 6.16 ).
Entry-point
Every entry-point has a name. That name must be unique for all program units that comprise an
name
executable program. Entry-point names are defined using a subroutine’s PROGRAM-ID clause (see section 3 ) or via ENTRY statements coded in the subroutine’s PROCEDURE DIVISION (see section
Executable file
The OpenCOBOL compiler can create operating-system appropriate files that may be executed directly from the operating system environment. On Windows systems, these will be “.exe” files whereas on UNIX systems they will have no specific extensions. The “-x” compiler switch is used to create executable files. Only main programs should be compiled in this manner.
Figurative
OpenCOBOL, like other COBOL implementations, supports a number of reserved words that may
constants
be used to represent a specific literal value. These are known as figurative constants. See section
Group item
A group item is an identifier that is broken down into sub-items. For example, a MAILING- ADDRESS might be broken down into STREET-ADDRESS, APARTMENT-NUMBER, CITY, STATE and ZIP-CODE components.
Identifiers
These are data items a COBOL program will be working with. The vast majority of identifiers are defined by the user (programmer) while a few are pre-defined by the OpenCOBOL compiler. Identifiers pre-defined by the compiler are referred to as registers . Other programming languages
ge nerally refer to identifiers as “variables”.
Imperative
A sequence of one or more non-conditional OpenCOBOL statements or conditional OpenCOBOL
statement
statements properl y terminated with the correct “END-xxxx” trailer.
Level number
A user-defined word expressed as a 1- or 2-digit number that indicates the hierarchical position of
a data item or the special properties of a data description entry. Level numbers in the range 1 through 49 indicate the position of a data item in the hierarchical
structure of a logical record . Level numbers in the range 1 through 9 can be written either as a single digit or as a zero followed by the significant digit.
Level numbers 66, 77, 78 and 88 identify special properties of a data description entry.
See sections 5.3 , 5.4 , 5.5 and 0 .
Literal
A numeric literal or an alphanumeric literal .
Main program
An OpenCOBOL program that is to be executed directly from an operating system or shell event. Main programs are not executed from other programs unless such execution is accomplished via the CALL “SYSTEM” facility.
Numeric literal
A numeric constant. See section 1.8 .
Primary Entry-
See entry-point .
point Procedure
All executable code statements within a single PROCEDURE DIVISION paragraph or SECTION.
Procedure name
A programmer-defined SECTION or paragraph name in the PROCEDURE DIVISION assigned to a procedure . Procedure names serve as a means by which a statement may refer to the statements that follow the procedure name.
Program unit
An OpenCOBOL main program or subprogram. Subprogram program units may be nested inside of other program units and a main program unit may be followed by any number of subprogram program units in the same compilation unit.
Qualification
The process of establishing a unique reference to a data item whose name is duplicated in a program. This takes the form of using the duplicated data name and the name of any of its parent data items, connected by “OF” or “IN” such that the combination of those two data names is unique within the program.
Record
The most-inclusive, highest level, data item. The level number for a record is 01. A record can be either an elementary item or a group item .
Registers
Special data items that are automatically defined for your use by the OpenCOBOL compiler. See
section 6.1.8 .
Reserved word
A COBOL word specified in the list of words that can be used in a COBOL source program, but that must not appear in the program as user-defined words or system names.
Sentence
Any number of COBOL statements , followed by a period.
Statement
A single COBOL instruction. Every statement starts with a verb which defines the overall action the statement will take. Any additional syntax following the verb refines the actions that will be taken.
Subprogram or
These two interchangeable terms refer to OpenCOBOL programs that are executed by another
subroutine
program. Typically this is done via the CALL statement from another OpenCOBOL program, although OpenCOBOL may execute subprograms written in other languages and other language programs may execute OpenCOBOL programs.
User-defined
Either the name of an identifier or a procedure in the program. OpenCOBOL limits user-defined
names
names to a maximum of 31 characters taken from the set of numeric digits, upper- and lower-case letters, hyphens and underscores. A user-defined name may neither begin nor end with a hyphen or underscore. User-defined names used as file names may additionally not begin with a digit although - unlike many other programming languages - user-defined names used as identifiers or procedure names may.
Verb
A single COBOL reserved-word which defines an action a COBOL program will take at execution time. Every COBOL statement begins with a verb. Some verbs perform relatively simple actions (MOVE, STOP, SET, etc.) while others can perform extremely complex actions (SEARCH, SORT, MERGE, STRING, UNSTRING, etc.).
Index * DISPLAY, 6-44
END (READ), 6-73
* In Column 7, 1-11
END-OF-PAGE, 6-102 AUTO, 5-18
>>D, 1-11 >>SOURCE FORMAT, 1-11
BACKGROUND-COLOR, 5-18, 5-19 BACK-TAB, 5-18
A BASED, 5-10, 5-11, 6-84
BEEP, 5-17
ACCEPT, 5-18, 6-24
BEFORE
Command-Line Arguments, 6-26
INSPECT, 6-61, 6-62
CONSOLE, 6-26
PERFORM WITH TEST, 6-71
Date/Time, 6-29
WRITE ADVANCING, 6-101
Environment, 6-27
BELL, 5-17
Screen Data, 6-28
Big-Endian, 5-13
Screen Size, 6-29
BLANK, 5-18
ACCESS MODE, 4-8, 4-9
BLANK WHEN ZERO, 5-11
DYNAMIC, 6-42, 6-73, 6-74, 6-78, 6-89
BLINK, 5-19
RANDOM, 6-42, 6-73, 6-74, 6-78
BLOCK CONTAINS, 5-3
SEQUENTIAL, 6-42, 6-78, 6-89
BY
ADD
CONTENT, 7-7
CORRESPONDING, 6-32 PERFORM VARYING, 6-71, 6-72 GIVING, 6-32
REFERENCE, 6-24, 6-36, 7-6, 7-8 TO, 6-31
VALUE, 6-24, 7-8
ADDRESS OF
BYTE-LENGTH, 5-16
FREE, 6-54 SET, 6-84
AFTER, 6-72 INSPECT, 6-61, 6-62
C$CHDIR, 7-15
PERFORM VARYING, 6-71
C$COPY, 7-15
PERFORM WITH TEST, 6-71
C$DELETE, 7-15
WRITE ADVANCING, 6-101
C$FILEINFO, 7-16
ALL
C$JUSTIFY, 7-16
INSPECT, 6-61, 6-62
C$MAKEDIR, 7-16
VALUE, 5-11
C$NARG, 7-16, 7-27
ALL PROCEDURES, 6-25
C$PARAMSIZE, 7-17
ALLOCATE, 5-11, 6-33
C$SLEEP, 7-17
ALPHABET, 4-4
C$TOLOWER, 7-17
ALPHABETIC, 6-6
C$TOUPPER, 7-17
ALPHABETIC-LOWER, 6-6
CALL, 6-6, 6-35, 7-3, 9-1
ALPHABETIC-UPPER, 6-6
CANCEL, 5-1, 6-37
Alphanumeric Literal, 1-13
CBL_AND, 7-17
ALTER, 6-34
CBL_CHANGE_DIR, 7-18
ALTERNATE RECORD KEY, 4-9, 6-89
CBL_CHECK_FILE_EXIST, 7-18
ALTERNATE RECORD KEY fields, 6-74
CBL_CLOSE_FILE, 7-18
ANY, 6-50
CBL_COPY_FILE, 7-18
ANY LENGTH, 5-11
CBL_CREATE_DIR, 7-19
ARGUMENT-NUMBER, 6-26
CBL_CREATE_FILE, 7-19
ARGUMENT-VALUE, 6-26, 6-27
CBL_DELETE_DIR, 7-19
Arithmetic Expressions, 6-2
CBL_DELETE_FILE, 7-19
ASCENDING KEY
CBL_EQ, 7-22
SORT, 6-87, 6-88
CBL_ERROR_PROC, 7-19
Table, 5-11, 6-81
CBL_EXIT_PROC, 7-21
ASSIGN, 4-6
CBL_FLUSH_FILE, 7-22
AT
CBL_IMP, 7-22
ACCEPT, 6-28
CBL_NIMP, 7-23
CBL_NOR, 7-23
CONTINUE, 6-41
CBL_NOT, 7-24
CONVERTING, 6-61, 6-62, 6-97
CBL_OC_NANOSLEEP, 7-24
CORRESPONDING, 6-32
CBL_OPEN_FILE, 7-19, 7-24
COUNT, 6-100
CBL_OR, 7-24
CRT, 4-5, 6-43
CBL_READ_FILE, 7-24, 7-25
CURRENCY SIGN, 4-5
CBL_RENAME_FILE, 7-25
CURSOR IS, 4-5
CBL_TOUPPER, 7-25 CBL_WRITE_FILE, 7-19, 7-24, 7-26 CBL_XOR, 7-26
CHAIN, 6-24
D In Column 7, 1-11
CHAINING, 6-24
DATA DIVISION, 1-7, 1-10
CHARACTERS, 6-62
DATA RECORD, 5-2
CLASS, 4-4
DATE, 6-29
CLOSE, 6-23, 6-38, 6-70
DATE YYYYMMDD, 6-29
cobcrun, 7-12
DAY, 6-29
CODE-SET, 5-2
DAY YYYYDDD, 6-29
COL, 5-18
DAY-OF-WEEK, 6-29
Collating Sequence, 9-1
DEBUGGING MODE, 4-1
COLLATING SEQUENCE, 4-2, 4-6
DECIMAL POINT IS COMMA, 4-5
COLUMN, 5-18 DECLARATIVES, 6-25, 6-42, 6-70, 9-1 Column 7
DEFAULT, 6-59
"*", 1-11
DELETE, 6-42, 6-70
"D", 1-11
DELIMITED BY
COLUMNS, 6-29
STRING, 6-92
Combined Conditions, 6-8
UNSTRING, 6-99
COMMAND-LINE, 6-26
DELIMITED BY SIZE, 6-92
comment, 1-11
DELIMITER, 6-100
COMMIT, 6-23, 6-39, 6-78
DESCENDING KEY
COMMON-STORAGE SECTION (Alternative To) , 5-1 SORT, 6-87, 6-88
Compilation Unit, 2-1, 5-3, 5-10, 9-1
Table, 5-11, 6-81
Compiler Switches
DISK, 5-3
All Switches, 7-1
DISPLAY, 5-18
-conf, 7-10 Command-Line Arguments, 6-43 -fdebugging-line, 1-11
CONSOLE, 6-43
-ffunctions-all, 4-2
Environment, 6-43
-fixed, 1-11
Screen Data, 6-44
-fnotrunc, 7-29
DIVIDE
-free, 1-11
BY/GIVING, 6-47
-g, 6-14, 6-15
BY/REMAINDER, 6-48
-m, 7-2, 7-3, 7-12, 9-1
INTO, 6-46
-m, 3-1
INTO/GIVING, 6-46
-S, 7-3
INTO/REMAINDER, 6-47
-Wobsolete, 3-1
DIVISION, 9-1
-x, 7-3, 7-12, 9-2
DYNAMIC, 4-8, 4-9
-x, 3-1 Dynamically-Loadable Library, 3-1, 9-1 COMPUTE, 6-40 Condition Names, 6-5 Conditional Expressions, 6-2, 6-5
Conditions
Elementary Item, 9-1
Combined, 6-8
ELSE, 6-58
Level-88 Condition Names, 6-5
END PROGRAM, 2-1, 2-2
Negated, 6-9
END-IF, 6-58
Relation, 6-8
ENTRY, 6-49, 6-83, 7-3, 9-1
Switch Status, 6-7
Entry Point, 9-1
Configuration Files, 7-10
ENVIRONMENT, 6-27
CONFIGURATION SECTION, 4-1 ENVIRONMENT DIVISION, 1-7, 4-1 CONSOLE, 6-43
Environment Variables
CONSOLE IS CRT, 4-3
COB_CC, 7-9
CONSTANT, 5-16
COB_CFLAGS, 7-9
Constant Descriptions, 5-16
COB_CONFIG_DIR, 7-9
COB_CONFIG_PATH, 7-10
INSPECT, 6-61, 6-62
COB_COPY_DIR, 7-9, 7-10
-fixed, 1-11
COB_LDADD, 7-9
fixed format, 1-11
COB_LDFLAGS, 7-9 FOREGROUND-COLOR, 5-18, 5-19 COB_LIBRARY_PATH, 7-13
FOREVER, 6-71, 6-72
COB_LIBS, 7-9
-free, 1-11
COB_PRE_LOAD, 7-13
FREE, 6-54
COB_SCREEN_ESC, 4-5, 7-13
free format, 1-11
COB_SCREEN_EXCEPTIONS, 4-5, 7-13
FROM
COB_SORT_MEMORY, 7-13
PERFORM VARYING, 6-71
COB_SWITCH_n, 4-4
REWRITE, 6-78
COB_SWITCH_n, 7-13
Screen Item Description, 5-19
COB_SYNC, 7-14
Screen Item Description, 5-19
dd_literal-1, 4-7
WRITE, 6-101
DD_literal-1, 4-6
FULL, 5-18
LD_LIBRARY_PATH, 7-9
FUNCTION-ID, 2-2
literal-1, 4-7 PATH, 7-14 TEMP, 7-14
TMP, 7-10, 7-14
GENERATE, 6-55
TMPDIR, 7-10, 7-14
GIVING
ENVIRONMENT-NAME, 6-27
CALL, 6-35
ENVIRONMENT-VALUE, 6-27
MERGE, 6-65
EOL, 5-18
SORT, 6-87
EOS, 5-18
STOP, 6-91
ERASE, 5-18
GLOBAL , 6-25
Error Procedure (user-defined), 6-70, 7-19
data item, 5-10
EVALUATE, 6-50
Data Item Description , 5-1
EVENT STATUS, 4-5
FD, 5-3
EXCEPTION
GO TO, 6-65, 6-71, 6-86, 6-88
ACCEPT, 6-30
DEPENDING ON, 6-57
CALL, 6-35
Simple, 6-57
DISPLAY, 6-45 GOBACK, 6-53, 6-56, 6-65, 6-86, 6-88, 7-21 Executable File, 3-1, 9-2
Group Item, 9-2
EXIT, 6-52 PARAGRAPH, 6-52, 6-65 PERFORM, 6-52
PERFORM CYCLE, 6-52
HIGHLIGHT, 5-19
PROGRAM, 6-65, 6-86, 6-88 SECTION, 6-52, 6-65 Simple, 6-52
Exit Procedure (user-defined), 7-21
IDENTIFICATION DIVISION, 3-1
Expressions
Identifier, 9-2
Arithmetic, 6-2
IF, 6-58
Conditional, 6-2, 6-5
IGNORING LOCK, 6-23
EXTEND, 6-70, 6-101
Imperative Statement, 9-2 EXTERNAL INDEXED BY, 5-11, 6-81, 6-84
Data Item Description , 5-1 , 5-10
INITIAL, 6-35
FD, 5-3
INITIALIZE, 6-33
Verb, 6-59
INITIATE, 6-60 INPUT, 6-70
FD, 6-101
INPUT PROCEDURE, 6-76, 6-86
-fdebugging-line, 4-1 INPUT-OUTPUT SECTION, 1-7, 4-5 Figurative Constant, 1-14, 9-2
INSPECT, 6-61, 6-97
File Description, 6-101
Intrinsic Functions (Supported)
FILE SECTION, 1-7
ABS, 6-11
FILE STATUS, 4-7
CHAR, 6-12
FILE-CONTROL, 1-7, 4-6
COMBINED-DATETIME, 6-13
FILLER, 5-4
CONCATENATE, 6-13
FIRST
CURRENT-DATE, 6-13
DATE-OF-INTEGER, 6-13
NATIONAL-OF, 6-11
DATE-TO-YYYYMMDD, 6-13
NUMVAL-F, 6-11
DAY-OF-INTEGER, 6-14
STANDARD-COMPARE, 6-11
DAY-TO-YYYYDDD, 6-14
TEST-NUMVAL, 6-11
E, 6-14
TEST-NUMVAL-C, 6-11
EXCEPTION-FILE, 6-14
TEST-NUMVAL-F, 6-11
EXCEPTION-LOCATION, 6-14
INVALID KEY
EXCEPTION-STATEMENT, 6-14
DELETE, 6-42
EXCEPTION-STATUS, 6-15
REWRITE, 6-78
EXP, 6-15
START, 6-89
EXP10, 6-15
WRITE, 6-102
FACTORIAL, 6-15
I-O, 6-70, 6-101
FRACTIONAL-PART, 6-15
I-O-CONTROL, 4-10
INTEGER, 6-15 INTEGER-OF-DATE, 6-15 INTEGER-OF-DAY, 6-15
INTEGER-PART, 6-16
JUSTIFIED RIGHT, 5-11
LENGTH, 6-16 LOCALE-DATE, 6-16 LOCALE-TIME, 6-16
LOCALE-TIME-FROM-SECS, 6-16
KEY (START), 6-89
LOG, 6-16 LOG10, 6-16 LOWER-CASE, 6-16, 6-21
MAX, 6-17, 6-20, 6-21
LABEL RECORD, 5-2
MIDRANGE, 6-17
LEADING
MOD, 6-17
INSPECT, 6-61, 6-62
NUMVAL, 1-13, 6-17
SIGN, 5-6
NUMVAL-C, 1-13, 6-17
LENGTH, 5-16
ORD, 6-18
LENGTH OF, 6-31
ORD-MAX, 6-18 Use With Alphanumeric Literals, 1-14 PI, 6-18
Level
PRESENT-VALUE, 6-18
01, 5-4
RANDOM, 6-18
02-49, 5-4
RANGE, 6-19
66, 5-5, 5-17
REM, 6-19
77, 5-5
REVERSE, 6-19
78, 5-16, 5-17
SECONDS-FROM-FORMATTED-TIME, 6-19
88, 5-17
SECONDS-PAST-MIDNIGHT, 6-19
Level Number, 9-2
SIGN, 6-19
LINAGE, 5-1, 5-3, 6-21, 6-101
SIN, 6-19
LINE, 5-18
SQRT, 6-19
LINES
STORED-CHAR-LENGTH, 6-20
ACCEPT, 6-29
SUBSTITUTE, 6-20
AT BOTTOM, 6-102
SUM, 6-20
AT TOP, 6-102
TAN, 6-20
WRITE ADVANCING, 6-101
TEST-DATE-YYYYMMDD, 6-20
LINKAGE SECTION, 6-24, 6-84
TEST-DAY-YYYYDDD, 6-20
Literal, 9-2
TRIM, 6-20
Little-Endian, 5-13
WHEN-COMPILED, 6-21
LOCALE, 4-4
YEAR-TO-YYYY, 6-21 LOCAL-STORAGE SECTION, 5-1, 6-35 Intrinsic Functions (Unsupported)
LOCK, 4-7
BOOLEAN-OF-INTEGER, 6-11
LOWLIGHT, 5-19
CHAR-NATIONAL, 6-11 DISPLAY-OF, 6-11 EXCEPTION-FILE-N, 6-11
EXCEPTION-LOCATION-N, 6-11 HIGHEST-ALGEBRAIC, 6-11
Main Program, 9-2
INTEGER-OF-BOOLEAN, 6-11
MEMORY SIZE, 4-2
LOCALE-COMPARE, 6-11
MERGE, 6-64
LOWEST-ALGEBRAIC, 6-11
MOVE, 5-11
CORRESPONDING, 6-66
Simple, 6-66 LINE SEQUENTIAL, 1-5, 4-8, 5-3, 6-38, 6-64, 6-78, 6-86, 6- MULTIPLE FILE TAPE, 4-10
MULTIPLY RECORD BINARY SEQUENTIAL, 1-6, 4-8, 5-3, 6-38, 6-64, 6- BY, 6-68
78, 6-86, 6-101
GIVING, 6-68 RELATIVE, 1-6, 4-8, 6-42, 6-78, 6-89, 6-101, 6-102 OUTPUT, 6-70, 6-101