Advertisement
yassyass

Untitled

Dec 16th, 2015
2,806
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 2.52 KB | None | 0 0
  1.  program-id. SeqToRel as "SeqToRel".
  2.  
  3.        environment division.
  4.        configuration section.
  5.        input-output section.
  6.        file-control.
  7.            select fisalle assign to "G:\Fichier COBOL\salle.rel"
  8.                            organization is relative
  9.                            access mode is dynamic
  10.                            relative key is relkey
  11.                            file status is fs-salle.
  12.            select salleSeq assign to "G:\Fichier COBOL\salleSeq.seq"
  13.                            organization is line sequential
  14.                            file status is fs-salleSeq.
  15.            select verifsalle assign "G:\Fichier COBOL\verifSalle.seq"
  16.                              organization is line sequential
  17.                              file status is fs-verif.
  18.        data division.
  19.        file section.
  20.        FD fisalle.
  21.        01 r-salle.
  22.            02 tabCategSalle occurs 3.
  23.                03 nbPlacesMax                      pic 999.
  24.        FD salleSeq.
  25.        01 r-seq.
  26.            02 cle                                  pic 99.
  27.            02 reste                                pic 9(9).
  28.        FD verifSalle.
  29.        01 r-verif.
  30.            02 cleVerif                             pic 99.
  31.            02 resteVerif                           pic 9(9).
  32.        working-storage section.
  33.        01 relkey                                   pic 99.
  34.        01 fs-salle                                 pic xx.
  35.            88 finTrt       value "10" thru "99".
  36.        01 fs-salleSeq                              pic xx.
  37.            88 fintrtSeq    value "10".
  38.        01 fs-verif                                 pic xx.
  39.            88 finverif      value "10".
  40.        procedure division.
  41.        main.
  42.       *=====
  43.            open output fisalle
  44.                input salleSeq.
  45.            read salleSeq end-read.
  46.            perform until fintrtseq
  47.                move cle to relkey
  48.                write r-salle from reste
  49.                read salleSeq end-read
  50.            end-perform.
  51.            close fisalle salleSeq.
  52.       *Vérification    
  53.            open output verifSalle
  54.                 input fisalle.
  55.            move cle to relkey.
  56.            start fisalle key is >= relkey
  57.                invalid key display "erreur"
  58.                not invalid key read fisalle NEXT end-read
  59.            end-start.
  60.            perform until finTrt
  61.                write r-verif from r-salle
  62.                read fisalle NEXT end-read
  63.            end-perform.
  64.            stop run.
  65.  
  66.        end program SeqToRel.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement