      ******************************************************************
      * Author: Jay Moseley
      * Date: May 19, 2016
      * Purpose: Verify correct function of base36 conversion subs.
      * Tectonics: cobc -x t_base36.cbl base36.cbl
      ******************************************************************
       IDENTIFICATION DIVISION.
       PROGRAM-ID. t_base36.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.

       INPUT-OUTPUT SECTION.

       DATA DIVISION.

       FILE SECTION.

       WORKING-STORAGE SECTION.
       77  BASE-10-VAR                 PIC 9(10).
       77  BASE-36-VAR                 PIC X(6).

       01  TEST-VALUES.
           02  FILLER  PIC 9(10) VALUE 20.
           02  FILLER  PIC 9(10) VALUE 200.
           02  FILLER  PIC 9(10) VALUE 300.
           02  FILLER  PIC 9(10) VALUE 3000.
           02  FILLER  PIC 9(10) VALUE 40000.
           02  FILLER  PIC 9(10) VALUE 50000.
           02  FILLER  PIC 9(10) VALUE 602350.
           02  FILLER  PIC 9(10) VALUE 2176782335.
           02  FILLER  PIC 9(10) VALUE 2176782336.
           02  FILLER  PIC 9(10) VALUE 5120000001.
       01  TEST-VALUES-TABLE           REDEFINES TEST-VALUES.
           02  TEST-VALUE              PIC 9(10)
                                       OCCURS 10 TIMES
                                       INDEXED BY T-X.
       01  HEAD-LINE.
           02  FILLER  PIC X(10) VALUE 'Test Value'.
           02  FILLER  PIC X(03) VALUE SPACES.
           02  FILLER  PIC X(07) VALUE '>Base36'.
           02  FILLER  PIC X(02) VALUE SPACES.
           02  FILLER  PIC X(05) VALUE 'RC(1)'.
           02  FILLER  PIC X(03) VALUE SPACES.
           02  FILLER  PIC X(07) VALUE '>Base10'.
           02  FILLER  PIC X(06) VALUE SPACES.
           02  FILLER  PIC X(05) VALUE 'RC(2)'.

       01  DETAIL-LINE.
           02  DL-TEST-VALUE           PIC 9(10).
           02  FILLER                  PIC X(03).
           02  DL-BASE-36              PIC X(6).
           02  FILLER                  PIC X(03).
           02  DL-RETURN-CODE-1        PIC +9999.
           02  FILLER                  PIC X(03).
           02  DL-BASE-10              PIC 9(10).
           02  FILLER                  PIC X(03).
           02  DL-RETURN-CODE-2        PIC +9999.

       PROCEDURE DIVISION.

       MAIN-PROCEDURE.

           DISPLAY HEAD-LINE.

           PERFORM VARYING T-X
                   FROM 1 BY 1
                   UNTIL T-X > 10
             MOVE SPACES TO DETAIL-LINE
             MOVE TEST-VALUE (T-X) TO DL-TEST-VALUE
             CALL 'toBase36' USING TEST-VALUE (T-X),
                                   BASE-36-VAR
             END-CALL
             MOVE BASE-36-VAR TO DL-BASE-36
             MOVE RETURN-CODE TO DL-RETURN-CODE-1
             IF RETURN-CODE = +0
               CALL 'fromBase36' USING BASE-36-VAR,
                                       BASE-10-VAR
               END-CALL
               MOVE BASE-10-VAR TO DL-BASE-10
               MOVE RETURN-CODE TO DL-RETURN-CODE-2
             END-IF
             DISPLAY DETAIL-LINE
           END-PERFORM.

           GOBACK.

       END PROGRAM t_base36.

