Editer fichier texte Cobol
Bonjour, voila je dois réaliser un tp enCobol qui consiste à gérer une agence de locations. Après avoir éffectué les différents module de supression de modif et d'ajout.
Je possède un fichier location avec le montant et un champ réglé 0/1.
Je dois réaliser un fichier texte qui parcourt le fichier Location (jusque là pas de pb) donc le montant n'as pas été réglé par le client.
Voici se que je dois obtenir pour chaque location non réglé.
Agence TempsLibre
9 Avenue du Général de Gaulle
Nancy
Facture
Nom client Prenom client
Adresse client
Nous vous remercions d’avoir effectué une réservation auprès de notre agence pour l’appartement situé au : … adresse… pour X personnes du datedebut pour une durée de x semaines.
Montant à régler : montant
Fait à Nancy le [date du jour].
Code:
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. facturation.
file-control.
* fichier location
select f-location assign 'location.dat'
organization indexed access dynamic
record key cle = NumClil,NumAppl
alternate key NumClil duplicates
alternate key NumAppl duplicates.
* fichier client
select f-client assign 'client.dat'
organization indexed access dynamic
record key NumCli.
* fichier appart
select f-appart assign to 'appart.dat' organization indexed
access dynamic record key NumApparta
alternate record key NumPropa duplicates.
select f-facturation assign 'facturation.dat'
organization line sequential.
fd f-location.
1 Location.
2 NumClil pic 999.
2 NumAppl pic 999.
2 DateDebl pic 9(8).
2 Dureel pic 9.
2 NbPersl pic 9.
2 Montantl pic 9(5).
2 reglel pic 9.
fd f-client.
1 Client.
2 NumCli pic 999.
2 NomCli pic x(20).
2 PrenomCli pic x(20).
2 AdresseCli pic x(50).
2 VilleCli pic x(20).
2 TelCli pic 9(10).
fd f-appart.
1 Appartement.
2 NumApparta pic 999.
2 NumPropa pic 99.
2 Nbpiecea pic 99.
2 Etagea pic 99.
2 NbPersMaxa pic 99.
2 tarifHTa pic 9(4).
2 tarifBSa pic 9(4).
2 vuea pic x(20).
2 Villea pic x(20).
fd f-facturation.
1 Facturation.
2 nomc pic x(20).
2 prenomc pic x(20).
working-storage section.
1 finloca pic 9 value 0.
procedure division.
open input f-location
open input f-client
open input f-appart
open output f-facturation
read f-location next
end set finloca to 1 end-read
perform until finloca = 1
if reglel = 0 then
move NumClil to NumCli
read f-client
move NomCli to nomc
move PrenomCli to prenomc
write Facturation
end-if
read f-location next
end set finloca to 1 end-read
end-perform
close f-location
close f-client
close f-appart
close f-facturation
goback.
end program facturation. |
Ma question n'est pas comment récupérer les données mais la mise en forme du fichier.
merci d'avance de votre aide