| Q. How do you perform Arithmetic in COBOL? For example, how do you write a simple program that calculates the Interest to be paid on a Principal p? |
| You often need to do Math in COBOL. You can perform Arithmetic in COBOL using Arithmetic Operators. When you perform some arithmetic on two or more numeric quantities, such an expression is called an Arithmetic Expressions. There are 4 main Arithmetic Operators in COBOL – ADD, SUBTRACT, MULTIPLY and DIVIDE. You can even write complex arithmetic expressions by using the COMPUTE verb. I have written about the syntax of each operator, followed by examples and some results. |
| Q. How’z the ADD Operator used in COBOL. Show me some stuff... |
| The ADD operator can be used to add two or more quantities. In the assembly language, we write the instruction ADD A B to find the sum of A and B. The final sum is stored in A. On the same lines, the ADD Operator in COBOL has the following syntax :
ADD one-quantity TO second-quantity After performing the above step, the computer adds 5 to the value of A, so A=15. Suppose a variable B=5, then I may also write |
Saturday, September 26, 2009
COBOL Tutorial – Arithmetic Operators
Subscribe to:
Posts (Atom)
Note :
| © Copyright – Quasar Chunawalla, Tata Consultancy Services,2009.
Note : The copyrights of all the material, text and pictures posted in this website belong to the author. Any instance of lifting the material from this website, shall be considered as an act of plagiarism. For any clarifications, please mail at quasar.chunawala@tcs.com |
Search by Tags
Contiguous
REF
Variable Blocked
Quasar Chunawalla
CONTIG
Main Page
sub-parameter
Serial
JCL Tutorial
TAPE Drive
Older Posts
Extends
BLKSIZE
SPACE
BLKS
V
SECONDARY
Learn C#
Atom
Block
PDS
DIRBLKS
Uniform
UNIT
ROUND
Partitioned Dataset
VOL
VB
Posts (Atom)
FB
JCL
U
IS
Block Size
RLSE
JCL Tutorial – 08 : DD Statement – Part III
Data Control Block
DD
Indexed Sequential
LABEL
Referback
Sequence
RECFM
Direct Access
Storage Space
Mainframes
PRIMARY
Volume
RETAIN
DA
PO
MB
MXIG
Affinity
Links to this post
Servers
4:34 PM
IBM Mainframes
Record Length
CYL
Logical Record Length
PS
DCB
Track
Release
KB
IBM
SEQ
F
Cylinder
SER
skip to sidebar
Partitioned Organized
0 comments
Fixed Blocked
PRIVATE
Record Format
AFF
TRKS
DSORG
fahrradpacktaschen
LRECL
Physical Sequential

