Cobol Language - Tips: Difference between revisions
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
You can download some examples from my repository on Git Hub [https://github.com/ebasso/cobol-exemplos Cobol Examples] | |||
= Divisions of a Cobol Program = | = Divisions of a Cobol Program = | ||
01234 | |||
IDENTIFICATION DIVISION | |||
* | * | ||
ENVIRONMENT DIVISION | |||
* | |||
CONFIGURATION SECTION | |||
* | * | ||
INPUT-OUTPUT SECTION | |||
* | |||
DATA DIVISION | |||
* | |||
FILE SECTION | |||
* | * | ||
WORKING-STORAGE SECTION | |||
* | * | ||
LINKAGE SECTION | |||
* | * | ||
SCREEN SECTION | |||
* | * | ||
PROCEDURE DIVISION | |||
= Cobol Arithmetic Operations = | |||
'''ADDITION''' | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 35: | Line 41: | ||
| ADD B C GIVING A || A = B + C || - | | ADD B C GIVING A || A = B + C || - | ||
|} | |} | ||
'''SUBTRACTION''' | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Cobol language !! Operation !! | ! Cobol language !! Operation !! Comments | ||
|- | |- | ||
| SUBTRACT B FROM A || A = A - B || - | | SUBTRACT B FROM A || A = A - B || - | ||
Line 46: | Line 54: | ||
| SUBTRACT B C FROM A GIVING D || D = A - B - C || - | | SUBTRACT B C FROM A GIVING D || D = A - B - C || - | ||
|} | |} | ||
'''DIVISION''' | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 63: | Line 73: | ||
|| - | || - | ||
|} | |} | ||
'''MULTIPLICATION''' | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Cobol language !! Operation !! | ! Cobol language !! Operation !! Comments | ||
|- | |- | ||
| MULTIPLY B BY A || A = A * B || - | | MULTIPLY B BY A || A = A * B || - | ||
|- | |- | ||
| MULTIPLY B BY A GIVING C || C = A * B || - | | MULTIPLY B BY A GIVING C || C = A * B || - | ||
|} | |} |
Latest revision as of 23:06, 17 April 2018
You can download some examples from my repository on Git Hub Cobol Examples
Divisions of a Cobol Program
01234 IDENTIFICATION DIVISION * ENVIRONMENT DIVISION * CONFIGURATION SECTION * INPUT-OUTPUT SECTION * DATA DIVISION * FILE SECTION * WORKING-STORAGE SECTION * LINKAGE SECTION * SCREEN SECTION * PROCEDURE DIVISION
Cobol Arithmetic Operations
ADDITION
Cobol language | Operation | Comments |
---|---|---|
ADD B TO A | A = A + B | - |
ADD B C TO A | A = A + B + C | - |
ADD 1 TO A B | A = A + 1; B = B + 1 | - |
ADD B C GIVING A | A = B + C | - |
SUBTRACTION
Cobol language | Operation | Comments |
---|---|---|
SUBTRACT B FROM A | A = A - B | - |
SUBTRACT B C FROM A | A = A - B - C | - |
SUBTRACT B C FROM A GIVING D | D = A - B - C | - |
DIVISION
Cobol language | Operation | Comments |
---|---|---|
DIVIDE 2 INTO A | A = A / 2 | - |
DIVIDE 2 INTO A GIVING B | B = A / 2 | - |
DIVIDE A BY 2 GIVING B | B = A / 2 | - |
DIVIDE A BY 2 GIVING B REMAINDER C |
B = A / 2 REMINDER C |
- |
MULTIPLICATION
Cobol language | Operation | Comments |
---|---|---|
MULTIPLY B BY A | A = A * B | - |
MULTIPLY B BY A GIVING C | C = A * B | - |