Teach Yourself COBOL in 21 days, Second Edition

Previous chapterContents


- G -
Glossary

accounts-payable system: A system that tracks your bills, their due dates, and what has been paid. It sometimes gives you information on future cash requirements needed to pay bills as they come due.

address: A numeric value representing a location in a computer's memory.

aggregate: A COBOL data type composed of one or more basic COBOL data types. Arrays and structures are both aggregates. Aggregate is the opposite of atomic when applied to COBOL data types. In the following code fragment, SOME-VALUES is an aggregate, and VALUE-1 and VALUE-2 are atomic:

01  SOME-VALUES.
    05  VALUE-1   PIC 9(4).
    05  VALUE-2   PIC 9(3).

alphanumeric: Any of the printable characters, A to Z, a to z, 0 to 9, and punctuation marks such as spaces, quotes, exclamation marks, and so on. An alphanumeric variable of four characters could hold any of the values "ABCD", "12XY", "1234", or "(**)" because these are all printable characters.

alternate index: An alternate index is an additional index in an indexed file that defines an alternative path along which records can be retrieved.

alternate key: See alternate index.

area: One of the five areas in a COBOL program in ANSI format. The areas of a COBOL program are arranged in columns. The sequence area includes columns 1 through 6 and can be used for line numbering.

The indicator area is column 7. Single characters in this column cause different behavior.

The * character causes the remainder of the line to be ignored, effectively creating a comment.

The / character is similar to *, but additionally causes the printer to form feed when the listing of the program is being printed.

The D character indicates that the line is compiled only when compiling for debugging.

The - character indicates a continuation for a literal that was too long to fit on the preceding line.

Area A is columns 8 through 11. Various parts of the COBOL program must begin in Area A, including division names, section names, paragraph names, and data items having a level number of 01, 77, SD, and FD.

Area B is columns 12 through 72. Sentences and data items having levels other than 01, 77, SD, and FD are expected to begin and end in Area B.

The modification area includes columns 73 through 80. The area is used for modification codes by tradition, although the area is not officially designated for this use.

Area A: See area.

Area B: See area.

array: 1. An area of memory that has been set aside and organized in such a way that it can hold multiple occurrences of the same type of information. 2. A variable that contains a repeated occurrence of the same type of data. The following fragment defines an array of 6 numeric variables:


01  A-VALUE  PIC 9(5)  OCCURS 6 TIMES.

ASCII: American Standard Code for Information Interchange. A code used by computers to represent the letters of the alphabet, spaces, tabs, and other control information for terminals and printers. See Appendix B, "ASCII."

ASCII collating sequence: The sequence in which the characters are defined in the ASCII chart. (See Appendix B.)

atomic: This term generally refers to something that cannot be broken into smaller parts. In COBOL, atomic variables are given pictures. They cannot be reduced to smaller parts. Arrays and structures are not atomic because they are composed of smaller data types. Atomic is the opposite of aggregate when applied to data types. In the following code fragment, SOME-VALUES is an aggregate, and VALUE-1 and VALUE-2 are atomic:

01  SOME-VALUES.
    05  VALUE-1   PIC 9(4).
    05  VALUE-2   PIC 9(3).

bar code reader: An input device that reads a bar code and transmits the information to the computer. Bar codes are extensively used to encode part numbers on goods in retail stores.

binary: A numbering system using only 0 and 1 as digits in base 2.

block mode screen: Most computers operate a terminal on a character-by-character basis, sending each character to the screen one at a time and accepting one character at a time from the keyboard. Block mode screens such as the IBM 3270 send and receive complete screens (usually 1920 characters) at a time. This usually affects the way a series of DISPLAY verbs are displayed.

called program: A program that has been called to be executed by another program.

calling program: A program that calls another program and executes it.

carriage control: Any commands sent to a printer that control the positioning of the print head, such as a carriage return or line feed command.

carriage return: 1. See CR. 2. A command sent to a printer that causes the print head to return to the leftmost margin of the paper. Starting a new line on a printer usually involves sending a carriage return command followed by a line feed command. See line feed.

CD-ROM: Compact disc-read-only memory. A read-only storage device that uses optical disks to store data.

central processing unit: The heart of the computer, which performs addition, subtraction, multiplication, and division. It also moves data from one location to another. This is abbreviated CPU.

COBOL: Common Business Oriented Language, a computer programming language designed and used primarily for business applications.

comparison operator: The symbols used between two values when the values are being compared. The short and long versions of COBOL comparison operators are as follows:

Short Long
= IS EQUAL
NOT = IS NOT EQUAL
> IS GREATER THAN
NOT > IS NOT GREATER THAN
< IS LESS THAN
NOT < IS NOT LESS THAN

compiler: A program that takes a source code file, processes it, and generates a translated version of the source code that the computer can understand. This translation is called an object and is usually saved in an object file.

compiler directive: A command to the compiler, telling it to do something while it is compiling the source code file, or telling the compiler to change the way it would normally behave. The COPY command is not a programming command. It is a command to the compiler to tell it to pull the pieces of different files together into one file, and then compile the resulting file. The COPY command is sometimes called the COPY directive, and it looks like this:

001100     COPY "FDVENDOR.CBL".

computer: A machine that can add, subtract, multiply, divide, move, and perform other mathematical and logical functions on numbers.

control break: A break inserted into the normal processing of a program (usually a report program) to cause groups of records to be processed together as one unit. The interruption of the normal printing of a report program to print a total or subtotal would be a control break or level break. In the following example, the report breaks at the end of each vendor and prints a subtotal for that vendor. Then it breaks at the end of the report and prints a total for the report.

Vendor            DUE DATE      AMOUNT
ABC Printing     1/23/1994       27.95
ABC Printing     1/31/1994       15.54
ABC Printing     2/16/1994       10.17
                     Total       53.66

GTE              1/17/1994       34.97
GTE              1/24/1994       17.54
                     Total       52.51

               Grand Total      106.17

CPU: See central processing unit.

CR: ASCII name for a carriage return character. This has a value of 13 (hex 0D) and causes terminals and printers to move the cursor or print head to the leftmost column of the display or page.

CR-LF: A carriage return and line feed pair. These characters are used to end a line of text in a text file on an MS-DOS computer. They also are the standard behavior of a cursor or print head at the end of a line. See CR and LF.

DATA DIVISION: The DATA DIVISION describes the data used by the program. The DATA DIVISION and the PROCEDURE DIVISION are the most important divisions in a COBOL program and do 95 percent of the work. See DIVISION.

data name: The variable name assigned to each field, record, and file in a COBOL program.

data validation: Any technique used to decrease the errors in data entered into the computer.

debug: To test a program to eliminate errors.

default: A condition, value, or action that is executed or set up without having to be requested.

desk checking: Checking source code created with an editor before compiling it to check for typographical and other errors.

DIVISION: One of the four divisions in a COBOL program--IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, and PROCEDURE DIVISION.

edited numeric variable: A numeric variable that contains an editing character. Edited numeric variables should be used only to display values and cannot be used in calculations. There are other editing characters, but these are the main ones. The following is an example:


01  DISPLAY-VALUE     PIC ZZZ,ZZ9.99-.

editing characters: The characters minus (-), decimal point (.), comma (,) and Z are called editing characters when used in a PICTURE. See edited numeric variable.

element: An individual variable in an array of the same type of variables, or an individual variable in a structure that might contain dissimilar variables.

end of file: A condition that exists when the last record has been read from a file.

ENVIRONMENT DIVISION: The ENVIRONMENT DIVISION describes the physical environment in which the program is running. The main use of the ENVIRONMENT DIVISION is to describe the physical structure of files that will be used in the program. The following is an example:

000300 ENVIRONMENT DIVISION.

executable: A file containing an executable program that has been created by linking one or more objects.

explicit: A way of stating something in a computer language so that a value or action is apparent by content. In the following example, EMP-NUMBER has an explicit picture of PIC 9999, and EMP-HOURLY has an explicit picture of PIC Z9.99. Compare this with the definition of implicit.

000900 01  EMPLOYEE-DATA.
001000     05  FILLER       PIC X(4)
001100         VALUE "Emp ".
001200     05  EMP-NUMBER   PIC 9999.
001300     05  FILLER       PIC X(7)
001400         VALUE " earns ".
001500     05  EMP-HOURLY    PIC Z9.99.

FD: See file description.

field: A field or data field is one piece of data contained in a record. In the customer file, the customer name is one field, and the customer phone number is one field. COBOL data files are organized as one or more records containing the same fields in each record. For example, a record for a personal phone book might contain fields for a last name, a first name, and a phone number. See also file and record.

file: In a COBOL program, a file is a collection of related units of data within a category of data. For example, a file might contain all the data (related units of data) about customers (category of data) for a company. This customer file would contain information on each customer and is usually called a data file or a logical file. In order for it to exist at all, a physical file must be on the disk, but when this file is logically arranged so that a COBOL program can access the information, it becomes a data file to a COBOL program. See also field and record.

file at end: See end of file.

file description: Entries used to describe a file, its records, and its fields.

file descriptor: See file description.

FILE SECTION: A reserved name for the section of the DATA DIVISION that is used to define files used in a program.

FILE-CONTROL: A reserved name for a paragraph in the INPUT-OUTPUT section of the ENVIRONMENT DIVISION that is used to define physical files used in a program.

FILLER: A COBOL reserved word that reserves space in memory for a field that will not be accessed in the program.

flag: A variable in working in storage that is used to indicate the presence or absence of some condition in the program. For example, a FILE-AT-END might be used as a flag to indicate that the last record of the data file has been read.

flowchart: A graphic representation of the logic or steps in a program or system. A flowchart represents how a program or activity moves through various processes or program routines. It uses symbols to represent the activities, and it uses arrows to represent the direction of activity through the processes. Flowcharts can be used to define the behavior of a single program or a system (a combination of programs).

form feed: A command sent to a printer that causes the printer to eject the last sheet of paper and ready itself to start printing at the top of a new sheet.

hexadecimal: A numbering system using 16 digits--0 through 9 and A, B, C, D, E, and F in base 16.

hierarchy of operators: See precedence.

I-O-CONTROL: A reserved name for a paragraph in the INPUT-OUTPUT section of the ENVIRONMENT DIVISION that is used to define what areas of memory will be used by the files while they are being processed. This paragraph is used to cut down on memory usage when memory is at a premium.

IDENTIFICATION DIVISION: The IDENTIFICATION DIVISION marks the beginning of a COBOL program and serves to name and comment the program.

implicit: Implied by context, or the rules of a computer language, but not stated. In the following example, EMPLOYEE-DATA has an implicit (implied but not stated) picture of PIC X(20). See also explicit.

000900 01  EMPLOYEE-DATA.
001000     05  FILLER       PIC X(4)
001100         VALUE "Emp ".
001200     05  EMP-NUMBER   PIC 9999.
001300     05  FILLER       PIC X(7)
001400         VALUE " earns ".
001500     05  EMP-HOURLY    PIC Z9.99.

implied decimal: A decimal point that does not explicitly appear in a number, but the existence of the decimal and its position are recorded elsewhere. In the following example, EMP-HOURLY contains an explicit decimal and EMP-WAGE contains an implicit decimal:

001300     05  EMP-WAGE       PIC 9999V99.
001400 
001500     05  EMP-HOURLY    PIC Z9.99.

index variable: When you define a table (array), you also can define a variable that is specifically intended to be used as the index for that table. It is called an index variable. In the following example, STATE-INDEX is an index variable for the TABLE-STATE-RECORD array:


01  TABLE-STATE-RECORD OCCURS 50 TIMES
    INDEXED BY STATE-INDEX.
    05  TABLE-STATE-CODE       PIC XX.
    05  TABLE-STATE-NAME       PIC X(20).

indexed file: A file containing one or more indexes that allow records to be retrieved by a specific value or in a particular sort order.

indicator area: Character position 7 is called the indicator area. This seventh position is usually blank. If an asterisk is placed in this column, everything else on that line is ignored by the compiler. This is used as a method to include comments in a source code file. Other single characters in this column cause different behavior: The / character is similar to *, but it additionally causes the printer to form feed when the listing of the program is being printed.

The D character indicates that the line is compiled only when compiling for debugging. The - character indicates a continuation for a literal that was too long to fit on the preceding line.

infinite loop: An error condition in a program that causes a processing loop to be performed forever. Caused by incorrectly setting or testing loop-control variables.

initialize: Set a variable to a starting value.

input device: A device that allows input of information to a computer. The most common input device is a keyboard. Other devices for input include bar code readers, optical character readers, scanners, and telecommunications input devices such as modems. Modems are used to input data from other computers.

INPUT-OUTPUT SECTION: A reserved name for the section of the ENVIRONMENT DIVISION that is used to define physical files used in a program and what areas of memory will be used by the files while they are being processed.

ISAM: Indexed Sequential Access Method. Originally a method of creating and accessing indexed files that allowed record storage and retrieval by a key value in the record. The term tends to be used loosely to refer to any method of storing and retrieving indexed records.

K: An abbreviation for kilobytes.

key path: The natural sorted order of records as they are returned from the file using a particular key.

kilobyte: 1,024 bytes.

level break: See control break.

level number: A number from 01 to 49 indicating the hierarchy of data in a structure variable. Levels above 49 are reserved for special uses in COBOL.

LF: The ASCII name for a line feed character. This has a value of 10 (hex 0A) and causes terminals and printers to move the cursor or print head to the next line on the display or page.

line feed: See LF. A command sent to a printer that causes the print head to move down one line. Starting a new line on a printer usually involves sending a carriage return command followed by a line feed command. See carriage return.

listing file: A report produced by the compiler on the program that it has just compiled. This can be sent directly to the printer, or it can be created as a separate file that can be displayed or sent to the printer. Sometimes called a listing.

loop: A series of one or more commands executed a number of times or until a certain condition is met in the program.

M: An abbreviation for megabyte.

main memory: This is a storage area inside the computer that is used as a giant scratch pad for programs to load and use data. Main memory is usually built from random access memory (RAM) chips.

maintenance program: A program that allows a user to add, change, delete, or look up records in a file.

megabyte: 1,048,576 bytes.

menu: A program that offers the user a number of choices, each of which executes a different program or different part or screen of the current program.

mod code: See modification code.

modem: Computers transmit data using high and low voltages in a kind of Morse code used to represent computer bytes. A modem is used to translate high and low voltages from a computer into tones (sounds) that can be transmitted on a telephone line.

modification area: COBOL was designed as an 80-column language, but there is no formal definition of character positions 73 through 80. This area is left to the designer of the COBOL editor to use as needed. COBOL editors on large computers usually allow you to define an eight-character modification code. If you edit a line of an existing program, or insert lines, these are added to the source code file with the modification code placed in positions 73 through 80. This is a handy way of tagging all the changes made to a program for a specific purpose. This method of modification code marking usually depends on a specific editor being set up for COBOL and having the capability to insert these modification codes automatically. You probably won't see modification codes using COBOL on a PC. The modification area includes columns 73 through 80. The area is used for modification codes by tradition, although the area is not officially designated for this use.

modification code: COBOL editors on large computers usually allow you to define an eight-character modification code. If you edit a line of an existing program, or insert lines, these are added to the source code file with the modification code placed in positions 73 through 80. This is a handy way of tagging all the changes made to a program for a specific purpose. This method of modification code marking usually depends on a specific editor being set up for COBOL and having the capability to insert these modification codes automatically.

MS-DOS: Microsoft-Disk Operating System. An operating system developed by the Microsoft Corporation for IBM-compatible computers. See also operating system.

NUL: The ASCII name for the character that has a value of zero.

object file: A file containing codes that can be understood by a computer, and created by compiling a source code file. See also compiler and source code.

online processing: See transaction processing.

operating system: A master program that controls a computer's basic functions and allows other programs to access the computer's resources such as disk drive, printer, keyboard, and screen.

optical character reader: A device similar to a scanner (see scanner) that reads a document, but either transmits the information to the computer as readable text, or sends the graphic image to the computer to be interpreted back to the original text by a program.

order of operators: See precedence.

output device: Devices that allow output of information from a computer. The most common output devices are monitors and printers. Other output devices include telecommunications devices such as modems, which are used to output data to another computer.

paragraph: A subdivision of a COBOL program containing sentences.

pass by address: A method of passing a variable to a function by passing the address of the variable in memory. If the called program modifies the variable by using the address to locate the variable and changing the value, then the value is changed in both the called program and the calling program. Sometimes called pass by reference.

pass by copy: See pass by value.

pass by reference: See pass by address.

pass by value: A method of passing a variable to a program by making a copy of the variable and giving it to the called program. If the called program changes the variable, it does not affect the value of the variable in the calling program. Sometimes called pass by copy.

precedence: The order in which operators are applied to an expression or a statement. Usually called precedence of operators. Also called order of operators or hierarchy of operators. In the expression

COMPUTE VALUE-X = 1 + 3 * 4.

the * operator has a higher precedence than the + operator. The * operator, multiplication operator, is applied first. The expression is evaluated as

COMPUTE VALUE-X = 1 + (3 * 4).

rather than

COMPUTE VALUE-X = (1 + 3) * 4.

which sets VALUE-X to 13 and not 16.

primary key: In a COBOL indexed file, one field must be designed so that it will contain a unique value for each record. This field is then set up as the primary index for the file. This primary index is called the primary key or simply the key. See also alternate key.

primary memory: See main memory.

primary storage: See main memory.

print queue manager: See spooler.

printer layout chart: See printer spacing chart.

printer spacing chart: A layout tool similar to graph paper used to work out the spacing of values on a printed report.

PROCEDURE DIVISION: The PROCEDURE DIVISION contains the COBOL statements that the program executes. The PROCEDURE DIVISION is the real workhorse of a COBOL program. It includes all the commands that actually do something.

processing loop: One or more paragraphs or sections of a program that are executed over and over.

program: A series of steps to be executed by a computer.

programming language: A computer tool that allows a programmer to write commands in a format that is more easily understood or remembered by a person, and in such a way that they can be translated into codes that the computer can understand and execute.

prompt: Something indicating to the user that the computer is waiting for user input. Some sample prompts are the blinking cursor, a question mark, or a question or request displayed on the screen.

RAM: See random access memory.

random access memory: The primary working memory of a computer that can be used for rapid storage and retrieval characters or bytes of information. See also main memory.

real-time processing: 1. A computer system that functions in such a way that information entered at a terminal must be responded to by the computer within a short period of time. An airline reservation system that must respond with available seats on a flight, or a point of sale system that must quickly look up stock availability and prices; these are two examples of real-time systems. 2. By extension of this concept, real-time in modern usage has come to be used to describe a very fast response computer system such as one that might be used to control factory processes. A real-time system might have a sensor that reads the temperature of a vat of chemicals, and a method of sending signals to the heater for the vat. As the temperature rises or falls slightly, the computer switches the heater on and off to keep a consistent temperature in the vat.

record: See structure, file, and field.

record selection: Any process that reads through records in a file, accepting or rejecting records for processing based on testing conditions for each record.

relational operator: An operator that is used to compare two expressions usually used in an if statement. The following are some COBOL relational operators:

IF VALUE-X IS NOT EQUAL VALUE-Y
IF VALUE-X IS EQUAL VALUE-Y
IF VALUE-X IS LESS THAN VALUE-Y

COBOL usually includes one or two variations of the same relational operator so that comparisons can be written with words or with symbols:

IF VALUE-X NOT = VALUE-Y
IF VALUE-X = VALUE-Y
IF VALUE-X < VALUE-Y   is less than

reserved word: In any programming language, certain words have special meanings in the language. In COBOL, DISPLAY "Hello" causes the word Hello to be displayed on the screen. DISPLAY has a special meaning in COBOL. It tells the computer to put the next thing on the screen. Also in COBOL, the words DATA and DIVISION appearing together mean that the section of the program where data is defined is beginning. The words DATA DIVISION and DISPLAY are called reserved words because they are reserved in the language to have a special meaning, and the programmer cannot use these words for some other purpose. For example, it is incorrect to name a program DISPLAY, like this:

PROGRAM-ID. DISPLAY.

If you attempt this, the compiler probably will complain of an invalid program name, because DISPLAY is reserved for a special meaning in COBOL.

routine: Any set of instructions designed to perform a specific task. In COBOL programs, a routine consists of one or more paragraphs.

scanner: A device that can input data to a computer by scanning a graphic image and sending signals representing the graphic image to the computer. A scanner works somewhat like a photocopying machine, but instead of sending the pulses of lightness and darkness of the input document to be copied to another page of paper, the pulses are transmitted to the computer.

SD: See sort description.

secondary storage: Secondary storage is permanent after power is gone. Common secondary storage devices are diskettes, hard drives, and tapes. CD-ROM is becoming popular as a very large secondary storage device. There are many newer forms of secondary storage becoming available, such as memory cards that contain 10 year batteries.

sentence: One or more COBOL commands ending with a period.

sequence area: Columns 1 through 6 of a COBOL program are the sequence area and can be used for line numbering.

sort description: Entries used to describe a sort file, its records, and its sort keys. Also called a sort descriptor.

source code: A text file containing statements in a programming language. Also called source, source file, and source program.

spooler: A program, usually on a multiuser system, that queues print files for one or more printers and sends them to the printer one at a time. Sometimes called a print queue manager.

statement: A single instruction or command.

string: A sequence of characters, usually printable. In COBOL, strings are set off by double quotes, like this:

"Hello World," and "123-Z55" are strings.

structure: When variables will be used as a group, they can be combined into a single variable called a structure or a record. A structure or record is a variable containing one or more COBOL variables. In the following example, the variable named THE-WHOLE-MESSAGE contains the three variables THE-NUMBER, A-SPACE, and THE-MESSAGE. THE-WHOLE-MESSAGE is a structure.

01  THE-WHOLE-MESSAGE.
    05  THE-NUMBER          PIC 9(2).
    05  A-SPACE             PIC X(1).
    05  THE-MESSAGE         PIC X(50).

subscript: A number in parentheses that identifies one element of an array:

01  A-VALUE  PIC 99 OCCURS 4 TIMES.
    MOVE 16 TO A-VALUE(2)

The 2 is a subscript identifying a single element of the data array.

suppressing zeroes: See zero suppression.

symbolic debugger: A debugger enables a programmer to execute a program in small increments (usually one line at a time) and watch the program as it is being executed. A symbolic debugger also enables a programmer to display the lines of the original source code file, and the values of variables by referencing the variable name. It is called a symbolic debugger because variables and paragraphs are accessed by using the names given to them in the source code file.

syntax: The rules that specify how a command or instruction should be given to a computer so that the computer can understand how to execute the instruction.

syntax error: A programming error caused by a violation of the rules that specify how a command or instruction should be given to a computer.

table: See array.

transaction processing: The process of adding, changing, deleting, or looking up a record in a data file by entering the data at a terminal. Most transaction processing systems also include a method of ensuring that all the information entered as a transaction is simultaneously saved to disk.

variable: A named area of memory in a computer program that can contain data that changes as the program runs.

vendor: Someone who sells you goods or services and to whom you end up paying money for those goods or services. The vendor file is one of the main files in an accounts payable system.

voucher number: In a bills paying system, each new invoice that is received for payment is assigned a tracking number. This tracking number is the key to the voucher file or bills file, and the number is usually called a voucher number.

white space: Spaces between words in a program. Some languages allow tabs as white space; traditional COBOL allows only the space character.

WORKING-STORAGE SECTION: A reserved name for the section of the DATA DIVISION that is used to define data used in a program.

X: The X in a picture indicates that it can be used for alphanumeric values. The picture XXXX indicates that four characters can be stored in this variable. A variable with a picture of XXXX could hold any of the values "ABCD", "12XY", "1234", or "(**)" because they are all printable characters. The variable also holds the values "A", "12X", and "aa" because they are also alphanumeric and small enough to fit in a four-character space.

zero suppression: Editing of a numeric field so that leading zeroes are replaced with spaces in displaying or printing the field.


Previous chapterContents


Macmillan Computer Publishing USA

© Copyright, Macmillan Computer Publishing. All rights reserved.