Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

6.2.11 DIVIDE Statement



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.


    ___ Format 1 ___________________________________________________________ 
   |                                                                        |
   |                                     <___________________________       |
   | >>__DIVIDE__ _identifier-1_ __INTO____identifier-2__ _________ _|____> |
   |             |_literal-1____|                        |_ROUNDED_|        |
   |                                                                        |
   | >__ ____________________________________________ ____________________> |
   |    |_ ____ __SIZE ERROR__imperative-statement-1_|                      |
   |      |_ON_|                                                            |
   |                                                                        |
   | >__ _________________________________________________ _______________> |
   |    |_NOT__ ____ __SIZE ERROR__imperative-statement-2_|                 |
   |           |_ON_|                                                       |
   |                                                                        |
   | >__ ____________ ___________________________________________________>< |
   |    |_END-DIVIDE_|                                                      |
   |                                                                        |
   |________________________________________________________________________|
In Format 1, 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__ _identifier-1_ __INTO__ _identifier-2_ _________________> |
   |             |_literal-1____|        |_literal-2____|                   |
   |                                                                        |
   |            <___________________________                                |
   | >__GIVING____identifier-3__ _________ _|_____________________________> |
   |                            |_ROUNDED_|                                 |
   |                                                                        |
   | >__ ____________________________________________ ____________________> |
   |    |_ ____ __SIZE ERROR__imperative-statement-1_|                      |
   |      |_ON_|                                                            |
   |                                                                        |
   | >__ _________________________________________________ _______________> |
   |    |_NOT__ ____ __SIZE ERROR__imperative-statement-2_|                 |
   |           |_ON_|                                                       |
   |                                                                        |
   | >__ ____________ ___________________________________________________>< |
   |    |_END-DIVIDE_|                                                      |
   |                                                                        |
   |________________________________________________________________________|
In Format 2, 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 ___________________________________________________________ 
   |                                                                        |
   | >>__DIVIDE__ _identifier-1_ __BY__ _identifier-2_ ___________________> |
   |             |_literal-1____|      |_literal-2____|                     |
   |                                                                        |
   |            <___________________________                                |
   | >__GIVING____identifier-3__ _________ _|_____________________________> |
   |                            |_ROUNDED_|                                 |
   |                                                                        |
   | >__ ____________________________________________ ____________________> |
   |    |_ ____ __SIZE ERROR__imperative-statement-1_|                      |
   |      |_ON_|                                                            |
   |                                                                        |
   | >__ _________________________________________________ _______________> |
   |    |_NOT__ ____ __SIZE ERROR__imperative-statement-2_|                 |
   |           |_ON_|                                                       |
   |                                                                        |
   | >__ ____________ ___________________________________________________>< |
   |    |_END-DIVIDE_|                                                      |
   |                                                                        |
   |________________________________________________________________________|
In Format 3, 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 each data item referenced by identifier-3.


    ___ Format 4 ___________________________________________________________ 
   |                                                                        |
   | >>__DIVIDE__ _identifier-1_ __INTO__ _identifier-2_ _________________> |
   |             |_literal-1____|        |_literal-2____|                   |
   |                                                                        |
   | >__GIVING__identifier-3__ _________ __REMAINDER__identifier-4________> |
   |                          |_ROUNDED_|                                   |
   |                                                                        |
   | >__ ____________________________________________ ____________________> |
   |    |_ ____ __SIZE ERROR__imperative-statement-1_|                      |
   |      |_ON_|                                                            |
   |                                                                        |
   | >__ _________________________________________________ _______________> |
   |    |_NOT__ ____ __SIZE ERROR__imperative-statement-2_|                 |
   |           |_ON_|                                                       |
   |                                                                        |
   | >__ ____________ ___________________________________________________>< |
   |    |_END-DIVIDE_|                                                      |
   |                                                                        |
   |________________________________________________________________________|
In Format 4, the value of identifier-1 or literal-1 is divided into 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 ___________________________________________________________ 
   |                                                                        |
   | >>__DIVIDE__ _identifier-1_ __BY__ _identifier-2_ ___________________> |
   |             |_literal-1____|      |_literal-2____|                     |
   |                                                                        |
   | >__GIVING__identifier-3__ _________ __REMAINDER__identifier-4________> |
   |                          |_ROUNDED_|                                   |
   |                                                                        |
   | >__ ____________________________________________ ____________________> |
   |    |_ ____ __SIZE ERROR__imperative-statement-1_|                      |
   |      |_ON_|                                                            |
   |                                                                        |
   | >__ _________________________________________________ _______________> |
   |    |_NOT__ ____ __SIZE ERROR__imperative-statement-2_|                 |
   |           |_ON_|                                                       |
   |                                                                        |
   | >__ ____________ ___________________________________________________>< |
   |    |_END-DIVIDE_|                                                      |
   |                                                                        |
   |________________________________________________________________________|
In Format 5, the value of identifier-1 or literal-1 is divided by 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 all Formats:

identifier-1, identifier-2

X Must name an elementary numeric item. Identifier-1 and identifier-2
X cannot be date fields.

identifier-3, identifier-4
Must name an elementary numeric or numeric-edited item.


X If identifier-3 or identifier-4 is a date field, then see "Storing
X Arithmetic Results That Involve Date Fields" in topic 6.1.5.2.3 for
X details on how the quotient or remainder is stored in identifier-3.

literal-1, literal-2
Must be a numeric literal.


X In Formats 1, 2, and 3, floating-point data items and literals can be used
X anywhere that a numeric data item or literal can be specified.


X In Formats 4 and 5, floating-point data items or literals cannot be used.

Subtopics:



Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.