Structured COBOL Programming: Nassau Community College
Structured COBOL Programming: Nassau Community College
Programming “Copyright @ 2000 John Wiley & Sons, In. All rights
reserved. Reproduction or translation of this work
beyond that permitted in Section 117 of the 1976
United States Copyright Act without the express
Hofstra University
Inc. The purchaser may make back-up copies for
his/her own use only and not for distribution or
resale. The Publisher assumes no responsibility for
errors, omissions, or damages, caused by the use of
these programs or from the use of the information
Nassau Community
College 9th Edition
PowerPoint Presentation:
Richard H. Baum, Ph.D.
DeVry Institute of Technology
CHAPTER 2
Cobol Language
Fundamentals
• MARGIN RULES
1. Division, section, and paragraph-
names begin in Area A.
2. All other statements, clauses,
and sentences begin in Area B.
Solution: IDENTIFICATION;
ENVIRONMENT; DATA;
PROCEDURE
Structured COBOL Programming, Stern & Stern, 9th Ed
ition
SELF-TEST
Solution: B
Solution: A
Structured COBOL Programming, Stern & Stern, 9th Ed
ition
SELF-TEST
SOURCE-COMPUTER:
– The computer that will be used for compiling
the program.
OBJECT-COMPUTER:
- The computer that will be used for executing
or running the program.
* SOURCE- COMPUTER and OBJECT-COMPUTER
are coded primarily as documentation entries.
• A SELECT statement
– defines a file-name.
– assigns a device name to that file*.
A file is the major collection of data for a
given application.
SELECT file-name-1
ASSIGN TO implementor-name-1
[ORGANIZATION IS LINE SEQUENTIAL]
– The implementor-name is a machine-
dependent device specification that is typically
provided by the computer center.
File-Name Rules
1. The file-name assigned to each
device must conform to the rules for
forming user-defined words.
2. A user-defined word is a word
chosen by the programmer to
represent some element in a
program such as a file-name:
Structured COBOL Programming, Stern & Stern, 9th Ed
ition
OVERALL FORMAT
• Rules for Forming User-Defined Words
(Such as File-Names)
1. 1 to 30 characters.
2. Letters, digits, and hyphens (-) only.
3. No embedded blanks
– It is best to use hyphens to separate words
(e.g., EMPLOYEE-NAME)
1. Device Specification
• For input or output files on disk, PC
versions of COBOL use device names
that specify:
(1) The drive on which the disk file appears
followed by a colon (e.g., C:, D:, etc.).
• If your file is in a subdirectory, you must
specify that as well (e.g., C:\COBOL).
CHAPTER SUMMARY
COMES NEXT