Cobol Language - Tips: Difference between revisions

From Wiki
(Criou a página com " = Divisions of a Cobol Program = IDENTIFICATION DIVISION * ENVIRONMENT DIVISION CONFIGURATION SECTION * INPUT-OUTPUT SECTION DATA DIVISION...")
 
Line 20: Line 20:
  *
  *


= Operation =
= Operations =
 
{| class="wikitable"
|-
! 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 || -
|}
 
{| class="wikitable"
|-
! Cobol language !! Operation !! Header text
|-
| 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 || -
|}
 
{| class="wikitable"
|-
! 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
|| -
|}
 
{| class="wikitable"
|-
! Cobol language !! Operation !! Header text
|-
| MULTIPLY B BY A || A = A * B || -
|-
| MULTIPLY B BY A GIVING C || C = A * B || -
|-
| SUBTRACT B C FROM A GIVING D || D = A - B - C || -
|}

Revision as of 22:54, 17 April 2018


Divisions of a Cobol Program

   IDENTIFICATION DIVISION
*
   ENVIRONMENT DIVISION
     CONFIGURATION SECTION
* 
     INPUT-OUTPUT SECTION

   DATA DIVISION
     FILE SECTION
*
     WORKING-STORAGE SECTION
*
     LINKAGE SECTION
*
     SCREEN SECTION
*

Operations

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 -
Cobol language Operation Header text
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 -
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

-
Cobol language Operation Header text
MULTIPLY B BY A A = A * B -
MULTIPLY B BY A GIVING C C = A * B -
SUBTRACT B C FROM A GIVING D D = A - B - C -