DIVIDE Statement

The DIVIDE statement divides one numeric data item into or by one or more others, and stores the result in the quotient and remainder.

DIVIDE Statement - Format 1 - INTO

Read syntax diagramSkip visual syntax diagramDIVIDEidentifier-1literal-1INTOidentifier-2ROUNDEDONSIZE ERRORimperative-statement-1NOTONSIZE ERRORimperative-statement-2END-DIVIDE

In Format 1, the value of identifier-1 or literal-1 is divided into the value of identifier-2; the quotient is then placed in identifier-2. This process is repeated for each successive occurrence of identifier-2.

DIVIDE Statement - Format 2 - INTO GIVING

Read syntax diagramSkip visual syntax diagramDIVIDEidentifier-1literal-1INTOidentifier-2literal-2GIVING identifier-3ROUNDEDONSIZE ERRORimperative-statement-1NOTONSIZE ERRORimperative-statement-2END-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.

DIVIDE Statement - Format 3 - BY GIVING

Read syntax diagramSkip visual syntax diagramDIVIDEidentifier-1literal-1BYidentifier-2literal-2GIVING identifier-3ROUNDEDONSIZE ERRORimperative-statement-1NOTONSIZE ERRORimperative-statement-2END-DIVIDE

In Format 3, the value of identifier-1 or literal-1 is divided by the value of identifier-2 or literal-2. This quotient is stored in each data item referenced by identifier-3.

DIVIDE Statement - Format 4 - INTO GIVING REMAINDER

Read syntax diagramSkip visual syntax diagramDIVIDEidentifier-1literal-1INTOidentifier-2literal-2GIVINGidentifier-3ROUNDEDREMAINDERidentifier-4ONSIZE ERRORimperative-statement-1NOTONSIZE ERRORimperative-statement-2END-DIVIDE

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

DIVIDE Statement - Format 5 - BY GIVING REMAINDER

Read syntax diagramSkip visual syntax diagramDIVIDEidentifier-1literal-1BYidentifier-2literal-2GIVINGidentifier-3ROUNDEDREMAINDERidentifier-4ONSIZE ERRORimperative-statement-1NOTONSIZE ERRORimperative-statement-2END-DIVIDE

In Format 5, the value of identifier-1 or literal-1 is divided by identifier-2 or literal-2. This quotient is stored in identifier-3, and the value of the remainder is stored in identifier-4.

For all Formats:
identifier-1, identifier-2
Must be an elementary numeric item.
identifier-3, identifier-4
Must be an elementary numeric or numeric-edited item.
literal1, literal2
Must be a numeric literal.

The composite of operands is determined by superimposing all of the receiving data items, excluding the REMAINDER data item. For more information on the composite of operands, see the Size of Operands.

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

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