COBOL Division identification division environment division data division

  • Slides: 15
Download presentation

COBOL Division identification division. environment division. data division. procedure division. http: //www. thaiall. com/programming

COBOL Division identification division. environment division. data division. procedure division. http: //www. thaiall. com/programming Page: 4

Compiler Download C: >mkdir cobol C: >cd cobol C: cobol>pkunzip cobol 3. zip C:

Compiler Download C: >mkdir cobol C: >cd cobol C: cobol>pkunzip cobol 3. zip C: cobol>cobol test, nul C: cobol>link test, nul, , nul C: cobol>test. exe http: //www. thaiall. com/downloadx/cobol 3. zip 746 KB http: //www. thaiall. com/programming Page: 5

Sample of Compiler File C: cobol> dir 08: 11 08: 15 08: 16 11:

Sample of Compiler File C: cobol> dir 08: 11 08: 15 08: 16 11: 59 11: 58 12: 00 11: 59 11: 17 11: 58 12: 01 12: 00 01/21/1994 AM 02/01/1992 AM 02/01/1992 PM 02/01/1992 AM 09/15/1995 AM 02/01/1992 PM http: //www. thaiall. com/programming 70, 420 35, 924 37, 924 2, 048 304, 896 27, 008 97, 936 223, 232 47, 104 74, 420 152, 064 119, 150 206, 592 ADIS. EXE ADISINIT. EXE ADISKEY. EXE ANIMATOR. LBR CHECK. LBR COBCLI. LBR COBOL. EXE GENERATE. LBR HELP. LBR IXSIO. EXE LCOBOL. LIB LINK. EXE UTILS. LBR Page: 6

Compiling (1/2) C: cobol>cobol Source file-name Object file-name Source listing Object listing [. CBL]:

Compiling (1/2) C: cobol>cobol Source file-name Object file-name Source listing Object listing [. CBL]: test [X. OBJ]: test [NUL. LST]: test [NUL. GRP]: test C: cobol>link Object Modules [. OBJ]: test Run File [X. EXE]: test List File [NUL. MAP]: test Libraries [. LIB: [ Definitions File [NUL. DEF]: test C: cobol>test 5 http: //www. thaiall. com/programming Page: 7

Compiling (2/2) C: cobol>cobol test, nul Microsoft (R) COBOL Optimizing Compiler Version 4. 5

Compiling (2/2) C: cobol>cobol test, nul Microsoft (R) COBOL Optimizing Compiler Version 4. 5 COBOL software by Micro Focus Copyright (C) Microsoft Corporation 1984, 1991. All rights reserved. Copyright (C) Micro Focus Ltd. 1984, 1991. All rights reserved. *Checking complete with no errors - starting code generation *Data = 000000613 Code = 000000276 Dictionary = 000001154 C: cobol>link test, nul, , nul Microsoft (R) Segmented-Executable Linker Version 5. 15 Copyright (C) Microsoft Corp 1984 -1991. All rights reserved. C: cobol>test 5 http: //www. thaiall. com/programming Page: 8

สรางแฟม short. cbl DOS> edit short. cbl procedure division. display 5. DOS> cobol short,

สรางแฟม short. cbl DOS> edit short. cbl procedure division. display 5. DOS> cobol short, nul DOS> link short, nul, , nul DOS> short. exe http: //www. thaiall. com/programming Page: 9

สรางแฟม test. cbl DOS> notepad test. cbl working-storage section. 77 x pic 99. procedure

สรางแฟม test. cbl DOS> notepad test. cbl working-storage section. 77 x pic 99. procedure division. move 0 to x. perform cal-para until x >= 5. stop run. cal-para. add 1 to x. display x. http: //www. thaiall. com/programming Page: 10

รบคาจากแปนพมพมา working-storage section. แสดงผล 01 a pic 999 v 99. 01 b pic zz

รบคาจากแปนพมพมา working-storage section. แสดงผล 01 a pic 999 v 99. 01 b pic zz 9. 99. 01 c pic 9999. 01 d pic z, zz 9. procedure division. accept a. move a to b. display "1. result is " b. accept c. move c to d. display "2. result is " d. http: //www. thaiall. com/programming Page: 11

เลอกกระทำแบบ 2 แบบ working-storage section. 01 s pic 99. procedure division. accept s. if

เลอกกระทำแบบ 2 แบบ working-storage section. 01 s pic 99. procedure division. accept s. if s > 50 display "pass. " if s <= 50 display "fail. " stop run. working-storage section. 01 s pic 99. procedure division. accept s. if s > 50 display "pass" else display "fail. " stop run. ----------------------------------------- http: //www. thaiall. com/programming Page: 12

ทำซำเพอพมพเลข working-storage section. 1 ถง 10 77 x pic 99. procedure division. move 0

ทำซำเพอพมพเลข working-storage section. 1 ถง 10 77 x pic 99. procedure division. move 0 to x. perform cal-para until x >= 10. stop run. cal-para. add 1 to x. display x. http: //www. thaiall. com/programming Page: 13

ตวอยางทแสดงการเขยน โปรแกรมทกดวชน 01 02 02 01 01 01 identification division. program-id. arraysample. author. burin

ตวอยางทแสดงการเขยน โปรแกรมทกดวชน 01 02 02 01 01 01 identification division. program-id. arraysample. author. burin rujjanapan. installation. yonok. date-written. 20 -09 -97. date-compiler. 20 -09 -97. environment division. configuration section. source-computer. pc. object-computer. pc. data division. working-storage section. d occurs 10 times. d-name pic x(5. ( d-grade pic x. cnt-a pic 99. i pic 99. j pic 99. procedure division. main-para. display "Stop when d-grade(i) = 'q. "' move 0 to i. perform get-para until d-grade(i) = "q. " move 0 to j. display "" with blank screen. display "Report when grade not equal 'f. "' perform report-para until i = j. stop run. get-para. add 1 to i. display "Number " i. display "Get name : " with no advancing. accept d-name(i. ( display "Get grade: " with no advancing. accept d-grade(i. ( report-para. add 1 to j. if d-grade(j) not = "a" display j, " : " with no advancing display d-name(j), d-grade(j. ( http: //www. thaiall. com/programming Page: 14

Batch File of CBL. BAT DOS>cbl test DOS>type cbl. bat @echo off cls if

Batch File of CBL. BAT DOS>cbl test DOS>type cbl. bat @echo off cls if exist %1. obj del %1. obj >nul if exist %1. exe del %1. exe >nul echo Program is compiled. Please, wait for the compilation. echo cobol %1, %1, nul if not exist %1. obj goto end 1 cls echo Program is linked. Please, wait for the linking. link %1, nul, , nul if not exist %1. exe goto end if exist %1. obj del %1. obj >nul if exist %1. lst del %1. lst >nul cls 1% goto end : end 1 type %1. lst echo Error on your source. : end http: //www. thaiall. com/programming Page: 15