Bonjour, nous venons d'étudié les fichiers en cours (je suis en DUT informatique) et pour cela nous avons un exercice qui consiste à transféré des données d'un fichier séquentiel "propriétaire1.dat" à 2 fichier direct "proprio.dat" et "appart.dat". Pour la partie des infos des proprio cela n'as pas été trop dur mais je ne vois pas comment faire pour les infos d'un appart car ceux-ci ce trouve dans un tableau[5] appart.
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
90
91
92
93
94
95
96
97
98
99
100
101 program-id. partie1. file-control. select f-proprietaire1 assign to 'proprietaire1.dat'organization sequential. select f-proprio assign to 'proprio.dat' organization indexed access dynamic record key NumPropp. select f-appart assign to 'appart.dat' organization indexed access dynamic record key NumApparta alternate record key NumPropa duplicates. data division. file section. fd f-proprietaire1. 1 Proprietaire1. 2 NomProp pic x(20). 2 PrenomProp pic x(20). 2 VilleProp pic x(20). 2 TelProp pic x(10). 2 Tab. 3 appart occurs 5. 4 nbpiece pic 99. 4 Etage pic 99. 4 NbPersMax pic 99. 4 tarifHT pic 9999. 4 tarifBS pic 9999. 4 vue pic x(20). 4 Ville pic x(20). fd f-proprio. 1 Proprietaire. 2 NumPropp pic 99. 2 NomPropp pic x(20). 2 PrenomPropp pic x(20). 2 VillePropp pic x(20). 2 TelPropp pic x(10). fd f-appart. 1 Appartement. 2 NumApparta pic 99. 2 NumPropa pic 99. 2 Nbpiecea pic 99. 2 Etagea pic 99. 2 NbPersMaxa pic 99. 2 tarifHTa pic 9999. 2 tarifBSa pic 9999. 2 vuea pic x(20). 2 Villea pic x(20). working-storage section. 1 v-fin-f-proprietaire1 pic x value 'N'. 88 fin-f-proprietaire1 value 'O' false 'N'. 1 i pic 9 value 1. 1 nump pic 99 value 1. 1 numa pic 99 value 1. procedure division. open output f-appart open output f-proprio open input f-proprietaire1 read f-proprietaire1 end set fin-f-proprietaire1 to true end-read perform until fin-f-proprietaire1 perform mod-proprio perform test after varying i from 1 by 1 until i=5 perform mod-appart end-perform read f-proprietaire1 end set fin-f-proprietaire1 to true end-read compute nump = nump + 1 end-perform close f-proprietaire1. close f-proprio. close f-appart. goback. mod-proprio. move nump to NumPropp move NomProp to NomPropp move PrenomProp to PrenomPropp move VilleProp to VillePropp move TelProp to TelPropp write proprietaire end-write. mod-appart. move Numa to NumApparta move nump to NumPropa ******* * *Zone de transfert d'un appart **** write appartement end-write compute numa = numa + 1. end program partie1.
Partager