Thursday 4 September 2014

COBOL Divide Clause | COBOL Division Example.

Divide Clause.
COBOL Divide Tutorial
Cobol is one of the oldest programming languages still used today. One of the critical features of COBOL is its ability to handle files. 

In COBOL, files are handled through a set of statements designed for file handling. One such statement is the COBOL Delete Statement. 

This blog post will discuss everything you need to know about COBOL Delete Statement, including its syntax, usage, error handling, and best practices.


In this tutorial, I would discussed another important COBOL verb i.e. DIVIDE cause, most you are already aware about. 

The DIVIDE statement divides one numeric data item into or by other(s) and sets the values of data items equal to the quotient and remainder. 

Divide clause  has five different format. Refer below figure for more details:



Format : 1
COBOL
COBOL Divide Clause

Here, the value of identifier-1 or literal-1 is divided into the value of identifier-2 and the quotient is then stored in identifier-2. For each successive occurrence of identifier-2, the division takes place in the left-to-right order in which identifier-2 is specified.


Format : 2
Divide
COBOL Divide Clause

Here, the value of identifier-1 or literal-1 is divided into the value of identifier-2 or literal-2. The value of the quotient is stored in each data item referenced by identifier-3.

Format : 3
COBOL
COBOL Divide Clause

Here, the value of identifier-2 or literal-2 is divided into the value of identifier-1 or literal-1. The value of the quotient is stored in each data item referenced by identifier-3.


Format : 4
COBOL
COBOL Divide Clause

Here, the value of identifier-1 or literal-1 is divided into the value of identifier-2 or literal-2. The value of the quotient is stored in identifier-3 and the value of the remainder is stored in identifier-4.

Format : 5
IBM Divide Clause
COBOL Divide Clause

Here, the value of identifier-1 or literal-1 is divided by the value of identifier-2 or literal-2. The value of the quotient is stored in identifier-3 and the value of the remainder is stored in identifier-4.

For more details refer below example:
COBOL Divide Example
COBOL Divide Clause Example

No comments:

Post a Comment

New In-feed ads