      * ----------------------------------------------------------------
      * Calcul de la date de Pâques pour une année quelconque du
      * calendrier grégorien, par l'algorithme de J.-M. Oudin.
      * https://www.persee.fr/doc/bastr_0245-9760_1940_num_12_1_14145
      * ----------------------------------------------------------------
       IDENTIFICATION DIVISION.
       PROGRAM-ID. Example.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
      * ----------------------------------------------------------------
      * Structure pour l'obtention de la date courante.
      * https://www.ibm.com/docs/en/cobol-zos/6.3.0?topic=functions-current-date
      * ----------------------------------------------------------------
       01  WS-CURRENT-DATE-FIELDS.
           05  WS-CURRENT-DATE.
               10  WS-CURRENT-YEAR    PIC  9(4).
               10  WS-CURRENT-MONTH   PIC  9(2).
               10  WS-CURRENT-DAY     PIC  9(2).
           05  WS-CURRENT-TIME.
               10  WS-CURRENT-HOUR    PIC  9(2).
               10  WS-CURRENT-MINUTE  PIC  9(2).
               10  WS-CURRENT-SECOND  PIC  9(2).
               10  WS-CURRENT-MS      PIC  9(2).
           05  WS-DIFF-FROM-GMT       PIC S9(4).
      * ----------------------------------------------------------------
      * Variables pour le calcul de la date de Pâques.
      * ----------------------------------------------------------------
       01  WS-YEAR  PIC  9(4).
       01  WS-G     PIC  9(5).
       01  WS-C     PIC  9(5).
       01  WS-C4    PIC  9(5).
       01  WS-E     PIC  9(5).
       01  WS-H     PIC  9(5).
       01  WS-K     PIC  9(5).
       01  WS-P     PIC  9(5).
       01  WS-Q     PIC  9(5).
       01  WS-I     PIC  9(5).
       01  WS-B     PIC  9(5).
       01  WS-J1    PIC  9(5).
       01  WS-J2    PIC  9(5).
       01  WS-RES   PIC  9(5).
       01  WS-RES2  PIC  Z9.
       PROCEDURE DIVISION.
           DISPLAY "Date du dimanche de Pâques".
      * ----------------------------------------------------------------
      * Obtention de l'année courante.
      * ----------------------------------------------------------------
           MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE-FIELDS.
           DISPLAY "[DEBUG] WS-CURRENT-YEAR =  " WS-CURRENT-YEAR.
      * ----------------------------------------------------------------
      * Lecture de la ligne de commande.
      * ----------------------------------------------------------------
           ACCEPT WS-YEAR FROM COMMAND-LINE.
           DISPLAY "[DEBUG] WS-YEAR         =  " WS-YEAR.
           IF WS-YEAR = 0 THEN
               MOVE WS-CURRENT-YEAR TO WS-YEAR
           END-IF.
      * ----------------------------------------------------------------
      * Calcul.
      * ----------------------------------------------------------------
           COMPUTE WS-G = FUNCTION MOD(WS-YEAR 19).
           DISPLAY "[DEBUG] WS-G            = " WS-G.
           DIVIDE WS-YEAR BY 100 GIVING WS-C.
           DISPLAY "[DEBUG] WS-C            = " WS-C.
           DIVIDE WS-C BY 4 GIVING WS-C4.
           DISPLAY "[DEBUG] WS-C4           = " WS-C4.
           COMPUTE WS-E = (8 * WS-C + 13) / 25.
           DISPLAY "[DEBUG] WS-E            = " WS-E.
           COMPUTE WS-H =
           FUNCTION MOD(19 * WS-G + WS-C - WS-C4 - WS-E + 15 30).
           DISPLAY "[DEBUG] WS-H            = " WS-H.
           DIVIDE WS-H by 28 GIVING WS-K.
           DISPLAY "[DEBUG] WS-K            = " WS-K.
           COMPUTE WS-P = 29 / (WS-H + 1)
           DISPLAY "[DEBUG] WS-P            = " WS-P.
           COMPUTE WS-Q = (21 - WS-G) / 11.
           DISPLAY "[DEBUG] WS-Q            = " WS-Q.
           COMPUTE WS-I = (WS-K * WS-P * WS-Q - 1) * WS-K + WS-H.
           DISPLAY "[DEBUG] WS-I            = " WS-I.
           COMPUTE WS-B = WS-YEAR / 4 + WS-YEAR;
           DISPLAY "[DEBUG] WS-B            = " WS-B.
           COMPUTE WS-J1 = WS-B + WS-I + 2 + WS-C4 - WS-C.
           DISPLAY "[DEBUG] WS-J1           = " WS-J1.
           COMPUTE WS-J2 = FUNCTION MOD(WS-J1 7).
           DISPLAY "[DEBUG] WS-J2           = " WS-J2.
           COMPUTE WS-RES = 28 + WS-I - WS-J2.
           DISPLAY "[DEBUG] WS-RES          = " WS-RES.
      * ----------------------------------------------------------------
      * Interprétation du résultat.
      * ----------------------------------------------------------------
           DISPLAY "En " WS-YEAR
             ", le dimanche de Pâques est le " WITH NO ADVANCING.
           
           IF WS-RES > 31 THEN
               COMPUTE WS-RES = WS-RES - 31
               IF WS-RES = 1 THEN
                   DISPLAY "1er avril."
               ELSE
                   MOVE WS-RES TO WS-RES2
                   DISPLAY FUNCTION TRIM(WS-RES2) " avril."
               END-IF
           ELSE
               MOVE WS-RES TO WS-RES2
               DISPLAY FUNCTION TRIM(WS-RES2) " mars."
           END-IF.
      * ----------------------------------------------------------------
           STOP RUN.
