INTE 201 Lesson 4: Data Division PDF

Summary

This document discusses the Data Division in programming, focusing on the FILE SECTION and WORKING-STORAGE SECTION, along with their related components. It details how data items, variables, and file structures are defined and organized within a program.

Full Transcript

INTE 201 LESSON 4: DATA DIVISION IBITS Year 18 | A.Y. 2024 - 2025 First Semester - Midterms - Record description entry - Describes the structure...

INTE 201 LESSON 4: DATA DIVISION IBITS Year 18 | A.Y. 2024 - 2025 First Semester - Midterms - Record description entry - Describes the structure Data Division and format of records. - Variables description entry - Details on variables The Data Division is the section concerned with the used in the program. identification and description of storage fields and data used - 77-level description entry - Used to define by the program. independent elementary items. It consists of two main sections: - FILE SECTION - Describes files that will be used for Example: input and output. DATA DIVISION. - WORKING-STORAGE SECTION - Declares FILE SECTION. variables that retain values between executions of the FD EMPLOYEE-FILE. program. LABEL RECORDS IS STANDARD. RECORD CONTAINS 80 CHARACTERS. Syntax: DATA RECORD IS EMPLOYEE-RECORD. DATA DIVISION. 01 EMPLOYEE-RECORD. FILE SECTION. 05 EMP-ID PICTURE 9(5). FD filename. 05 EMP-NAME PICTURE X(20). [LABEL RECORDS IS STANDARD] [LABEL RECORDS ARE OMITTED] WORKING-STORAGE SECTION. [RECORD CONTAINS _______ CHARACTERS] 01 COUNT PICTURE 9(3) VALUE 0. [DATA RECORD IS _________________] 77 TEMP-VALUE PICTURE 9(4) VALUE 0. 01 record-name. WORKING-STORAGE SECTION. {record description entry variables description entry 77-level description entry Components and Keywords: 1. DATA DIVISION - Defines all data items such as file structures, constants, and variables. It serves as the area to declare the format and structure of all data within the program. 2. FILE SECTION - Describes files to be used in the program, specifically their structures and associated attributes. The FD entry (File Description) outlines each file and can specify: - LABEL RECORDS IS STANDARD - Indicates that label records are standard. - LABEL RECORDS ARE OMITTED - Specifies that label records are not included. - RECORD CONTAINS - Defines the length of records in characters. - DATA RECORD IS - Names the structure of data records. 3. WORKING-STORAGE SECTION - Declares variables and constants used internally in the program. These variables retain their values between executions and include: INTE 201 LESSON #4: DATA DIVISION 1

Use Quizgecko on...
Browser
Browser