Understanding COBOL Programming: Overview of Divisions and Environment

Slide Note
Embed
Share

COBOL, a classic programming language, is explored in this content through its identification division, environment division, data division, and procedure division. The key components include program identification, file controls, and data storage structures. The focus is on enhancing understanding of COBOL syntax and structure.


Uploaded on Aug 14, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. COBOL

  2. DIVISION) identification division. environment division. data division. procedure division.

  3. DIVISION) identification division.

  4. identification division. program-id. rei0201. * environment division. input-output section. file-control. select ken-file assign "h:\rei0201.dat" organization line sequential. select itiran-file assign "h:\rei0201.txt". * data division. file section. fd ken-file. 01 ken-rec. 05 kencode picture 9(02). 05 kenmei picture X(08). 05 menseki picture 9(05). 05 jinko picture 9(05). fd itiran-file. 01 itiran-rec picture X(132). working-storage section. 01 e-flg picture X(03). 01 meisai-gyo. 05 filler picture X(09) value space.

  5. identification division. program-id. rei0201. * environment division. input-output section. file-control. select ken-file assign "h:\rei0201.dat" organization line sequential. select itiran-file assign "h:\rei0201.txt". * data division. file section. fd ken-file. 01 ken-rec. 05 kencode picture 9(02). 05 kenmei picture X(08). 05 menseki picture 9(05). 05 jinko picture 9(05). fd itiran-file. 01 itiran-rec picture X(132). working-storage section. 01 e-flg picture X(03). 01 meisai-gyo. 05 filler picture X(09) value space. rei0201 program-id 1

  6. DIVISION) environment division.

  7. identification division. program-id. rei0201. * environment division. input-output section. file-control. select ken-file assign "h:\rei0201.dat" organization line sequential. select itiran-file assign "h:\rei0201.txt". * data division. file section. fd ken-file. 01 ken-rec. 05 kencode picture 9(02). 05 kenmei picture X(08). 05 menseki picture 9(05). 05 jinko picture 9(05). fd itiran-file. 01 itiran-rec picture X(132). working-storage section. 01 e-flg picture X(03). 01 meisai-gyo. 05 filler picture X(09) value space.

  8. ken-file h:\ rei0201.dat itiran-file h:\ rei0201.txt

  9. identification division. program-id. rei0201. * environment division. input-output section. file-control. select ken-file assign "h:\rei0201.dat" organization line sequential. select itiran-file assign "h:\rei0201.txt". * data division. file section. fd ken-file. 01 ken-rec. 05 kencode picture 9(02). 05 kenmei picture X(08). 05 menseki picture 9(05). 05 jinko picture 9(05). fd itiran-file. 01 itiran-rec picture X(132). working-storage section. 01 e-flg picture X(03). 01 meisai-gyo. 05 filler picture X(09) value space. 0201 0201.txt

  10. DIVISION) data division.

  11. organization line sequential. select itiran-file assign "h:\rei0201.txt". * data division. file section. fd ken-file. 01 ken-rec. 05 kencode picture 9(02). 05 kenmei picture X(08). 05 menseki picture 9(05). 05 jinko picture 9(05). fd itiran-file. 01 itiran-rec picture X(132). working-storage section. 01 e-flg picture X(03). 01 meisai-gyo. 05 filler picture X(09) value space. 05 m-kencode picture 9(02). 05 filler picture X(05) value space. 05 m-kenmei picture X(08). 05 filler picture X(05) value space. 05 m-menseki picture 9(05). 05 filler picture X(05) value space. 05 m-jinko picture 9(05). * procedure division.

  12. organization line sequential. select itiran-file assign "h:\rei0201.txt". * data division. file section. fd ken-file. 01 ken-rec. 05 kencode picture 9(02). 05 kenmei picture X(08). 05 menseki picture 9(05). 05 jinko picture 9(05). fd itiran-file. 01 itiran-rec picture X(132). working-storage section. 01 e-flg picture X(03). 01 meisai-gyo. 05 filler picture X(09) value space. 05 m-kencode picture 9(02). 05 filler picture X(05) value space. 05 m-kenmei picture X(08). 05 filler picture X(05) value space. 05 m-menseki picture 9(05). 05 filler picture X(05) value space. 05 m-jinko picture 9(05). * procedure division.

  13. ken-file ken-rec. : : kencode : : kenmei : : menseki : : jinko : : itiran-file : : itiran-rec :e :e- -flg : :meisai meisai- -gyo : : m-kencode : : m-kenmei : : m m menseki : : m-jinko flg gyo 3 3 menseki

  14. DIVISION) procedure division.

  15. 05 filler picture X(05) value space. 05 m-jinko picture 9(05). * procedure division. syori. open input ken-file output itiran-file move "off" to e-flg perform until e-flg = "on" read ken-file at end move "on" to e-flg not at end move kencode to m-kencode move kenmei to m-kenmei move menseki to m-menseki move jinko to m-jinko move meisai-gyo to itiran-rec write itiran-rec after 1 end-read end-perform close ken-file itiran-file stop run.

Related