0% found this document useful (0 votes)
42 views19 pages

COBOL Chapter Summaries

Every COBOL program is composed of four divisions: INDENTIFICATION, ENVIRONMENT, DATA, and PROCEDURE. A COBOL shop maintains consistency in its programs by imposing a set of standards on its programmers.

Uploaded by

arthur llano
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views19 pages

COBOL Chapter Summaries

Every COBOL program is composed of four divisions: INDENTIFICATION, ENVIRONMENT, DATA, and PROCEDURE. A COBOL shop maintains consistency in its programs by imposing a set of standards on its programmers.

Uploaded by

arthur llano
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 19

Chapter ONE 1 2 3 4 5 6 7 8 9 COBOL is designed to meet the information processing needs of business.

COBO is a high-level language that can be transported easily from one computer system to another. COBOL excels in the use of record I/O. COBOL is English and self-documenting. Every COBOL program is composed of four divisions: INDENTIFICATION, ENVIRONMENT, DATA, and PROCEDURE. Flowcharting, hierarchy charts, and pseudocode should be used to outline logic. The top-down approach to solving problems divides a problem into smaller, more manageable problems, or module. Top-down designing should be used to break a problem down into manageable parts. Top-down programming should be used to organize the logic of a COBOL program.

10 Structured programs use the sequence, selection, and iteration logic structure. 11 A COBOL program is composed of COBOL words. 12 Every line of source code in a COBOL program must follow specific format rules.

Chapter TWO 1. A spacing chart is divided into rows and columns and can be used to design reports. 2. Alphanumeric fields may contain letters, numbers, and special characters. 3. A hierarchy chart, or top-down chart, illustrates the relationship between the paragraphs in the program. 4. Pseudocode and flowcharts are used to plan logic of the program. 5. A COBOL shop maintains consistency in its programs by imposing a set of standards on its programmers. 6. The only required entry in the IDENTIFICATION DIVISION is the PROGRAM ID paragraph. AUTHOR, INSTALLATION, DATE-WRITTEN and DATECOMPILED are optional paragraphs. 7. The ENVIRONMENT DIVISION is the most system-dependent part in any COBOL program. 8. A SELECT and ASSIGN are required for every file to be used in the program. 9. The DATA DIVISION describes the file data to be processed by the program and is divided into the FILE SECTION and WORKING-STORAGE SECTION. 10. An FD entry is needed in the FILE SECTION for every file identified in the ENVIRONMENT DIVISION by a SELECT statement. 11. The RECORD CONTAINS, LABEL RECORD, AND DATA RECORD clause are all optional in an FD entry. 12. Level Numbers range from 01 to 49 and are used to show how data items or fields are related to each other. 13. A picture clause is used to specify a detailed description of an elementary item. A group name has no picture clause. 14. The WORKING-STORAGE SECTION is used to define switches, accumulators, work-area fields, and output record layouts. 15. The PROCEDURE DIVISION contains the instructions required to solve a problem and is divided into paragraphs. 16. PERFORM transfer control from one paragraph to another and can be used to code iteration, and loops, in a COBOL program.

17. STOP RUN is the last logical statement in a COBOL program; it ends program execution and returns control to the operating system. 18. A MOVE statement copies the contents of one field to another. 19. An OPEN statement must be used to make a file available for processing by the program. 20. The READ retrieves a record from a file that has been opened for INPUT. 21. The DISPLAY statement displays data on the computer screen or monitor. 22. The IF statement is used in COBOL to implement a selection structure. 23. Simple addition can be performed by the ADD statement. 24. The CLOSE statement releases control of a file that had been previously opened.

Chapter THREE 1. The CONFIGURATION SECTION of the ENVIRONMENT DIVISION can be used to identify the computer system which the program is compiled on. 2. The SPECIAL-NAMES paragraph of the CONFIGURATION SECTION can be used to associate user-defined terms with hardware-specific features. 3. The ORGANIZATION IS and ACCESS IS are clauses available in SELECT statements of the FILE_CONTROL paragraph of the INPUT_OUTPUR section. 4. Standard COBOL allows SEQUENTIAL, INDEXED, and RELATIVE file organization. 5. Standard COBOL allows SEQUENTIAL, RANDOM, and DYNAMIC access to file. 6. The five basic data category in COBOL are, alphabetic, alphanumeric, numeric, alphanumeric edited, and numeric edited. 7. Every elementary field may have a USAGE. The default usage is DISPLAY. Only numeric fields may have a USAGE other than DISPLAY. 8. The implied decimal position in a decimal number field is indicated by the character V in a picture clause. 9. Edit patterns allow zero suppression and the insertion of special characters. They are used to improve the appearance of the output reports. 10. The JUSTIFIED RIGHT clause can be used in alphabetic, alphanumeric elementary item to cause the rightmost characters to a sending field to be placed in the rightmost position of a receiving field when a MOVE statement is executed. 11. The P symbol is used in a picture clause to indicate scaling position. 12. The qualified name is needed only when the same field name is defined more than once. 13. 77 level numbers define independent items. 14. Condition names are defined using 88 level entries and can be used to replace relational test in a program. 15. Figurative constants represent constant values and are commonly used in COBOL programs.

16. The REDEFINES clause allows a storage location to have multiple names and pictures. 17. The SCREEN SECTION of the DATA DIVISION is used to define output definitions for screen display.

Chapter FOUR 1. Conditional statements allow you to control program execution based on the results of test using IF and EVALUATE. 2. END-IF is needed only in situations in which a period cannot be used. 3. A numeric comparison of two fields is based on the algebraic value of the fields. 4. An alphanumeric comparison of two fields moves from left to right, one character at a time. 5. In an FI statement, ELSE relates back to the previously unmatched IF. 6. The IF statements can be one-sided, two-sided, or nested. 7. To avoid confusion and unnecessary code, NEXT SENTENCE and CONTINUE should be avoided in IF statement. 8. Combined conditions and complex conditions are formed by combining simple conditions with the logical connectors, AND and OR, along with optional parenthesis. 9. A combined condition may be abbreviated by the use of implied subjects and implied operators. 10. The EVALUATE statement can be used to place of numerous IF statements when testing a variable for multiple values. 11. The MOVE statement copies data from one field to another. 12. The INITIALIZE statement is designed to set a field or group of fields to predetermined values. 13. The ACCEPT statement can be used to move data to a field from an external source, such as a computer terminal or the computers operating system. 14. Reference modification allows you to reference a portion of a field. 15. Data validation is the process of checking fields for acceptable contents. Various validation tests are available through COBOL such as the class test, sign test, value test, range test, and presence or absence test. 16. The WRITE statement is used to transfer a single record to an output file.

Chapter FIVE 1. Arithmetic operations that combine numeric fields and numeric literals are essential for most business application. 2. The ADD statement has two formats, ADD to and ADD GIVING. 3. ROUNDED can be used to round the answer to the rightmost position available in the receiving field. 4. ON SIZE ERROR is used to detect truncation of the significant leftmost digit. 5. The SUBTRACT statement has two formats: SUBTRACT FROM and SUBTRACT FROM GIVING. 6. The MULTIPLY statement has two formats: MULTIPLY BY and MULTIPLY BY GIVING. 7. The DIVIDE statement has five different formats: DIVIDE INTO, DIVIDE INTO GIVING, DIVIDE BY GIVING, DIVIDE INTO GIVING with a REMAINDER, and DIVIDE NY GIVING with a REMAINDER. 8. A COMPUTE statement allows multiple arithmetic operations to be performed on a group of numbers or fields to produce a single answer more efficiently. 9. Parenthesis, in pairs, can be used within an arithmetic operations to be performed on a group of numbers or fields to produce a single answer more efficiently. 10. END-ADD, END-SUBTRACT, END-MULTIPLY, END-DIVIDE and ENDCOMPUTE are only needed in a situation where period cannot be used. 11. Intrinsic Functions are temporary data items that represent values computed at the time function statement executed. 12. The PERFORM statement allows a COBOL program to be structured in a Topdown fashion. 13. PERFORM UNTIL allows for the establishment of DO-While and Do-Until loops. 14. THRU, or TROUGH, may be used in a PERFORM statement to cause a series of consecutive paragraph execute. 15. The reserved word, EXIT, causes no action to occur; however it is used to create an EXIT paragraph that can be used in place to branch to when it is necessary to skip logic in a paragraph.

16. GO TO provides another means of branching, but its use should be restricted. 17. An IN-line PERFORM statement can be used to establish a loop that does not branch to another paragraph. 18. PERFORM TIMES can be used when the exact number of times a loop is to be executed is known or can be computed. 19. PERFORM VARYING can be used to manipulate the value of one or more fields as a loop executes. 20. The PROCEDURE DIVISION may be subdivided into sections. The end of one section is the beginning of the next section. 21. A subprogram provides another way of subdividing the logic in a COBOL program. 22. The CALL statement is used to transfer control to a subprogram and, with the USING option, allows the calling program and called program to share data. 23. A LINKAGE SECTION must be coded .in the DATA DIVISION of the subprogram that is going to share data with the calling program. 24. The WRITE statement is used to transfer output lines on a report file that has been opened for OUTPUT.

Chapter SIX 1. The COBOL SORT statement is used in the PROCEDURE DIVISION to rearrange the records of an input file. 2. The sort work file must be defined with a SELECT statement in the ENVIRONMENT DIVISION and an SD entry in the DATA DIVISION. 3. A record definition must follow the SD entry and must identify the position and size of the SORT KEY FIELD or FIELDS. 4. Records may be sorted in either ASCENDING or DESCENDING sequence on the sort key field or fields. 5. Sort key fields must be listed from the most major to most minor in a SORT statement. 6. The USING option identifies the input file for the SORT. 7. INPUT PROCEDURE executes in a manner similar to a PERFORM statement and can be used in place of the USING option when special processing of records is needed before the records are sorted. 8. The RELEASE statement is similar to a WRITE statement and is used in an INPUT PROCEDURE paragraph to place records in the sort work file. 9. The GIVING option identifies the file to be output by the SORT. 10. OUTPUT PROCEDURE works like a PERFORM statement and can be used in place of the GIVING option in a SORT when records are to be retrieved directly from the sort work file. 11. The RETURN statement works like a READ statement and is used in an OUTPUT PROCEDURE paragraph to retrieve records from the sort work file. 12. A simple SORT is coded utilizing the USING and GIVING options. 13. The COBOL MERGE statement allows multiple input files to be combined and sorted into a single output file. 14. EXTRACT or RECORD SELECTION REPORTS list records based on selection criteria supplied by the user.

Chapter SEVEN 1. A TABLE is a series of related fields with the same attributes stored in consecutive locations in main memory. 2. The logic involving the techniques for defining and processing tables is called TABLE PROCESSING. 3. When the constant data for a table is coded in the program, the table is said to be an EMBEDDED TABLE or INTERNAL TABLE. 4. An OCCURS clause specifies the number of times a field is repeated. 5. Each occurrence of a field is called an ELEMENT within the table. 6. A SUBSCRIPT is a numeric value in parentheses that identifies the element within a table that is to be referred. 7. No constant values can precede the definition of a NON-EMBEDDED, or EXTERNAL, TABLE. 8. The process of LOADING a non-embedded table must be performed in the PROCEDURE DIVISION. 9. The INDEXED BY clause is used to define an index name for a table. 10. An index name can be used only in conjunction with the table in which it is defined. It cannot be modified using a MOVE statement or be used in arithmetic. 11. An index name can be modified by the use of the SET statement or a PERFORM VARYING statement. 12. A SEARCH statement performs a LINEAR SEARCH, also known as a SEQUENTIAL SEARCH or SERIAL SEARCH, and is used to search a table from top to bottom. 13. A SEARCH ALL statement performs a binary search, which continually splits a table in half as it searches. 14. A binary search cannot be used unless a table is sequenced by one or more of its elements and has either an ASCENDING KEY or DESCENDING KEY clause in its definition. 15. A FIXED-LENGTH TABLE is defined with a specific number in the OCCURS clause.

16. A VARIABLE-LENGTH TABLE allows a table definition to be made and the exact number of elements determined at the time the table is loaded. 17. OCCURS DEPENDING ON is used in the definition of a variable-length table to establish a minimum and maximum number of elements allowed. 18. In ONE-DIMENSIONAL TABLES, each element within the table is identified by a single subscript or index value. 19. MULTI-DIMENSIONAL TABLES require two or more subscripts or indexes to reference a specific element within the table and are defined with more than one OCCURS clause.

Chapter EIGHT 1. INSPECT TALLYING is used to count the number of occurrences of a certain character or group of characters within a field. 2. INSPECT TALLYING adds one to the TALLYING field every time an occurrence of the specified character is encountered and does not automatically initialize the TALLYING field. 3. INSPECT REPLACING is used to replace specific characters within a field with other characters. 4. When an INSPECT statement executes, it proceeds from left to right in the inspected field one character at a time, TALLYING and/or REPLACING each character position as specified. 5. In the INSPECT CONVERTING statement, characters in the inspected field corresponding to the characters listed in the field or literal preceding the reserved word TO are replaced by the characters in corresponding positions in the field or literal following the word TO. 6. The UNSTRING statement is designed to distribute data in a single field to one or more fields. 7. The UNSTRING statement does not automatically fill rightmost positions in the receiving fields with spaces, so they must be initialized prior to execution of the statement. 8. STRING is the opposite of UNSTRING and concatenates, or joins, data stored in separates into one field. 9. The receiving field should be initialized before the execution of the STRING statement because STRING will not automatically pad rightmost positions with spaces. 10. The intrinsic function UPPER-CASE converts all the letters in a field or literal to uppercase letters. 11. The intrinsic function LOWER-CASE converts all the letters in a field or literal to lowercase letters. 12. The intrinsic function REVERSE reverses the order of the characters in a field or literal. 13. A COPY command causes the COBOL compiler to include specified files as part of the program before the program is compiled.

14. A CONTROL BREAK occurs when the value of the control field changes from the value found in the previous input record. 15. The process of adding a subtotal accumulator to the next highest level accumulator during a control break is known as ROLLING TOTALS. 16. A SINGLE-LEVEL CONTROL BREAK involves the use of one control field. 17. A MULTIPLE-LEVEL CONTROL BREAK involves the use of two or more control fields.

Chapter NINE 1. During sequential FILE MAINTENANCE, the file to be updated often is referred to as the MASTER FILE, the new version then is called the NEW MASTER FILE. 2. A TRANSACTION FILE is a file specifically created to supply data needed during file maintenance processing. 3. One way to update a sequential file is to create a new version, or generation, of that file. 4. Both the TRANSACTION FILE and the MASTER FILE must be sequenced in the same order by the KEY FIELD unique to each record in the master file. 5. Through a process called FILE MATCHING, records in the transaction file are matched to corresponding records in the master file. 6. A transaction that is used to update a master record is called a POSTED TRANSACTION. 7. A master record that has no corresponding transaction record is called an UNMATCHED MASTER. 8. A transaction record that has no corresponding master record is called an UNMATCHED TRANSACTION. 9. A DUPLICATE TRANSACTION is a special type of unmatched transaction in which more than one transaction contains the same key value. 10. Using the BALANCE LINE ALGORITHM, you can add, update, or delete records in a sequential file. 11. A sequential file that is stored on a direct access storage device can be UPDATED IN PLACE without the creation of a NEW MASTER FILE. 12. REWRITE updates an existing record on the file.

Chapter TEN 1. INDEXED FILES can be processed both sequentially and randomly. 2. An INDEX contains the values of the key field and the disk address where each record is located. 3. A KEY FIELD, or PRIMARY KEY, is a field common to each record and contains a unique value for each record. 4. An ALTERNATE KEY field provides a means of accessing records using a field other than the primary key. 5. RANDOM PROCESSING or RANDOM ACCESS refers to the capability to retrieve and/or update a record without having to retrieve or process the records that precede it in the file. 6. An indexed file must be created and stored on a DIRECT ACCESS STORAGE DEVICE, or DASD. 7. An indexed file can be created by reading records from a sequential file and then writing those same records out to the indexed file. 8. Access must be sequential when creating an indexed file. 9. The RECORD KEY IS clause is a SELECT statement identifies the name of the primary key field that must be defined within the record definition after the FD. 10. A WRITE statement is used to place records in an indexed file. 11. A RANDOM READ statement uses the index associated with an indexed file to locate a specified record in the file. 12. Random processing is allowed only when ACCESS is specified as RANDOM or DYNAMIC. 13. Records in an indexed file can be updated by execution of a REWRITE statement. 14. The DELETE statement deletes the record whose key is in the record key field. 15. DYNAMIC ACCESS allows for both random and sequential processing of an indexed file. 16. A sequential READ statement must include the reserved word, NEXT, after the name of the file when ACCESS IS DYNAMIC is specified in the SELECT statement.

17. The START statement allows for logical positioning of the CURRENT RECORD POINTER within the primary key index or an alternate key index for sequential retrieval of records. 18. RELATIVE FILE organization allows for both sequential and random processing of records, but a relative file does not use an index to identify a records location. 19. A RELATIVE KEY identifies a records position within the file by using a RELATIVE RECORD NUMBER. 20. Through a process called HASHING, it is common for a relative record number to be computed based on the digits in a data field using a special formula, or an ALGORITHM. 21. Even the most sophisticated hashing algorithm eventually will result in records with duplicate relative record numbers called SYNONYMS. 22. The storage location, or SLOT, where a record is supposed to be placed is referred to as its HOME SLOT. 23. The statements used to add, update, and delete records in a relative file are identical to those used in conjunction with indexed files.

Chapter ELEVEN 1. The REPORT WRITER FEATURE allows the characteristics of a report to be defined through the use of special entries in the DATA DIVISION. 2. The REPORT IS clause is used in an FD to define the name of the specific report to be created by Report Writer. 3. The REPORT SECTION is used to define the characteristics of each page in a report and to define the format of each output line in a report. 4. Each report to be produced begins with a REPORT DEFINITION or RD. 5. The optional RD entry, CONTROL IS or CONTROLS ARE, can be used to identify the field or fields, most major to most minor, used to trigger control breaks. 6. The reserved word, FINAL, is used to indicate the highest level of control and must appear first when used with CONTROL IS or CONTROLS ARE. 7. The entries in the PAGE clause within an RD are used to define the basic format of a page in the report. 8. A REPORT GROUP defines one or more related output lines for the report. 9. Within a report group, only those fields containing data to be printed are defined. 10. A name following the 01 level number is optional for all report groups and must be coded only if the report group must be referenced within the PROCEDURE DIVISION. 11. The use of the SOURCE clause within a report groups eliminates the need to code MOVE statements in the PROCEDURE DIVISION to fill in output fields. 12. PAGE-COUNTER is a special field, or REGISTER, available in the Report Writer for accessing the page count. 13. The definition of a CONTROL HEADING or CONTROL FOOTING must include the name of the control field for which the report group is being defined. 14. The SUM clause is used to define an internal accumulator that will tally the values in a specified field automatically. 15. DECLARATIVE SECTIONS, or DECLARATIVE are used to handle special processing needs in COBOL programs.

16. Declarative sections must be defined at the beginning of the PROCEDURE DIVISION before any other statements, and must begin with the reserved word, DECLARATIVE. 17. END DECLARATIVES must be used to terminate the scope of the declaratives. 18. USE FOR DEBUGGING may be used to identify items that are to be monitored during the execution of the program, such as field names or files. 19. USE AFTER STANDARD EXCEPTION may be used to replace actions specified in input and output statements by AT END or INVALID KEY clauses. 20. USE BEFORE REPORTING may be employed when an action out of the normal flow of Report Writer logic needs to be accomplished. 21. The INITIATE statement causes Report Writer to set all counters and accumulators to zero. 22. The GENERATE statement is what actually causes output lines to print when the Report Writer feature is used. 23. The TERMINATE statement causes all defined control footings to print for the last time and, if defined, the REPORT FOOTING. 24. When ON NEXT PAGE is specified following LINE NUMBER, a page break is forced before printing the report group. 25. NEXT GROUP may be used in one report group to force the next printing report group to print at a specified interval, or on the NEXT PAGE. 26. GROUP INDICATE causes an elementary item to print once after the control break and not print again until the next control break.

You might also like