An arithmetic expression can be an identifier of a numeric elementary item, a numeric literal, such identifiers and literals separated by arithmetic operators, two arithmetic expressions separated by an arithmetic operator or an arithmetic expression enclosed in parentheses. Any arithmetic expression may be preceded by a unary operator.
The permissible combinations of variables, numeric literals, arithmetic operators and parentheses are given in Table.
Combination of Symbols in Arithmetic Expressions
There are five binary arithmetic operators and two unary arithmetic operators that may be used in arithmetic expressions. They are represented by specific characters that must be preceded by a space and followed by a space. See Table.
Formation and Evaluation Rules
Parentheses may be used in arithmetic expressions to specify the order in which elements are to be evaluated. Expressions within parentheses are evaluated first; within nested parentheses, evaluation proceeds from the least inclusive set to the most inclusive set. When parentheses are not used, or parenthesized expressions are at the same level of inclusiveness, the following hierarchical order of execution is implied:
Parentheses are used either to eliminate ambiguities in logic where consecutive operations of the same hierarchical level appear, or to modify the normal hierarchical sequence of execution in expressions where it is necessary to have some deviation from the normal precedence. When the sequence of execution is not specified by parentheses, the order of execution of consecutive operations of the same hierarchical level is from left to right.
The ways in which operands, operators and parentheses may be combined in an arithmetic expression are summarized in Table.
An arithmetic expression may begin only with one of the following symbols: ( + – or an operand. An arithmetic expression may end only with a ) or an operand. There must be a one-to-one correspondence between left and right parentheses in an arithmetic expression such that each left parenthesis is to the left of its corresponding right parenthesis.
The following rules apply to evaluation of exponentiation in the following arithmetic expression:
arithmetic-expression-1 ** arithmetic-expression-2
arithmetic-expression-1 provides the base value and arithmetic-expression-2 provides the exponent value.
Arithmetic expressions allow the user to combine arithmetic operations without the restrictions on composite of operands, receiving data items, or both.
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.