The DIVIDE statement divides one numeric data item into another and stores the quotient and remainder.
In Format 1, the value of identifier-1 or literal-1 is divided into the value of each identifier-2. The value of each dividend (identifier-2) is replaced by this quotient.
In Format 2, the value of identifier-1 or literal-1 is divided into the value of identifier-2 or literal-2 and the result is stored in each identifier-3.
In Format 3, the value of identifier-2 or literal-2 is divided by the value of identifier-1 or literal-1 and the result is stored in each identifier-3.
In Format 4, the value of identifier-1 or literal-1 is divided into the value of identifier-2 or literal-2; the result is stored in identifier-3, and the remainder is stored in identifier-4.
In Format 5, the value of identifier-2 or literal-2 is divided by the value of identifier-1 or literal-1; the result is stored in identifier-3, and the remainder is stored in identifier-4.
Each identifier must refer to an elementary numeric item, except that any identifier associated with the GIVING phrase may refer to either an elementary numeric item or an elementary numeric edited item.
Each literal must be a numeric literal.
Additional rules and explanations regarding features of the DIVIDE statement that are common to other arithmetic statements can be found in the discussion of common rules.See in particular the discussions of the ROUNDED phrase, the size error condition, overlapping operands, modes of operation, composite size, and incompatible data.
GIVING identifier-3 [ROUNDED ] REMAINDER identifier-4
Formats 4 and 5 are used when a remainder from the division operation is desired, namely identifier-4 .The remainder is defined as the result of subtracting the product of the quotient (identifier-3 ) and the divisor from the dividend. If identifier-3 is defined as a numeric edited item, the quotient used to calculate the remainder is an intermediate field that contains the unedited quotient.If ROUNDED is used, the quotient used to calculate the remainder is an intermediate field which contains the quotient of the DIVIDE statement, truncated rather than rounded.The intermediate field used in these calculations has the same number of digit positions and the same scale as identifier-3.
In Formats 4 and 5, the accuracy of the REMAINDER data item (identifier-4) is defined by the calculation described above.
Appropriate decimal alignment and truncation (not rounding) is performed for the content of the data item referenced by identifier-4, as needed.When the composite of the quotient and dividend operands contains more than 19 digits, the accuracy of the REMAINDER data item may be greater than that obtainable by the use of a COMPUTE statement which duplicates the calculation described above.
When the ON SIZE ERROR phrase is used in Formats 4 and 5, the following rules pertain:
DIVIDE Statement Examples
COBOL Related Interview Questions
|VSAM Interview Questions||IBM - VSAM Interview Questions|
|IBM-CICS Interview Questions||JCL Interview Questions|
|IBM DB2 Interview Questions||IBM-JCL Interview Questions|
|DB2 Using SQL Interview Questions||IBM-JCL&VSAM Interview Questions|
|IBM Mainframe Interview Questions||COBOL, CICS, JCL, VSAM, DB2 Interview Questions|
|DB2 SQL Programming Interview Questions||IMS/DB Interview Questions|
|Mainframe DB2 Interview Questions|
Procedure Division Statements
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.