File size: 5,270 Bytes
8198c28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Exemples COBOL</title>
    <link rel="stylesheet" href="style.css">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
</head>
<body class="bg-gray-50 font-sans">
    <custom-navbar></custom-navbar>

    <main class="container mx-auto px-4 py-8 max-w-4xl">
        <header class="text-center mb-12">
            <h1 class="text-4xl font-bold text-primary-500 mb-4">📚 Exemples COBOL</h1>
            <p class="text-xl text-gray-600">Apprenez par la pratique avec ces exemples commentés</p>
        </header>

        <section class="bg-white rounded-xl shadow-lg p-6 mb-8 animate-fade-in">
            <h2 class="text-2xl font-semibold text-secondary-500 mb-4">💡 Exemple 1 : Hello World</h2>
            <div class="bg-gray-800 rounded-lg p-4 overflow-x-auto">
                <pre class="text-green-400 font-mono text-sm"><code>       IDENTIFICATION DIVISION.
       PROGRAM-ID. HELLO.

       PROCEDURE DIVISION.
           DISPLAY "Hello World".
           STOP RUN.</code></pre>
            </div>
            <div class="mt-4 space-y-2">
                <div class="flex items-start">
                    <div class="bg-blue-100 text-blue-800 px-2 py-1 rounded-full text-xs mr-2">1</div>
                    <p class="text-sm">Programme minimal avec une seule instruction <code>DISPLAY</code></p>
                </div>
            </div>
        </section>

        <section class="bg-white rounded-xl shadow-lg p-6 mb-8 animate-fade-in">
            <h2 class="text-2xl font-semibold text-secondary-500 mb-4">💡 Exemple 2 : Calcul simple</h2>
            <div class="bg-gray-800 rounded-lg p-4 overflow-x-auto">
                <pre class="text-green-400 font-mono text-sm"><code>       IDENTIFICATION DIVISION.
       PROGRAM-ID. CALCUL.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  NOMBRE1    PIC 9(3) VALUE 100.
       01  NOMBRE2    PIC 9(3) VALUE 50.
       01  RESULTAT   PIC 9(4).

       PROCEDURE DIVISION.
           ADD NOMBRE1 TO NOMBRE2 GIVING RESULTAT.
           DISPLAY "Résultat: " RESULTAT.
           STOP RUN.</code></pre>
            </div>
            <div class="mt-4 space-y-2">
                <div class="flex items-start">
                    <div class="bg-blue-100 text-blue-800 px-2 py-1 rounded-full text-xs mr-2">1</div>
                    <p class="text-sm">Déclaration des variables dans la <code>DATA DIVISION</code></p>
                </div>
                <div class="flex items-start">
                    <div class="bg-blue-100 text-blue-800 px-2 py-1 rounded-full text-xs mr-2">2</div>
                    <p class="text-sm">Instruction <code>ADD</code> pour effectuer un calcul</p>
                </div>
            </div>
        </section>

        <section class="bg-white rounded-xl shadow-lg p-6 mb-8 animate-fade-in">
            <h2 class="text-2xl font-semibold text-secondary-500 mb-4">💡 Exemple 3 : Condition IF</h2>
            <div class="bg-gray-800 rounded-lg p-4 overflow-x-auto">
                <pre class="text-green-400 font-mono text-sm"><code>       IDENTIFICATION DIVISION.
       PROGRAM-ID. CONDITION.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  AGE        PIC 9(3) VALUE 18.

       PROCEDURE DIVISION.
           IF AGE >= 18
               DISPLAY "Majeur"
           ELSE
               DISPLAY "Mineur"
           END-IF.
           STOP RUN.</code></pre>
            </div>
            <div class="mt-4 space-y-2">
                <div class="flex items-start">
                    <div class="bg-blue-100 text-blue-800 px-2 py-1 rounded-full text-xs mr-2">1</div>
                    <p class="text-sm">Structure conditionnelle avec <code>IF-ELSE-END-IF</code></p>
                </div>
            </div>
        </section>

        <section class="bg-white rounded-xl shadow-lg p-6 animate-fade-in">
            <h2 class="text-2xl font-semibold text-secondary-500 mb-4">💡 Exemple 4 : Boucle PERFORM</h2>
            <div class="bg-gray-800 rounded-lg p-4 overflow-x-auto">
                <pre class="text-green-400 font-mono text-sm"><code>       IDENTIFICATION DIVISION.
       PROGRAM-ID. BOUCLE.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  COMPTEUR   PIC 9(2) VALUE 1.

       PROCEDURE DIVISION.
           PERFORM VARYING COMPTEUR FROM 1 BY 1
               UNTIL COMPTEUR > 10
               DISPLAY "Compteur: " COMPTEUR
           END-PERFORM.
           STOP RUN.</code></pre>
            </div>
            <div class="mt-4 space-y-2">
                <div class="flex items-start">
                    <div class="bg-blue-100 text-blue-800 px-2 py-1 rounded-full text-xs mr-2">1</div>
                    <p class="text-sm">Boucle avec <code>PERFORM VARYING</code></p>
                </div>
            </div>
        </section>
    </main>

    <custom-footer></custom-footer>

    <script src="components/navbar.js"></script>
    <script src="components/footer.js"></script>
    <script src="script.js"></script>
    <script>feather.replace();</script>
</body>
</html>