Cobol ANS 74/Tables
Apparence
Acces par Indice, Index, Search
- OCCURS (1 par dimension)
- ne va pas en 01 66 77 88
Une dimension
[modifier | modifier le wikicode]01 TAB. 02 ELEM PIC 99; OCCURS 10. 88 NUL VALUE 0. *INITIALISATION. 01 TAB; VALUE "0102030405". 02 ELEM PIC 99; OCCURS 5.
- ->TAB (5*2bit)
Multitables
[modifier | modifier le wikicode]01 TAB. 02 FILLER PIC X(9) VALUE "JANVIER". 02 FILLER PIC X(9) VALUE "FEVRIER". 02 FILLER PIC X(9) VALUE "MARS". 02 FILLER PIC X(9) VALUE "AVRIL". 02 FILLER PIC X(9) VALUE "MAI". 02 FILLER PIC X(9) VALUE "JUIN". 02 FILLER PIC X(9) VALUE "JUILLET". 02 FILLER PIC X(9) VALUE "AOUT". 02 FILLER PIC X(9) VALUE "SEPTEMBRE". 02 FILLER PIC X(9) VALUE "OCTOBRE". 02 FILLER PIC X(9) VALUE "NOVEMBRE". 02 FILLER PIC X(9) VALUE "DECEMBRE". 01 TAB-MOIS REDEFINES TAB. 02 MOIS PIC X(9) OCCURS 12.
- ->TAB et TAB-MOIS (9*12bit)
Multidimension
[modifier | modifier le wikicode]01 ECOLE. 02 NOM-ECOLE PIC X(20). 02 CLASSE OCCURS 15. 03 NOM-CLASSE PIC X(10). 03 ELEVES OCCURS 20. 04 NOM-ELEVE PIC X(20). 04 ADR-ELEVE PIC X(30). 03 PROF OCCURS 10. 04 NOM-PROF PIC X(20). 04 COURS OCCURS 5. 05 INTITULE PIC X(15). 05 HEURES PIC 99.
- -> INTITULE(15, 10, 5) // INTITULE du 5e cours de 10e prof de 15e classe
- -> COURS(15, 10, 5) // INTITULE+HEURES du 5e cours de 10e prof de 15e classe
- -> NOM-PROF(15, 10) // NOM-PROF du 10e prof de 15e classe
- -> PROF(15, 10) // 10e PROF de 15e classe
- -> ADR-ELEVE(15, 11) // ADR-ELEVE de 11e eleves de 15e classe
- -> NOM-CLASSE(3) // NOM-CLASSE de 3e classe
Recherche dans un tableau
[modifier | modifier le wikicode]indices
[modifier | modifier le wikicode]PERFORM RCH VARYING I FROM 1 BY 1 UNTIL I > 15 AFTER J FROM 1 BY 1 UNTIL J > 20 OR ADR-ELEVE(I, J) = "DANIEL".
? Calculer la ponctuation d'un fichier sequentiel entrant des lignes de 80 caracteres à disposer dans une table ?
AP (CHK) -c1-> [F] (ANAL) [D] -c2--> [X] (X) (INC-OCC) [X] (RCH) [D] -c3-> c1: EOF=1 // c2: I:1->80 // c3: J=6 OR CARAC(I)=PONCT(J) les feuilles X ne sont pas instruites
*8 | | | | | | | | | | | | | | | | SELECT FTEXTE ASSIGN TO DISK. FILE SECTION. FD FTEXTE... 01 LIGNE. 02 CARAC PIC X; OCCURS 80. WORKING STORAGE SECTION. 01 VECT-PONCT; VALUE ".,:;!?". 02 OCC PIC 99; OCCURS 6. 01 VECT-OCC. 02 OCC PIC 99; COMP-0; OCCURS 6. 77 I PIC 99; COMP-0. 77 J PIC 99; COMP-0. 77 EOF PIC 9. 77 OCC-ED PIC Z9. PROCEDURE DIVISION. *structure incomplete *-------------------- ... CHK. PERFORM ANAL VARYING I FROM 1 BY 1 UNTIL I = 80. ANAL. PERFORM D-ANAL. PERFORM RCH VARYING J FROM 1 BY 1 UNTIL J = 6 OR CARAC(I) = PONCT(J). ... ... *traitements *--------------------- INIT-OCC. MOVE 0 TO OCC(J). I1-PROG. OPEN INPUT FTEXTE. MOVE 0 TO EOF. READ FTEXTE; AT END MOVE 1 TO EOF. D-ANAL. MOVE 1 TO J. RCH. ADD 1 TO J. INC-OCC. ADD 1 TO OCC(J). F-TRAITE. READ FTEXTE; AT END MOVE 1 TO EOF. I-PROG. CLOSE FTEXTE. AFF-RES. MOVE OCC(J) TO OCC-ED. DISPLAY "il y a ", OCC-ED, PONCT(J).
index
[modifier | modifier le wikicode]- accelere la recherche sur champs:
01 TAB. 02 A OCCURS 5; INDEXED BY I1. 03 B OCCURS 7; INDEXED BY I2, I3. 04 C PIC 9; OCCURS 4 INDEXED BY I4
- -> Chaque tab reçois un index !
- Dans l'exemple suivant si C(4, 2, 3)=7 est le premier 7 trouvé, on aura un arret à ((3*7*4)+(1*2*3)) soit la 90e boucle de I4.
PERFORM RCH VARYING I1 FROM 1 BY 1 UNTIL I1 > 5 AFTER I2 FROM 1 BY 1 UNTIL I2 > 7 AFTER I4 FROM 1 BY 1 UNTIL I4 > 9 OR C=(I1, I2, I4) = 7.
- index permet le calcul et les const-> C(I1+3, I2-7, (4+3))
- l'adressage n'accepte pas la présence d'indice et index en même temps//
C(Index,1,indice) - SET index TO {index/ch-index/entier} //initialiser
- SET index1, index2 {UP/DOWN} by entier //incrementer
- champ index : sert à sauver valeur d'un index
77 CH-INDEX USAGE INDEX.
? Meme exercice par INDEX ?
- même AP
*8 | | | | | | | | | | | | | | | | FILE SECTION. FD FTEXTE... 01 LIGNE. 02 CARAC PIC X; OCCURS 80; INDEXED BY IND1. WORKING STORAGE SECTION. 01 VECT-PONCT; VALUE ".,:;!?". 02 OCC PIC 99; OCCURS 6; INDEXED BY IND2. 01 VECT-OCC. 02 OCC PIC 99; COMP-0; OCCURS 6; INDEXED BY IND3. 77 I PIC 99; COMP-0. 77 J PIC 99; COMP-0. 77 EOF PIC 9. 77 OCC-ED PIC Z9. PROCEDURE DIVISION *meme structure ... *traitements *--------------------- INIT-OCC. MOVE 0 TO OCC(IND3). I1-PROG. OPEN INPUT FTEXTE. MOVE 0 TO EOF. READ FTEXTE; AT END MOVE 1 TO EOF. D-ANAL. SET IND2 TO 1. RCH. SET IND2 UP BY 1. INC-OCC. SET IND3 TO IND2. ADD 1 TO OCC(IND3). F-TRAITE. READ FTEXTE; AT END MOVE 1 TO EOF. I-PROG. CLOSE FTEXTE. AFF-RES. SET IND3 TO IND2. MOVE OCC(IND3) TO OCC-ED. DISPLAY "il y a ", OCC-ED, PONCT(IND2).
search
[modifier | modifier le wikicode]- SEARCH nom [VARYING{index/ch-index/ch-entier}]
- [AT END ins]
- [WHEN cond1 {ins/NEXT SENTENCE}]
- [WHEN cond1 {ins/NEXT SENTENCE}]
- ...
- OCCURS entier TIMES
- {{ASCENDING/DESCENDING} KEY IS nom1 (nom2)...}...
- INDEXED nom1 [,nom2...
search all
[modifier | modifier le wikicode]- Sur champs triés
- SEARCH ALL nom1
- [AT END ins]
- WHEN {nom-cond/nom2{EQUAL}{expr/const/ident}
- [AND{nom-cond/nom2{EQUAL}{expr/const/ident}]
- {ins/NEXT SENTENCE}
inspect
[modifier | modifier le wikicode]- INSPECT ident1 TALLYING
- {ident2 FOR {{{ALL/LEADING}CHARACHTER}{ident3/literal1}}
- [{before/after} INITIAL {ident4/literal2}]}...}...
string
[modifier | modifier le wikicode]- STRING {{ident1/cont1}[ident2/const2]...
- DELIMITED BY {ident1/const1/SIZE}}...
- INTO ident4 [WITH POINTER ident5]
- [ON OVERFLOW ins]
unstring
[modifier | modifier le wikicode]- UNSTRING identificateur-1
- [DELIMITED BY [ALL] {ident1/constante1},[OR[ALL] {ident1/const1}]]
- INTO {ident4([DELIMITER ident5]/[COUNT ident6])}
- [WHITH POINTER ident7]
- [TALLYING ident8]
- [ON OVERFLOW ins]
Exercices de synthese
[modifier | modifier le wikicode]? Faire la gestion d'une bibliotheque ?
- Partant des deux fichiers FLIVRE et FTHEME, faire
- A/ MenuPrincipal
- 1/ Ajout new livre (ouvre SousMenu2).
- 2/ Ajout nouvel exemplaire
- 3/ Modifier un livre
- 4/ Recherche de livre par (1/ titre, 2/ autheur, 3/ code, (? 4/ theme))
- B/ SousMenu2
- >Sort tous les enreg de FTHEME + num (a introduire en A1)
| | | | | | | | | | | | | | | | | ENVIRONMENT DIVISION. ... INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT FLIVRE ASSIGN TO DISK ;ORGANIZATION INDEXED ;ACCESS MODE DYNAMIC ;RECORD KEY IS COD-LIV ;ALTERNATE ... ;STATUS IS SLIV. SELECT FTHEME ASSIGN TO DISK ;ORGANIZATION RELATIVE ;ACCESS MODE ... ;RELATIVE KEY IS ... ;STATUS IS STHEME. DATA DIVISION. FILE SECTION. FD FLIVRE LABEL RECORD STANDARD VALUE OF FILE-ID IS "FLIVRE.DAT". 01 ENR-LIV. 02 CODE PIC X(5). 02 TITRE PIC X(30). 02 AUTHEUR PIC X(15). 02 THEME PIC 99. 02 QTY-LIV PIC 99. 02 QT-RESTE PIC 99; COMP-0. FD FTHEME LABEL RECORD STANDARD VALUE OF FILE-ID IS "FTHEME.DAT". 01 ENR-THE. 02 DESC PIC X(20). 02 RAYON PIC X(8). 02 QT-MAX PIC 99. WORKING STORAGE SECTION. ...
:: GESTION DE BIBLIOTHEQUE // PARTIE 1 :: à optimiser
| | | | | | | | | | | | | | | | | * GESTION DE BIBLIOTHEQUE // PARTIE 1 *----------------------------------------------- * Microsoft COBOL Compiler * Version 2.20 (C)Copyright Microsoft Corp. 1982-87 *----------------------------------------------- IDENTIFICATION DIVISION. *------------------------ PROGRAM-ID. BIBLIO. AUTHOR. NICK. ENVIRONMENT DIVISION. *--------------------- CONFIGURATION SECTION. SOURCE-COMPUTER. CPU1. OBJECT-COMPUTER. CPU1. SPECIAL-NAMES. * DECIMAL-POINTS IS COMA. CURRENCY SIGN IS 'E'. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT FLIVRE ASSIGN TO DISK ORGANIZATION INDEXED; ACCESS MODE DYNAMIC; RECORD KEY IS COD OF ENR-LIV; ALTERNATE RECORD TITRE OF ENR-LIV; ALTERNATE RECORD AUTHEUR OF ENR-LIV DUPLICATES; ALTERNATE RECORD THEME OF ENR-TMP DUPLICATES; STATUS SLIV. SELECT FTHEME ASSIGN TO DISK ORGANIZATION RELATIVE; ACCESS MODE DYNAMIC; RELATIVE CLE-THE; STATUS STHE. DATA DIVISION. *-------------- FILE SECTION. FD FLIVRE LABEL RECORD STANDARD; VALUE OF FILE-ID IS "FLIVRE.DAT". 01 ENR-LIV. 02 COD PIC X(5). 02 TITRE PIC X(30). 02 AUTHEUR PIC X(15). 02 THEME PIC 99. 02 QTY-LIV PIC 99. 02 QT-RESTE PIC 99; COMP-0. 01 ENR-TMP REDEFINES ENR-LIV. 02 COD PIC X(5). 02 TITRE PIC X(30). 02 AUTHEUR PIC X(15). 02 THEME PIC XX. 02 QTY-LIV PIC XX. 02 QT-RESTE PIC 99. FD FTHEME LABEL RECORD STANDARD; VALUE OF FILE-ID IS "FTHEME.DAT". 01 ENR-THE. 02 DESC PIC X(20). 02 RAYON PIC X(8). 02 QT-MAX PIC 99. WORKING-STORAGE SECTION. 77 TXT PIC X(30). 77 TMPX PIC X(5). 77 SLIV PIC XX. 77 STHE PIC XX. 77 EOF PIC 9. 77 CPT PIC 999. 77 C PIC 99. 77 CLE-THE PIC 999. 77 FLG PIC 9. 88 OK VALUE 1. 88 KO VALUE 0. 77 DSC-TMP PIC X(20). PROCEDURE DIVISION. *------------------- *MAIN STRUCTURE--------------------------------- INIT. MOVE 0 TO C. DISPLAY "GESTION DE BIBLIOTHEQUE". DISPLAY "-----------------------". PERFORM PROG UNTIL C = 4. STOP RUN. PROG. PERFORM DEBUT-PROG. PERFORM CHK UNTIL SLIV = "00" AND STHE = "00". PERFORM I1-PROG. PERFORM CHK2 UNTIL C > 0 AND C NOT > 4. PERFORM I2-PROG. IF C = 1 PERFORM GES ELSE IF C = 2 PERFORM CLN ELSE IF C = 3 PERFORM PRE ELSE PERFORM ERR. PERFORM FIN-PROG. *TRAITEMENTS------------------------------------ DEBUT-PROG. OPEN INPUT FLIVRE. OPEN INPUT FTHEME. CLOSE FLIVRE. CLOSE FTHEME. CHK. OPEN OUTPUT FLIVRE. OPEN OUTPUT FTHEME. CLOSE FLIVRE, FTHEME. I1-PROG. PERFORM MENU1. ACCEPT C. CHK2. ACCEPT C. I2-PROG. EXIT. FIN-PROG. EXIT. *GESTION DES LIVRES----------------------------- GES. PERFORM D-GES. PERFORM GES1 UNTIL C = 5. D-GES. MOVE 0 TO C, FLG. GES1. PERFORM D-GES1. IF C = 1 PERFORM ANL ELSE IF C = 2 PERFORM ANE ELSE IF C = 3 PERFORM MOD ELSE IF C = 4 PERFORM RCH. */---------- D-GES1. PERFORM MENU2. ACCEPT C. MOVE 0 TO FLG. */ajout nouveau livre--------------------------- * * (ANL) * -OK-> * * [X] (ANL1) [D-] * -OK--> *.anl1 * [F-] (CHK5) [I4-] (CHK4) [I3-] (CHK3) [I2-] (CHK1) [I1-] (THE) [D-] * -c4--> -c3--> -c2--> -c1--> -OK-> * *c1 : C POSITIVE AND C NOT > CPT / c2 : SLIV ="23" / c3 : SLIV="23" / c4 : C POSITIVE *----------------------------------------------- ANL. PERFORM D-ANL. PERFORM ANL1 UNTIL OK. D-ANL. MOVE 0 TO FLG. ANL1. PERFORM D-ANL1. PERFORM THE UNTIL OK. PERFORM I1-ANL1. PERFORM CHK1 UNTIL C POSITIVE AND C NOT > CPT. PERFORM I2-ANL1. PERFORM CHK3 UNTIL SLIV = "23". PERFORM I3-ANL1. PERFORM CHK4 UNTIL SLIV = "23". PERFORM I4-ANL1. PERFORM CHK5 UNTIL C POSITIVE. PERFORM F-ANL1. *//---------- D-ANL1. MOVE 0 TO FLG. I1-ANL1. DISPLAY "THEME ?". ACCEPT C. CHK1. IF C = 0 PERFORM NTH ELSE PERFORM THE. PERFORM F-CHK1. F-CHK1. PERFORM THE. DISPLAY "CHOIX THEME : ". ACCEPT C. I2-ANL1. MOVE C TO THEME OF ENR-TMP. OPEN I-O FLIVRE. DISPLAY "CODE ?". ACCEPT COD OF ENR-LIV. READ FLIVRE. CHK3. ACCEPT COD OF ENR-LIV. READ FLIVRE. I3-ANL1. MOVE COD OF ENR-LIV TO COD OF ENR-TMP. DISPLAY "TITRE ?". ACCEPT TITRE OF ENR-TMP. MOVE TITRE OF ENR-TMP TO TITRE OF ENR-LIV. READ FLIVRE KEY IS TITRE OF ENR-LIV. CHK4. DISPLAY "!", COD OF ENR-LIV, " - ", TITRE OF ENR-LIV, "!". DISPLAY "NOUVEAU TITRE ?". ACCEPT TITRE OF ENR-TMP. MOVE TITRE OF ENR-TMP TO TITRE OF ENR-LIV. READ FLIVRE KEY IS TITRE OF ENR-LIV. I4-ANL1. DISPLAY "AUTHEUR ?". ACCEPT AUTHEUR OF ENR-TMP. DISPLAY "QUANTITE ?". ACCEPT C. CHK5. ACCEPT C. F-ANL1. MOVE C TO QTY-LIV OF ENR-TMP, QT-RESTE OF ENR-TMP. MOVE CORR ENR-TMP TO ENR-LIV. WRITE ENR-LIV. CLOSE FLIVRE. MOVE 1 TO FLG. *----------------------------------------------- */ajout nouvel exemplaire----------------------- * * (ANE) * * [X] (ANE1) [X] * -OK--> * *.ane1 -c3-- -c2-- -c1-- * [X] (X) (AN1) [X] (RCH2)(RCH1) [D-] * *.an1 * [F-] (CH9) [D-] * -c4-> * *c1 : C=1 / c2 : C=2 / c3 : C>0 AND C<3 / c4 : C POSITIVE */----------- ANE. PERFORM ANE1 UNTIL OK. ANE1. PERFORM D-ANE1. IF C = 1 PERFORM RCH1 ELSE IF C = 2 PERFORM RCH2 ELSE DISPLAY "SEUL CHOIX : 1 OU 2". IF C POSITIVE AND C < 3 PERFORM AN1. AN1. PERFORM D-AN1. PERFORM CH9 UNTIL C POSITIVE. PERFORM F-AN1. *//---------- D-ANE1. OPEN I-O FLIVRE. PERFORM MENU3. ACCEPT C. D-AN1. DISPLAY "NOMBRE D'EXEMPLAIRE(S) A AJOUTER ?". ACCEPT C. CH9. ACCEPT C. F-AN1. ADD C TO QTY-LIV OF ENR-LIV, QT-RESTE OF ENR-LIV. REWRITE ENR-LIV. CLOSE FLIVRE. MOVE 1 TO FLG. *----------------------------------------------- */modification des livre----------------------- * * (MOD) * -OK-> * * .mod -c5- -c4- -c3- -c2- -c1- * [F-] (M3) (M2) (M1) [X] (CHA) [I-] (RCH2) (RCH1) [D-] * -c3-> * * .m1 .m3 * [F-] (M11) [D-] [F-] (M31) [D-] * -c6-> -c7-> * *c1 : C=1 / c2 : C=2 / c3 : C POSITIVE AND C NOT > 3 *c3 : C=1 / c4 : C=2 / c5 : C=3 / c6 : SLIV = "23" *c7 : C POSITIVE AND C NOT > CPT *----------------------------------------------- MOD. PERFORM D-MOD. IF C=1 PERFORM RCH1 ELSE IF C=2 PERFORM RCH2. PERFORM I-MOD. PERFORM CHA UNTIL C POSITIVE AND C NOT > 3. IF C=1 PERFORM M1 ELSE IF C=2 PERFORM M2 ELSE IF C=3 PERFORM M3. PERFORM F-MOD. M1. PERFORM D-M1. PERFORM M11 UNTIL SLIV = "23". PERFORM F-M1. M3. PERFORM D-M3. PERFORM M31 UNTIL C POSITIVE AND C NOT > CPT. PERFORM F-M3. *//---------- D-MOD. PERFORM MENU3. DISPLAY "CHOIX 1/2 ?". ACCEPT C. OPEN I-O FLIVRE. I-MOD. DISPLAY "MODIF 1/ TITRE 2/ AUTHEUR 3/ THEME ?". ACCEPT C. CHA. ACCEPT C. D-M1. DISPLAY "NEW TITRE ?". ACCEPT TXT. MOVE TXT TO TITRE OF ENR-LIV. READ FLIVRE KEY IS TITRE OF ENR-LIV. M11. DISPLAY "TITRE EXISTANT: ", TITRE OF ENR-LIV. ACCEPT TXT. MOVE TXT TO TITRE OF ENR-LIV. READ FLIVRE KEY IS TITRE OF ENR-LIV. F-M1. MOVE TMPX TO COD OF ENR-LIV. READ FLIVRE. D-M3. PERFORM THE. DISPLAY "THEME ?". ACCEPT C. M31. ACCEPT C. F-M3. MOVE C TO THEME OF ENR-TMP. M2. DISPLAY "NEW AUTHEUR ?". ACCEPT AUTHEUR OF ENR-TMP. F-MOD. MOVE TXT TO TITRE OF ENR-TMP. DISPLAY "MODIF : ", ENR-TMP. MOVE ENR-TMP TO ENR-LIV. REWRITE ENR-LIV. CLOSE FLIVRE. STOP "PAUSE". *----------------------------------------------- */recherche de livre *-------------------------------------------- * (RCH) * -c1-> *[X] (RCH4) (RCH3) (RCH2) (RCH1) (RCH0) [D-] *c1: ok *-------------------------------------------- RCH. PERFORM D-RCH. IF C = 0 PERFORM RCH0 ELSE IF C = 1 PERFORM RCH1 ELSE IF C = 2 PERFORM RCH2 ELSE IF C = 3 PERFORM RCH3 ELSE IF C = 4 PERFORM RCH4. PERFORM F-RCH. D-RCH. PERFORM MENU3. ACCEPT C. OPEN INPUT FLIVRE. *//listing--------------------------- * (RCH0) * [X] (CH0) [D-] * -c2-> *C2: SLIV = "10" *---------------------------------- RCH0. PERFORM D-RCH0. PERFORM CH0 UNTIL SLIV = "10". *------------------- D-RCH0. MOVE LOW-VALUE TO COD OF ENR-LIV. START FLIVRE KEY IS NOT < COD OF ENR-LIV. CH0. READ FLIVRE NEXT. MOVE CORR ENR-LIV TO ENR-TMP. DISPLAY ENR-TMP. *//par code------------------------- * (RCH1) * [F-] (CH1) [D-] * -c3-> *c3: SLIV = "00" *---------------------------------- RCH1. PERFORM D-RCH1. PERFORM CH1 UNTIL SLIV = "00". PERFORM F-RCH1. *------------------- D-RCH1. DISPLAY "CODE ?". ACCEPT COD OF ENR-LIV. READ FLIVRE. CH1. DISPLAY "LIVRE NON TROUVE / CODE ?". ACCEPT COD OF ENR-LIV. READ FLIVRE. F-RCH1. MOVE COD OF ENR-LIV TO TMPX. MOVE CORR ENR-LIV TO ENR-TMP. DISPLAY ENR-TMP. *//par titre--------------------------- * (RCH2) * [F-] (CH2) [D-] * -c4-> *c4: SLIV = "00" *---------------------------------- RCH2. PERFORM D-RCH2. PERFORM CH2 UNTIL SLIV = "00". PERFORM F-RCH2. *------------------- D-RCH2. DISPLAY "TITRE ?". ACCEPT TITRE OF ENR-LIV. READ FLIVRE KEY IS TITRE OF ENR-LIV. CH2. DISPLAY "TITRE NON TROUVE : TITRE ?". ACCEPT TITRE OF ENR-LIV. READ FLIVRE KEY IS TITRE OF ENR-LIV. F-RCH2. MOVE COD OF ENR-LIV TO TMPX. MOVE CORR ENR-LIV TO ENR-TMP. DISPLAY ENR-TMP. *//par autheur------------------------- * (RCH3) * [x] (CH4) [X] (CH3) [D-] * -c6-> -c5-> *c5: SLIV = "00" *c6: AUTHEUR OF ENR-LIV NOT = TXT OR SLIV = "10" *---------------------------------- RCH3. PERFORM D-RCH3. PERFORM CH3 UNTIL SLIV = "00". PERFORM CH4 UNTIL AUTHEUR OF ENR-LIV NOT = TXT OR SLIV = "10" - . *------------------- D-RCH3. DISPLAY "AUTHEUR ?". ACCEPT TXT. MOVE TXT TO AUTHEUR OF ENR-LIV. READ FLIVRE KEY IS AUTHEUR OF ENR-LIV. CH3. DISPLAY "AUTHEUR NON TROUVE". ACCEPT AUTHEUR OF ENR-LIV. READ FLIVRE KEY IS AUTHEUR OF ENR-LIV. CH4. MOVE CORR ENR-LIV TO ENR-TMP. DISPLAY ENR-TMP. READ FLIVRE NEXT. *//par theme------------------------- * (RCH4) * * [X] (CH6) [I-] (CH5) [D-] * -c8-> -c7-> * * .ch6 -c01- * [F-] (X) (CMN) [X] * *c01: THEME OF ENR-LIV = C *c7 : C POSITIVE AND C NOT > CPT *c8 : SLIV = "10" *---------------------------------- RCH4. PERFORM D-RCH4. PERFORM CH5 UNTIL C POSITIVE AND C NOT > CPT. PERFORM I-RCH4. PERFORM CH6 UNTIL SLIV = "10". CH6. IF THEME OF ENR-LIV = C PERFORM CMN. PERFORM F-CH6. *------------------- D-RCH4. PERFORM THE. DISPLAY "THEME ?". ACCEPT C. CH5. DISPLAY "THEME ?". ACCEPT C. I-RCH4. READ FLIVRE NEXT. CMN. MOVE CORR ENR-LIV TO ENR-TMP. DISPLAY ENR-TMP. F-CH6. READ FLIVRE NEXT. *-------test par enr-tmp.theme----- * RCH4. * PERFORM D-RCH4. * PERFORM CH5 UNTIL C POSITIVE AND C NOT > CPT. * PERFORM I-RCH4. * PERFORM CH6 UNTIL SLIV = "00". * PERFORM CH7 UNTIL SLIV = "23" OR SLIV = "10". * * D-RCH4. * PERFORM THE. * DISPLAY "THEME ?". * ACCEPT C. * CH5. * DISPLAY "THEME ?". * ACCEPT C. * I-RCH4. * MOVE C TO THEME OF ENR-TMP. * READ FLIVRE KEY IS THEME OF ENR-TMP. * CH6. * PERFORM CH5. * MOVE C TO THEME OF ENR-TMP. * READ FLIVRE KEY IS THEME OF ENR-TMP. * CH7. * MOVE ENR-LIV TO ENR-TMP. * DISPLAY ENR-TMP. * READ FLIVRE NEXT. *---------------------------------- F-RCH. CLOSE FLIVRE. STOP "PAUSE". MOVE 1 TO FLG. *----------------------------------------------- *GESTION DES CLIENTS---------------------------- CLN. EXIT. *----------------------------------------------- *GESTION DES PRETS------------------------------ PRE. EXIT. *----------------------------------------------- *AFFICHER THEME--------------------------------- THE. DISPLAY (1, 1) ERASE. DISPLAY "LISTE DES THEMES // 0 - NOUVEAU THEME". PERFORM D-THE. PERFORM ATHE UNTIL EOF=1. PERFORM F-THE. *------------ D-THE. MOVE 0 TO EOF, CLE-THE. OPEN INPUT FTHEME. READ FTHEME NEXT AT END MOVE 1 TO EOF. ATHE. DISPLAY CLE-THE, " - ", DESC. READ FTHEME NEXT AT END MOVE 1 TO EOF. F-THE. MOVE CLE-THE TO CPT. CLOSE FTHEME. MOVE 1 TO FLG. *----------------------------------------------- *ADD new theme --------------------------------- NTH. PERFORM D-NTH. PERFORM RCH-THE UNTIL EOF = 1. PERFORM I-NTH. PERFORM NFO UNTIL RAYON POSITIVE AND QT-MAX POSITIVE. PERFORM F-NTH. RCH-THE. PERFORM DMY. IF DSC-TMP = DESC PERFORM THE-KO ELSE PERFORM DMY. PERFORM F-RCH-THE. *---------------- D-NTH. OPEN I-O FTHEME. DISPLAY "NOUVEAU THEME ?". ACCEPT DSC-TMP. MOVE 0 TO EOF. READ FTHEME NEXT; AT END MOVE 1 TO EOF. THE-KO. DISPLAY "TITRE EXISTANT : ", CLE-THE, " - ", DESC. CLOSE FTHEME. PERFORM D-NTH. F-RCH-THE. READ FTHEME NEXT; AT END MOVE 1 TO EOF. I-NTH. MOVE DSC-TMP TO DESC. DISPLAY "RAYON / QT-MAX ?". ACCEPT RAYON. ACCEPT QT-MAX. NFO. DISPLAY "RAYON / QT-MAX ?". ACCEPT RAYON. ACCEPT QT-MAX. F-NTH. ADD 1 TO CLE-THE. WRITE ENR-THE INVALID KEY DISPLAY "ERROR", STHE. CLOSE FTHEME. *----------------------------------------------- *UTILS------------------------------------------ DMY. EXIT. *\ERREURS----------------------- ERR. EXIT. *MENUS------------------------------------------ MENU1. DISPLAY (1, 1) ERASE. DISPLAY "1/ GESTION DES LIVRES". DISPLAY "2/ GESTION DES CLIENTS". DISPLAY "3/ GESTION DES EMPRUNTS". DISPLAY "4/ QUITTER". MENU2. DISPLAY (1, 1) ERASE. DISPLAY "1/ AJOUTER NOUVEAU LIVRE". DISPLAY "2/ AJOUTER NOUVEL EXEMPLAIRE". DISPLAY "3/ MODIFIER UN LIVRE". DISPLAY "4/ RECHERCHER". DISPLAY "5/ QUITTER". MENU3. DISPLAY (1, 1) ERASE. DISPLAY "0/ LISTER TOUS LES LIVRES". DISPLAY "1/ PAR CODE". DISPLAY "2/ PAR TITRE". DISPLAY "3/ PAR AUTHEUR". DISPLAY "4/ PAR THEME". DISPLAY "5/ QUITTER".