Use VarDivide to arithmetically divide a specified variable by a specified value.
VarDivide may also be entered as VarDiv[ide] or Div[ide].
Required Operands
OPER1 is the name of a previously declared numeric variable.
OPER2 is a numeric integer greater than zero.
Optional Operands
OPER3 is the name of a previously declared numeric variable, into which the remainder from the divide is to be stored.
Return Codes
OK Successful.
The value of the OPER1 variable will be divided by the OPER2 value. The result, truncated to an integer, will be stored in the OPER1 variable. If the optional OPER3 variable is provided, the remainder from the divide will be stored there. If OPER3 is omitted, the remainder is lost.
Examples
Procedure to divide two inputted values, and display the results on the message line.
------------------------------------------------------------------------
SET PPDVBL,1
DCL NUM1,NUM,6,V
DCL NUM2,NUM,6,V
DCL OPER1,NUM,6,V
DCL OPER3,NUM,6,V
PARSE NUM1,NUM2
SETD OPER1,NUM1
DIVIDE OPER1,&NUM2,OPER3
EXIT OK,'&NUM1 / &NUM2 = &OPER1, REMAINDER = &OPER3'
------------------------------------------------------------------------