      $SET WARNING(3) NOOSVS ANS85 mf
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT fichier ASSIGN TO "HEBDO.OUT"
               ORGANIZATION IS LINE SEQUENTIAL.
       FILE SECTION.
       FD fichier.
       01 valeurs.
           02 un-aller PIC 9.9(17).
           02 espace PIC X.
           02 un-retour PIC 9.9(17).
       01 titres REDEFINES valeurs.
           02 le-titre PIC X(39).
       WORKING-STORAGE SECTION.
       01 tableau OCCURS 21 TIMES INDEXED BY indice.
           05 aller PIC 9.9(17).
           05 retour PIC 9.9(17).
       01 my-value PIC 9V9(17).
       01 sens PIC X.
           88 A-L-ALLER VALUE "A".
       SCREEN SECTION.
       01  resultat.
           05  BLANK SCREEN.
       PROCEDURE DIVISION.
       main-1.
           move 2.0 TO my-value.
           SET indice TO 1.
           move "A" to sens.
           perform racine 20 TIMES.
           perform sauve.
           move "R" to sens.
           perform carre 20 TIMES.
           perform sauve.
           perform ouvre-fichier.
           DISPLAY resultat.
           perform affiche 21 TIMES.
           CLOSE fichier.
           exit program
           STOP RUN.
       racine.
           perform sauve.
           COMPUTE my-value ROUNDED = my-value ** 0.5.
       carre.
           perform sauve.
           MULTIPLY my-value BY my-value ROUNDED.
       sauve.
           IF A-L-ALLER
               move my-value TO aller(indice)
               SET indice UP BY 1
           ELSE
               SET indice DOWN BY 1
               move my-value TO retour(indice).
       affiche.
           move aller(indice) TO un-aller.
           move retour(indice) TO un-retour.
           WRITE valeurs.
           DISPLAY aller(indice) "  " retour(indice).
           SET indice UP BY 1.
           
       ouvre-fichier.    
           OPEN OUTPUT fichier.
           move "  VALEURS ALLER     ET RETOUR..." TO le-titre.
           WRITE titres.
           move SPACE to espace.

           
