Go BackVS COBOL II: Numerics

Synopsis
VS COBOL II: Numerics explains the four basic arithmetic operations and additional clauses and statements that deal with COBOL arithmetic.

Audience
This course is for programmers, end users and managers.

Time
4 - 8 hours

Product Code: COB405
After completing this course, the student should be able to:
 
Code the proper data specifications for fields used in arithmetic operations
Write coding instructions to perform the four arithmetic operations
Code the appropriate USAGE clause for fields used in arithmetic operations
Write code to achieve accurate results of arithmetic operations

COBOL Fundamentals Review
Provides a brief review of arithmetic operations used in COBOL.
 
Basic Arithmetic Operations

The four basic arithmetic operations.  The data type used for operands in arithmetic operations.

Data Specifications
Explains coding requirements for using decimals, signed numbers and various coding options.
 
Arithmetic With Decimal Numbers

Coding PICTURE and VALUE clauses for a field that will store decimal numbers.  
 
MOVE Numeric Fields

Coding MOVE, ADD or other arithmetic statements to move numeric fields to storage.
 
Signed Numbers

Coding PICTURE and VALUE clauses for a field that will hold a signed number.
 
Coding Options

Coding ROUNDED, GIVING, ON SIZE ERROR and REMAINDER.

Coding Arithmetic Statements
Explains in detail how to code the four basic arithmetic operations and the COMPUTE statement using the correct format.
 
ADD

Coding ADD statements.  Coding ROUNDED, GIVING and ON SIZE ERROR in ADD statements.
 
SUBTRACT

Coding SUBTRACT statements.  Coding the GIVING option with SUBTRACT statements.
 
MULTIPLY and DIVIDE

Coding MULTIPLY and DIVIDE statements.  Coding ROUNDED, GIVING, ON SIZE ERROR and REMAINDER as appropriate.  How to check for division by zero in your computations.
 
COMPUTE

The hierarchy of operations used in COMPUTE statements.  Coding COMPUTE statements that are equivalent to arithmetic statements.
 
Coding Techniques

How the need to retain intermediate results affects whether to code a COMPUTE statement or multiple arithmetic statements.  How and why to use the sign test and the class test.

USAGE Clause
Describes three USAGE clauses and explains how to use each to define storage areas used in COBOL arithmetic operations.
 
Zoned Decimal Storage

The COBOL default for the USAGE clause.  How data is stored in a zoned decimal format.
 
Packed Decimal Storage

Coding of a storage area as packed decimal format.  Why packed decimal storage is used.
 
Binary Storage

Coding a storage area for binary storage.  When binary storage is used.

Getting Numeric Results
Explains various techniques to maximize program efficiency and to assure accuracy of arithmetic computations.
 
Checklist for Accuracy

Factors that determine the results of numeric computations.  The field size required for storage of results of a computation.
 
Accuracy With Packed Storage

The correct procedures to initialize packed fields and display packed fields.
 
Efficiencies

Coding techniques which can make computations more efficient.

 

Go Back