Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 3. The DATA DIVISION > CHAPTER SUMMARY

3.6. CHAPTER SUMMARY

  1. Data Organization for Files

    1. File—The major classification of data for a specific business use or application.

    2. Record—Data within a file that contains a unit of information.

    3. Field—A group of consecutive positions reserved for an item of data.

    Note: Files, records, and fields are all defined with data-names.

  2. Types of Data

    1. Variable Data—Data that varies with each run. This includes keyed input and displayed output along with files.

    2. Constant or Literal—Data that is defined within the program; it is not entered as input to the system.

      1. Numeric Literal—A constant that may be used in the PROCEDURE DIVISION for arithmetic operations.

      2. Nonnumeric Literal—A constant that may be used in the PROCEDURE DIVISION for all operations except arithmetic.

      3. Figurative Constant—A COBOL reserved word with special significance to the compiler (e.g., ZERO or ZEROES or ZEROS; SPACE or SPACES).

  3. The FILE SECTION for Batch Processing Files

    1. FD Entries

      1. FD is coded in Area A.

      2. The file-name, which is typically coded in Area B, must be the same name that is used in the SELECT statement.

      3. The RECORD CONTAINS integer CHARACTERS can be included as part of the FD.

      4. A single period ends the FD after the RECORD CONTAINS clause, if it is used.

      5. If a program is fully interactive, there is no need for a FILE SECTION.

    2. Record Description Entries in the FILE SECTION

      1. Record-names are coded on the 01 level.

      2. Field-names are coded on levels 02-49. We will use 05, 10, 15, and so on to allow for insertions if they become necessary.

      3. Level 01 is coded in Area A. All other levels are coded in Area B for ease of reading.

      4. Items with higher level numbers are considered subordinate to, or contained within, items with lower level numbers. We indent subordinate items for the sake of clarity.

      5. Group items are further subdivided; elementary items are not.

      6. Only elementary items have PICTURE or PIC clauses to describe the data:

        X—alphanumeric

        A—alphabetic

        9—numeric

        V—implied decimal position (used only with numeric fields)

      7. A period must follow a PICTURE clause in an elementary item; a period directly follows a group item name.

      8. Fields must be defined in the DATA DIVISION in the same sequence as they appear in the record being described.

      9. FILLER is a COBOL reserved word used to define areas within a record that will not be referenced individually during processing. With COBOL 85, a blank field-name can be used instead of the word FILLER.

  4. The WORKING-STORAGE SECTION

    1. Used for storing intermediate results, counters, end-of-file indicators, and interactive data to be accepted as input or displayed.

    2. VALUE clauses may be used to initialize fields.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint