170 likes | 190 Views
Get IBM Mainframe Training in Hyderabad, Ameerpet from Sannihitha Technologies and enhance IT career growth. Enroll Now With us @ 8099754435
E N D
IBM Mainframe IBM Mainframe COBOL Arithmetic Statements -Srinivas K Video Based Training To Simplify Mainframe Programming Course Duration: 2 Months Contact Us: 8099754435(Srinivas k)
COBOL Arithmetic Statements ADD SUBTRACT MULTIPLY DIVIDE COMPUTE
ADD Statement Syntax-1 ADD { identifier-1, literal-1 } [ , identifier-2, literal-2 ] . . . TO identifier-3 [ , identifier-4 ] . . . Syntax-2 ADD { identifier-1, literal-1 } { identifier-2, literal-2 } [ identifier-3, literal-3 ] GIVING identifier-4 . . .
ADD Statement Examples (A) ADD A TO B. (B) ADD A, B TO C. (C) ADD 12, A, B TO C, D (D) ADD A, B GIVING C. (E) ADD 12, A GIVING B,C.
SUBTRACT Statement Syntax SUBTRACT { identifier-1, literal-1 } [ identifier-2, literal-2 ] . . . FROM identifier-3 [ , identifier-4 ] [ , GIVING identifier-5 [ , identifier-6 ] . . . ]
SUBTRACT Statement Examples (1) SUBTRACT A FROM B. (2) SUBTRACT A, B FROM C. (3) SUBTRACT 5, A FROM B, C. (4) SUBTRACT 12 FROM A GIVING B. (5) SUBTRACT A FROM B GIVING C.
MULTIPLY Statement Syntax MULTIPLY { identifier-1, literal-1 } BY identifier-2 [ identifier-3 ] . . . [ , GIVING identifier-4 [ , identifier-5 ] . . . ]
MULTIPLY Statement Examples (1) MULTIPLY A BY B (2) MULTIPLY A BY B GIVING C3. (3) MULTIPLY 5 BY A GIVING B. (4) MULTIPLY A BY B GIVING C, D.
DIVIDE Statement Syntax-1 DIVIDE { identifier-1, literal-1 } INTO identifier-2 [ , identifier-2 ] . . . [ GIVING identifier-4 [ , identifier-5 ] . . . ] .. Syntax-2 DIVIDE { identifier-1, literal-1 } BY { identifier-2, literal-2 } GIVING identifier-3 [ , identifier-4 ].
DIVIDE Statement Syntax-3 DIVIDE { identifier-1, literal-1 } { INTO , BY } { identifier-2, literal-2 } GIVING identifier-3 REMAINDER identifier-4 .
DIVIDE Statement Examples (1) DIVIDE 5 INTO A. (2) DIVIDE 6 INTO A GIVING B, C. (3) DIVIDE A BY 3 GIVING B, C. (4) DIVIDE A BY B GIVING C. (5) DIVIDE A BY B GIVING C REMAINDER D.
ROUNDED Option Syntax Arithmetic statement [ ROUNDED ]. Examples (1) ADD NUM-1, NUM-2, NUM-3 GIVING NUM-4 ROUNDED. (2) DIVIDE NUM-1 BY NUM-2 GIVING NUM-3 ROUNDED.
The ROUNDED option Receiving Field Actual Result Truncated Result Rounded Result 123.2 123.3 PIC 9(3)V9. 567.23 PIC 9(3). 567 123 123 The ROUNDED option takes effect when, after decimal point alignment, the result calculated must be truncated on the right hand side. The option adds 1 to the receiving item when the leftmost truncated digit has an absolute value of 5 or greater.
ON SIZE ERROR Option Syntax Arithmetic statement [ON SIZE ERROR imperative statement . . .] Examples (1) ADD NUM-1, NUM-2, NUM-3 TO NUM-4 ON SIZE ERROR PERFORM 900-EXIT-PARA. (2). DIVIDE NUM-1 BY NUM-2 ON SIZE ERROR PERFORM 800-ERROR-PARA.
COMPUTE Verb Syntax COMPUTE identifier-1 . . . [ ROUNDED ] = algebraic expression [ ON SIZE ERROR ] imperative statement. Example COMPUTE VOLUME = ( 4 / 3) * ( 22 / 7 ) * R ** 3. Note: If the ROUNDED and ON SIZE ERROR both appear, then the ROUNDED option should precede the ON SIZE ERROR.
The COMPUTE COMPUTE Identifier [ ROUNDED ] ... = ArithmeticExpression ON SIZE ERROR NOT ON SIZE ERROR StatementBlock END-COMPUTE Precedence Rules. 1. 2. ** * / + - = = = = = POWER MULTIPLY DIVIDE ADD SUBTRACT NN x ÷ + - 3. Compute IrishPrice = SterlingPrice / Rate * 100. 1000.50 156.25 87 179.59 156.25 87 Before After
Thanks For Watching Our Video Grab The Latest IT Courses Information By To Our Channel Address: Flat# 407, Adhitya Enclave, Annapurna Block, Ameerpet, Hyderabad-16. Ph: 8099754435