Bonjour, je suis étudiant en informatique. J'ai un cour de cobol ou je comprend en général mais récemment j'ai un problème dans un exercice. On vient de commencer les fichiers indexer..
J'ai quelque problème minime (je crois)
1) Dans mon 1er programme je ne comprend pas pourquoi je peux rentrer 2X la même clef primaire.. :/
2) Dans le second programme Pourquoi est-ce que il se crash et ferme.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 program-id. fichierseq1. environment division. configuration section. input-output section. file-control. select Ftennis assign to "C:\Users\Jordan\Desktop\Tennis.dat" organization is indexed access random record key joueurID alternate record key nom with duplicates. DATA DIVISION. FILE SECTION. fd Ftennis. 01 enrJoueur. 02 joueurID pic x(6). 02 nom pic a(10). 02 nationalite pic a(2). 02 score pic 99. WORKING-STORAGE SECTION. 77 choix pic a. 77 menu pic x. 77 i pic x. PROCEDURE DIVISION. principal. move 9 to menu. display " --> 0. quitter". display " --> 1. Ajouter un joueur". accept menu. if menu = 1 perform ajouter. if menu = 0 perform quitter. ***************_Ajout_De_Joueur_************** ajouter. perform ouvertureOUTPUT. perform saisir. perform ecriture. perform continuerAjout. perform fermeture. ouvertureOUTPUT. open output Ftennis. saisir. display "identifiant (6 caractères)". accept joueurID. display "nom (10 caractères)". accept nom. display "nationalité (2 caractères)". accept nationalite. perform with test after until (score >= 0 and score <= 100) display "score (entre 0 et 100 compris)" accept score end-perform. ecriture. write enrJoueur invalid key display "joueur deja enregistree." not invalid key display "ok." end-write. continuerAjout. display "voulez-vous ajouté un autre joueur? (o/n)" accept choix. if choix = "o" perform saisir else perform quitter end-if. fermeture. close Ftennis. **************_Quitter_Programme_************** quitter. stop run.
Merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 program-id. fichierseq1. environment division. configuration section. input-output section. file-control. select Ftennis assign to "C:\Users\Jordan\Desktop\Tennis.dat" organization is indexed access random record key joueurID alternate record key nom with duplicates. DATA DIVISION. FILE SECTION. fd Ftennis. 01 enrJoueur. 02 joueurID pic x(6). 02 nom pic a(10). 02 nationalite pic a(2). 02 score pic 99. WORKING-STORAGE SECTION. 77 choix pic a. 77 menu pic x. 77 i pic x. PROCEDURE DIVISION. principal. move 9 to menu. display " --> 0. quitter" display " --> 1. Afficher les informations d'un joueur par son ID" accept menu. if menu = 1 perform clefPrimaire. if menu = 0 perform quitter. **************_Clef_Primaire_************** clefPrimaire. perform ouvertureINPUT. perform saisirId. perform lireId. perform fermeture. perform continuerLireId. ouvertureINPUT. open input Ftennis. saisirId. display "Identifiant du joueur (6 caractères)". accept joueurID. lireId. read Ftennis invalid key display "Joueur inexistant" not invalid key perform afficheJoueur end-read. accept i. afficheJoueur. display "****************************". display "* Identifiant: " joueurID " *". display "* nom: " nom " *". display "* nationalitée: " nationalite " *". display "* score: " score " *". display "****************************". fermeture. close Ftennis. continuerLireId. display "voulez-vous rechercher un autre joueur? (o/n)" accept choix. if choix = "o" perform clefPrimaire else perform principal end-if. **************_Quitter_Programme_************** quitter. stop run.
Partager