# COBOL ROMANA

• Published on
16-Nov-2015

• View
56

7

Embed Size (px)

DESCRIPTION

Suport Curs de programare COBOLAutor : Ioan PogangeanuFirma Kepler-Rominfo Bucuresti

Transcript

• Page 1 of 92

Suport Curs de programare COBOL Autor : Ioan Pogangeanu

Firma Kepler-Rominfo Bucuresti Toate drepturile privind multiplicarea , fotocopierea , distribuirea sau publicarea unor parti din acest curs, rezervate firmei Kepler-Rominfo Bucuresti, oricare din actiunile mai sus amintite, fiind permise doar cu acordul scris al firmei.

• Page 2 of 92

Cuprins

1. Introducere n COBOL.................................................................................................. 5

Ce este limbajul Cobol? ...................................................................................................5

Avantaje Cobol versus alte limbaje de manipulare date......................................................6

Caracteristicile generale ale limbajului Cobol ...................................................................7

2. Structura generala a programelor COBOL ........................................................................ 7

Setul de caractere ............................................................................................................7

Operatori relationali .........................................................................................................8

Structuri ierarhice ............................................................................................................9

Formate de scriere cod Cobol.........................................................................................10

Diviziunile unui program Cobol.......................................................................................11

3. Declararea datelor n COBOL ..................................................................................... 14

Categorii principale de date............................................................................................14 Clauza VALUE ............................................................................................................................. 14 Clauza OCCURS.......................................................................................................................... 14 Clauza REDEFINES ..................................................................................................................... 15 clauza RENAMES ........................................................................................................................ 15 Numerele de nivel......................................................................................................................... 15

Tipuri de variabile ..........................................................................................................16 Alfabetice..................................................................................................................................... 16 Alfanumerice ................................................................................................................................ 16 Numerice ..................................................................................................................................... 16

Clauza NEXT pentru constante utilizator .................................................................................... 16 Daca avem o descriere de forma urmatoare:........................................................................................ 16 [USAGE IS DISPLAY] .............................................................................................................. 17 [USAGE IS] COMPUTATIONAL ................................................................................................ 17 [USAGE IS] INDEX .................................................................................................................. 18 [USAGE] IS POINTER ............................................................................................................. 18 [USAGE] IS PROCEDURE POINTER ........................................................................................ 19 Tipuri de date definite de utilizator, clauza TYPEDEF .................................................................. 19

Formate de editare numerice ..........................................................................................20

Literali...........................................................................................................................21

Constante figurative.......................................................................................................22

4. Fisiere secventiale ..................................................................................................... 22

Declararea fisierelor .......................................................................................................22

Fraza SELECT pentru fisiere secventiale .........................................................................22

Forma generala rubrica FD (File Description), cu principalele clauze: ...............................23

Instructiuni utilizare fisiere .............................................................................................24 Instructiunea OPEN ...................................................................................................................... 24 Instructiunea READ secvential ....................................................................................................... 24 Instructiunea WRITE secvential ..................................................................................................... 25

• Page 3 of 92

Instructiunea CLOSE fisier ............................................................................................................ 26

Fisiere secventiale in format fix si variabil .......................................................................26

Exmplu de declarare a uni fisier secvential cu format fix de inregistrare ...........................26

Declarative ....................................................................................................................27

Declarare FILE-STATUS .................................................................................................29

Fisiere de listare ............................................................................................................30

5. Editorul de rapoarte Cobol............................................................................................. 31

Generalitati....................................................................................................................31

Structura generala a unui raport .....................................................................................31

Declararea raportului in sectiunea FILE SECTION ............................................................32

Declararea raportului in sectiunea REPORT.....................................................................32

Descrierea grupelor de editare........................................................................................33

Instructiuni executabile specifice editorului de rapoarte...................................................34

Instructiunea USE pentru report .....................................................................................35

Registrii speciali report : LINE-COUNTER si PAGE-COUNTER ..........................................35

6. Fisiere selective........................................................................................................... 35

Caracteristici generale ...................................................................................................35

Clauza select .................................................................................................................35

Moduri de acces ............................................................................................................36

READ secvential pe fisier selectiv pentru acces dinamic : ................................................36

Instructiunea START ......................................................................................................37

Instructiunea REWRITE ..................................................................................................37

instructiunea WRITE cu INVALID KEY adaugare directa.................................................38

instructiunea DELETE cu INVALID KEY stergere directa ...............................................38

7. Fisiere indexate.......................................................................................................... 38

Caracteristici generale ...................................................................................................38

Fraza select pentru declararea unui fisier indexat ............................................................39

Instructiunea READ secvential pentru acces DYNAMIC....................................................39

Instructiunile READ, WRITE, REWRITE, START si DELETE in acces direct ........................39

SPLYT KEY - setare cheie fisier indexat.....................................................................