Manta alt

YOUR IBM i TRAINING SOURCE

You must allow the browser to execute JavaScript programs if you want to view product information. If your browser is set up to execute JavaScript programs, the problem is that the product ID was incorrect. Use the menu bar above to find the desired product.

Overview

Audio

This course discusses in detail the definition and use of numeric fields in COBOL. It describes how to code the Data Division statements necessary to define each type of numeric field, how to initialize numeric fields, and how to use them efficiently in the Procedure Division. All types of arithmetic operations are covered. Upon completion of the course, you should have a strong working knowledge of arithmetic programming techniques in COBOL.

Approximate Study Time: 6 hours

Objectives

After completing this course, you should be able to:

  • Code the COBOL statements (ADD, SUBTRACT, MULTIPLY, DIVIDE, and COMPUTE) to perform arithmetic operations on external decimal (display), packed decimal, binary, and floating-point fields
  • Convert numbers from one to another among the binary, hexadecimal, and decimal formats
  • Add and subtract hexadecimal numbers
  • Code the Data Division statements necessary to define external decimal, binary, packed decimal, and floating-point fields
  • Convert numbers from one to another among the external decimal, packed decimal, and binary formats
  • Predict the results of a MOVE operation between numeric fields of different types and unequal length
  • Predict the results of a comparison of numeric fields
  • Code the COBOL statements necessary to initialize numeric fields to specified values
  • Predict the results of an ADD CORRESPONDING or SUBTRACT CORRESPONDING operation
  • Identify common errors resulting from invalid arithmetic operations
  • Compute the length of a record containing external decimal, binary, packed decimal and/or floating-point fields
  • Define work fields and output fields of sufficient size to hold all possible results, given a description of input fields and the arithmetic operations to be performed
  • Round arithmetic results using the ROUNDED phrase, and use the ON SIZE ERROR phrase to catch truncation errors
  • Recognize arithmetic inefficiencies in a given COBOL program segment
  • Select data types, data field lengths, sign, and decimal position options to maximize program performance
  • Use decimal scale factors in a PICTURE clause to cause scaling of a numeric item
  • Identify the COBOL intrinsic function to perform a specified task
  • Invoke an intrinsic function, given a description of the input data and the function desired

Topic Outline

Arithmetic Operations

Computer Numbering Systems (Optional)

Binary, Packed Decimal, and Floating-Point Numbers

Arithmetic Programming Techniques

Accuracy and Length Considerations

Efficiency Considerations

Using Scale Factors

Intrinsic Functions

Audience

The course is suitable for entry-level programming students with no prior COBOL experience. It can also be taken by COBOL/400 programmers who want to learn ILE COBOL.

Prerequisites

Before you begin your study of the material, you should know basic programming concepts and be acquainted with structured programming design techniques. In particular, you will be expected to understand program logic that is documented using pseudocode or structured flowcharts. You may have gained this knowledge from attending classes or from relevant work experience.

This course also assumes that you have a working knowledge of IBM i programming concepts and facilities. You can satisfy this prerequisite by successfully completing the courses in the following Manta series:

Finally, the course assumes that you have completed the previous courses of this series: