,       3GL   4GL   5GL   .

COBOL

(COBOL, COmmon Business Oriented Language) ( 1959), , , -.

2002 - . COBOL . 50 , , , , , COBOL, Common Business-Oriented Language.

, . , , , , Datamonitor 5 . , , .

  ( )

( ). ANSI- .

1959: , (COBOL) - 40 .

, Common Business-Oriented Language ( - ), . , , , .

, . , Harvard Mark I . 1950- , , , .

, . ( , ). . , , .

, , , .[4] -, , .

Dr. Dobbs Journal ( The Gartner Group, Computerworld, Ovum Micro Focus International) . 1997 240 . 90 % , 75 % . 2 . .

Hello world

IDENTIFICATION DIVISION.

PROGRAM-ID. HELLO-WORLD.

*

ENVIRONMENT DIVISION.

*

DATA DIVISION.

*

PROCEDURE DIVISION.

PARA-1.

DISPLAY "Hello, world.".

*

EXIT PROGRAM.

END PROGRAM HELLO-WORLD.

COBOL

( , ), , , JAVA, JavaScript, Python Ruby . , , , , , COBOL?

Gartner 2001 ( ), 85% - COBOL, , , . Micro Focus, COBOL, , 70% .

, , COBOL , Micro Focus , - , . , , , . Micro Focus (Arunn Ramadoss) : - , COBOL.

, , , . - , , .

, , , COBOL, , .NET HTML5, , , , , COBOL. , .

- , , .

, Java- C- : , , .

, , , COBOL. , - . , , .

- , . , , , , . .

, , COBOL, - . , , , , , , ( ).

, ? - cobol.com, , . , The 21st Century COBOL Programmer (Nancy Stern), (Robert A. Stern) (James P. Ley).

COBOL

, . COBOL . . . COBOL, , , . COBOL . , .

, . COBOL , COmmon Business-Oriented Language, 1959 , , . - ( ) notes.sochi.org.ru/1333/ (. .) en.wikipedia.org/wiki/COBOL (eng.).

, (1 .) (1 .)

, Notepad vi, emacs, nano .. .. , ( ;-) ).

, , , , , . , .

www.opencobol.org/ - OpenCOBOL (open-source, , )

http://tiny-cobol.sourceforge.net/ - TinyCobol (open-source, 1 2011 , )

http://sourceforge.net/projects/cobolforgcc/ - Cobol for GCC (open-source, , 2009.)

http://homepages.paradise.net.nz/jsoeberg/ - COBOL 12 (freeware, 16- DOS / Windows)

http://cev.cemotel.cz/cobol/cb_en/mx_all.htm - Cevela MX COBOL (freeware, Windows)

www.microfocus.com/promotions/wwemvctd0510/default.aspx?page=form - Micro Focus Visual COBOL R2 (trial, windows)

www.thekompany.com/products/kobol/ - KOBOL (trial, linux, windows)

DOS.

OpenCOBOL, , .

, . , Hello World.

:

000100 IDENTIFICATION DIVISION.

000200 PROGRAM-ID. HELLOWORLD.

000300* --- . ---

000400 ENVIRONMENT DIVISION.

000500 DATA DIVISION.

000600 PROCEDURE DIVISION.

000700 BEGIN.

000800 DISPLAY Hello World!.

000900 STOP RUN.

.cob ( .cbl) , .

cobc -x <> . !

Hello World!

.

. . , 50 . :

1. .

2. , .

3. , .

COBOL 80 .

1-6: ()

7:

* ,

,

D- debug.

8 11: . DIVISION', SECTION', , ( ).

12-72: . .

73-80: . .

, .

COBOL 4 DIVISION, .

DIVISION .

IDENTIFICATION DIVISION. ,

PROGRAM-ID. Helloworld.

AUTHOR. Beginner.

INSTALLATION. MyLocalCobolComputer.

DATE-WRITTEN. 19/03/2011.

DATE-COMPILED. 19/03/2011.

SECURITY. Iwillnottellanybodythiscode.

2011 .

DIVISION . .

ENVIRONMENT DIVISION. , , . .

CONFIGURATION SECTION. SOURCE-COMPUTER. OBJECT-COMPUTER. SPECIAL-NAMES. , .

SPECIAL-NAMES. , ( ).

INPUT-OUTPUT SECTION. , -, , . FILE-CONTROL. I-O-CONTROL.

DIVISION . .

DATA DIVISION. . 4 :

FILE SECTION. .

WORKING-STORAGE SECTION. .

LOCAL-STORAGE SECTION. , ( ).

LINKAGE SECTION. , .

DIVISION . .

PROCEDURE DIVISION. , , , .

BEGIN. .

DISPLAY Hello World!.

STOP RUN. .

. .

. , , .

. , 2011.

2. COBOL

, , , COBOL , . , .

, .

000100 IDENTIFICATION DIVISION.

000200 PROGRAM-ID. HELLOWORLD.

000300* --- . ---

000400 ENVIRONMENT DIVISION.

000500 DATA DIVISION.

000600 PROCEDURE DIVISION.

000700 BEGIN.

000800 DISPLAY Hello World!.

000900 STOP RUN.

DATA DIVISION. , WORKING-STORAGE SECTION. WS-A WS-B.

:

000500 DATA DIVISION.

000510 WORKING-STORAGE SECTION.

000520 01 WS-A PIC 999.

000530 01 WS-B PIC 9(3).

000540 01 WS-RESULT PIC9(6).

PROCEDURE DIVISION. :

000700 BEGIN.

000800 DISPLAY Hello I'm your new calculator!.

000900 DISPLAY Please Enter first number from 0 to 999.

001000 ACCEPT WS-A.

001100 DISPLAY Please Enter second number from 0 to 999.

001200 ACCEPT WS-B.

001300 DISPLAY ------------------------------------.

001400 DISPLAY .

001500 DISPLAY Your results are:.

001600 ADD WS-A TO WS-B GIVING WS-RESULT.

001700 DISPLAY Summ is: , WS-RESULT.

001800 SUBTRACT WS-A FROM WS-B GIVING WS-RESULT.

001900 DISPLAY Subtract is: , WS-RESULT.

002000 MULTIPLY WS-A BY WS-B GIVING WS-RESULT.

002100 DISPLAY Multiplication is: , WS-RESULT.

002200 DIVIDE WS-A BY WS-B GIVING WS-RESULT.

002300 DISPLAY Divide is: , WS-RESULT.

002400 STOP RUN.

.cob . ( ? ;-) )

, :

Hello I'm your new calculator!

Please Enter first number from 0 to 999

300

Please Enter second number from 0 to 999

100

------------------------------------

Your results are:

Summ is: 000400

Subtract is: 000200

Multiplication is: 030000

Divide is: 000003

300 100 , . , , .

DATA DIVISION.

000510 WORKING-STORAGE SECTION. , .

000520 01 WS-A PIC 999.

000530 01 WS-B PIC 9(3).

000540 01 WS-RESULT PIC 9(6).

, 01, (WS-A, WS-B WS-RESULT), PIC ( PICTURE IS), . , . , .

, 3- , 6- .

. 9 , , , , - 999999999999999 9(15), , .

PROCEDURE DIVISION

DISPLAY . . . ,

001700 DISPLAY Summ is: , WS-RESULT.

.

4 :

ADD WS-A TO WS-B GIVING WS-RESULT.

SUBTRACT WS-A FROM WS-B GIVING WS-RESULT.

MULTIPLY WS-A BY WS-B GIVING WS-RESULT.

DIVIDE WS-B BY WS-A GIVING WS-RESULT.

.

<> 1 TO/FROM/BY 2 GIVING .

, , ,

ADD 10 TO 20 GIVING WS-RESULT.

10 20 (30) WS-RESULT.

, GIVING , TO, FROM, BY WS-B ( WS-A DIVIDE).

, , , :

ADD 1 2 3 TO WS-B 1+2+3, WS-B WS-B.

TO ADD 1 WS-A 2 WS-B WS-B. TO ( TO TO ) GIVING, . SUBTRACT.

MULTIPLY DIVIDE GIVING ( ).

DIVIDE .

DIVIDE WS-A INTO WS-B GIVING WS-C BY INTO , . , :

DIVIDE WS-A INTO WS-B WS-B / WS-A = WS-B

DIVIDE WS-B BY WS-A GIVING WS-RESULT

WS-B / WS-A = WS-RESULT

! BY GIVING. - .

?. MOVE

MOVE 10 TO WS-A

MOVE WS-A TO WS-B

MOVE 10 TO WS-A WS-B

! MOVE , .. TO.

. , 2011.

3. COBOL

DIVIDE.

DIVIDE WS-B BY WS-A GIVING WS-RESULT REMAINDER <>.

REMAINDER .

:

, ROUNDED , , .

ADD WS-A TO WS-B GIVING WS-RESULT ROUNDED.

. PICTURE IS ( PIC) .

DATA DIVISION.

:

01 ;

WS-B ;

PIC , , , PICTURE IS.

9(3) 9 3.

.

01 49 77. , , .

01 CUSTOMER-RECORD.

05 CUSTOMER-NAME PIC X(10).

05 CUSTOMER-ADDRESS PIC X(30).

77 , , -.

88 , conditional, , .

, , .

.

, -, - .

30 .

.

COBOL.

: .

9 ;

V , ( ).

S , ( ).

X - , .. , , , . .

A .

, , , /:

Z 9' , .

$ , , , , . . ENVIRONMENT DIVISION.

* Z, *.

() , , . , , .

+ () - (), +, -.

. () . .

, () . .

/ () . . , .

0 () . 0.

B ( blank, ) .

, . 18 , - 160 . .

PIC'!

, :

BLANK WHEN ZERO 0, , .

VALUE .

, .

, .

000100 IDENTIFICATION DIVISION.

000200 PROGRAM-ID. VARIABLES-TEST.

000300 AUTHOR. ME.

000400 ENVIRONMENT DIVISION.

000500 DATA DIVISION.

000600 WORKING-STORAGE SECTION.

000700 01 HUMAN-CONTAINER.

000800 05 HUMAN-NAME PIC A(30).

000900 05 HUMAN-ADDRESS PIC X(160).

001000 77 SQUARE-METERS PIC 9(18).

001100 77 SQUARE-PRICE PIC 9(15)V9(2).

001150 77 FLAT-PRICE PIC 9(15)V9(2).

001200 77 TAX-PERCENT PIC 9(2).

001300 77 TAX-SUMM PIC 9(15)V9(2).

001350 77 NEGATIVE-VALUE PIC S9(10)V9(6).

001400* --- OOOOMG! ---

001500 77 SQUARE-METERS-OUT PIC Z(17)9.

001600 77 SQUARE-PRICE-OUT PIC Z(14)9.Z(2).

001650 77 FLAT-PRICE-OUT-1 PIC Z(3),Z(3),Z(3),Z(3).9(2).

001660 77 FLAT-PRICE-OUT-2 PIC Z(3)BZ(3)BZ(3)BZ(3).9(2).

001700 77 TAX-PERCENT-OUT PIC Z(2).

001800 77 TAX-SUMM-OUT PIC Z(14)9.9(2).

001900 77 NEGATIVE-VALUE-OUT-1 PIC +Z(10).9(6).

002000 77 NEGATIVE-VALUE-OUT-2 PIC -Z(10).*(6).

002100* --------------------------------

002200 PROCEDURE DIVISION.

002300 BEGIN.

002400 DISPLAY "Please enter Name: ".

002500 ACCEPT HUMAN-NAME.

002550 DISPLAY "Please enter Address: ".

002600 ACCEPT HUMAN-ADDRESS.

002700 DISPLAY "Please enter square meters of flat: ".

002800 ACCEPT SQUARE-METERS.

002900 DISPLAY "Please enter square meter's price: ".

003000 ACCEPT SQUARE-PRICE.

003100 DISPLAY "Please enter percent of tax: ".

003200 ACCEPT TAX-PERCENT.

003300 DISPLAY "Enter any really big NEGATIVE value: ".

003400 ACCEPT NEGATIVE-VALUE.

003500 DISPLAY "---------------------------------------".

003600 DISPLAY " ".

003700 DISPLAY HUMAN-NAME.

003800 DISPLAY HUMAN-ADDRESS.

003900 DISPLAY "SQUARE-METERS: ", SQUARE-METERS.

004000 MOVE SQUARE-METERS TO SQUARE-METERS-OUT.

004100 DISPLAY "SQUARE-METERS-OUT: ", SQUARE-METERS-OUT.

004200 DISPLAY "SQUARE-PRICE: ", SQUARE-PRICE.

004300 MOVE SQUARE-PRICE TO SQUARE-PRICE-OUT.

004400 DISPLAY "SQUARE-PRICE-OUT: ", SQUARE-PRICE-OUT.

004500 MULTIPLY SQUARE-METERS BY SQUARE-PRICE GIVING FLAT-PRICE.

004600 DISPLAY "FLAT-PRICE: ", FLAT-PRICE.

004700 MOVE FLAT-PRICE TO FLAT-PRICE-OUT-1 FLAT-PRICE-OUT-2.

004800 DISPLAY "FLAT-PRICE-OUT-1: ", FLAT-PRICE-OUT-1.

004850 DISPLAY "FLAT-PRICE-OUT-2: ", FLAT-PRICE-OUT-2.

004900 DISPLAY "TAX-PERCENT: ", TAX-PERCENT.

005000 MOVE TAX-PERCENT TO TAX-PERCENT-OUT.

005100 DISPLAY "TAX-PERCENT-OUT: ", TAX-PERCENT-OUT.

005200 DISPLAY "TAX-SUMM: ", TAX-SUMM.

005300 MOVE TAX-SUMM TO TAX-SUMM-OUT.

005400 DISPLAY "TAX-SUMM-OUT: ", TAX-SUMM-OUT.

005500 DISPLAY "NEGATIVE-VALUE: ", NEGATIVE-VALUE.

005600 MOVE NEGATIVE-VALUE TO NEGATIVE-VALUE-OUT-1 NEGATIVE-VALUE-OUT-2.

005700 DISPLAY "NEGATIVE-VALUE-OUT-1: ", NEGATIVE-VALUE-OUT-1.

005800 DISPLAY "NEGATIVE-VALUE-OUT-2: ", NEGATIVE-VALUE-OUT-2.

005900 STOP RUN.

.

Please enter Name:

Slava

Please enter Address:

Moscow 15

Please enter square meters of flat:

44

Please enter square meter's price:

1234123

Please enter percent of tax:

20

Enter any really big NEGATIVE value:

-123123213213

---------------------------------------

Slava

Moscow 15

SQUARE-METERS: 000000000000000044

SQUARE-METERS-OUT: 44

SQUARE-PRICE: 000000001234123.00

SQUARE-PRICE-OUT: 1234123.00

FLAT-PRICE: 000000054301412.00

FLAT-PRICE-OUT-1: 54,301,412.00

FLAT-PRICE-OUT-2: 54 301 412.00

TAX-PERCENT: 20

TAX-PERCENT-OUT: 20

TAX-SUMM: 000000000000000.00

TAX-SUMM-OUT: 0.00

NEGATIVE-VALUE: -3123213213.000000

NEGATIVE-VALUE-OUT-1: -3123213213.000000

NEGATIVE-VALUE-OUT-2: -3123213213.000000

.

, , .

, , , , , .

. , 2011.

4. COBOL IF

( ).

, , , IF (), COBOL.

?

IF <>

<1>

( ELSE )

END-IF.

. :

COBOL . (), , IF , END-IF.

!

:

1. :

(IS NUMERIC) , .

(IS ALPHABETIC) , .

( ) ( ) (IS ALPHABETIC-UPPER ALPHABETIC-LOWER) , .

.

,

IF WS-A IS NUMERIC

MOVE WS-A TO WS-B

ELSE

DISPLAY Error!

END-IF.

2. :

( ), ,

IS GREATER THAN IS > ,

IS NOT GREATER THAN IS NOT > ,

IS LESS THAN IS < ,

IS NOT LESS THAN IS NOT < ,

IS EQUAL TO IS =

IS NOT EQUAL TO IS NOT =

IS GREATER THAN OR EQUAL TO IS >= ,

IS LESS THAN OR EQUAL TO IS <= ,

, . COBOL , . ASCII, EBCDIC ( ) .

IF TEXT-INPUT IS > Orange

DISPLAY Orange

DISPLAY TEXT-INPUT

ELSE

DISPLAY TEXT-INPUT

DISPLAY Orange

END-IF.

 

Apple , Orange, apple, .

3. :

IS POSITIVE ;

IS NEGATIVE ;

IS ZERO ;

IS NOT POSITIVE (0 );

IS NOT NEGATIVE (0 );

IS NOT ZERO .

:

MOVE 100 TO WS-RESULT.

DISPLAY WS-RESULT IS , WS-RESULT.

IF WS-RESULT IS NOT ZERO

DISPLAY WS-RESULT IS NOT ZERO!

END-IF.

IF WS-RESULT IS ZERO

DISPLAY WS-RESULT IS ZERO!

END-IF.

IF WS-RESULT IS NOT POSITIVE

DISPLAY WS-RESULT IS NOT POSITIVE!

END-IF.

IF WS-RESULT IS NOT NEGATIVE

DISPLAY WS-RESULT IS NOT NEGATIVE!

END-IF.

IF WS-RESULT IS POSITIVE

DISPLAY WS-RESULT IS POSITIVE!

END-IF.

IF WS-RESULT IS NEGATIVE

DISPLAY WS-RESULT IS NOT ZERO!

END-IF.

:

WS-RESULT IS 000100

WS-RESULT IS NOT ZERO!

WS-RESULT IS NOT NEGATIVE!

WS-RESULT IS POSITIVE!

4. :

88. . , . CASE IF. :

DATA DIVISION.

01 NUMBER-CHECK PIC S9.

88 NC-ONE VALUE 1.

88 NC-ZERO VALUE 0.

88 NC-MINUS VALUE -1.

PROCEDURE DIVISION.

ACCEPT NUMBER-CHECK.

IF NC-ONE

DISPLAY NUMBER-CHECK IS ONE

END-IF.

IF NC-MINUS

DISPLAY NUMBER-CHECK IS MINUS

END-IF.

IF NC-ZERO

DISPLAY NUMBER-CHECK IS ZERO

END-IF.

:

NC-ONE, NC-MINUS NC-ZERO NUMBER-CHECK, IF NC-ONE,

IF NUMBER-CHECK = 1.

VALUE VALUES <-> THRU <->, 88 NC-ONE VALUES 1 THRU 10, NUMBER-CHECK 1 10.

IF NOT, AND OR, , IF NOT WS-A = WS-B IF ((WS-A = WS-B) AND (WS-A = WS-RESULT)) OR (WS-RESULT = WS-B).

. , 2011.

  ,       3GL   4GL   5GL   .

, , , Deployment diagram - - , .




 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _.
10.11.2021 - 12:36: - Conscience -> . ? - _.
10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _.
10.11.2021 - 12:35: - Ecology -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> . - _.
10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _.
10.11.2021 - 09:18: - New Technologies -> , 5G- - _.
10.11.2021 - 09:18: - Ecology -> - _.
10.11.2021 - 09:16: - Ecology -> - _.
10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _.
10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
Bourabai Research -  XXI Bourabai Research Institution