        IDENTIFICATION DIVISION.
        PROGRAM-ID. libcobcursex.
      *>
      *> THIS IS A DUMMY PROGRAM, USED TO GET THE SHARED LIBRARY
      *> MODULE LOADED.
      *>
        PROCEDURE DIVISION.
            GOBACK.
        END PROGRAM libcobcursex.


        IDENTIFICATION DIVISION.
        PROGRAM-ID. COBCURSES-EXTRA-INT-OPTIONS.
      *>
      *> THIS IS AN INTERNAL SUPPORT ROUTINE THAT SIMPLY
      *> GATHERS A NUMBER OF PIC X OPTIONS INTO A SINGLE
      *> STRING, FOR EASE OF PARAMETER PASSING.
      *>
        DATA DIVISION.
        LINKAGE SECTION.
            01  WS-OPTION-FLAGS     PIC X(3).
                COPY COBCEXTRA.

        PROCEDURE DIVISION
          USING COBCURSES-EXTRAS, WS-OPTION-FLAGS.

            MOVE NC-CSV-DELIMITER TO WS-OPTION-FLAGS(1:1).
            MOVE NC-CSV-MULT-DEL-FLAG TO WS-OPTION-FLAGS(2:1).
            MOVE NC-CSV-QUOTE-CONVENTION TO WS-OPTION-FLAGS(3:1).
            GOBACK.

        END PROGRAM COBCURSES-EXTRA-INT-OPTIONS.

        IDENTIFICATION DIVISION.
        PROGRAM-ID. COBCURSES-EXTRACT-CSV-FIELD.
      *>
      *> THIS IS AN INTERFACE ROUTINE TO THE C MODULE THAT DOES
      *> THE ACTUAL CSV RECORD PARSING.
      *>
        DATA DIVISION.
        WORKING-STORAGE SECTION.
            01  WS-OPTION-FLAGS         PIC X(3).
        LINKAGE SECTION.
            COPY COBCEXTRA.

        PROCEDURE DIVISION
          USING COBCURSES-EXTRAS.

            CALL "COBCURSES-EXTRA-INT-OPTIONS"
                USING COBCURSES-EXTRAS, WS-OPTION-FLAGS.
            CALL "NC_EXTRACT_CSV"
                USING
                    NC-CSV-TEXT,
                    NC-CSV-LENGTH,
                    NC-EXTRACT-FIELD,
                    NC-EXTRACT-BUFFER,
                    NC-EXTRACT-BUFLEN,
                    WS-OPTION-FLAGS.
            GOBACK.

        END PROGRAM COBCURSES-EXTRACT-CSV-FIELD.


        IDENTIFICATION DIVISION.
        PROGRAM-ID. COBCURSES-CLEAR-CSV-HEADINGS.
      *>
      *> THIS IS AN INTERFACE ROUTINE TO THE C MODULE THAT 
      *> CLEARS THE CSV HEADER ASSOCIATIVE ARRAY.
      *>
        DATA DIVISION.
        LINKAGE SECTION.

        PROCEDURE DIVISION.
            CALL "NC_CLEAR_HEADINGS".
            GOBACK.

        END PROGRAM COBCURSES-CLEAR-CSV-HEADINGS.


        IDENTIFICATION DIVISION.
        PROGRAM-ID. COBCURSES-LOAD-CSV-HEADINGS.
      *>
      *> THIS IS AN INTERFACE ROUTINE TO THE C MODULE THAT DOES
      *> PARSES THE CSV RECORD HEADINGS AND LOADS THEM INTO
      *> AN ASSOCIATIVE ARRAY.
      *>
        DATA DIVISION.
        WORKING-STORAGE SECTION.
            01  WS-OPTION-FLAGS         PIC X(3).
        LINKAGE SECTION.
            COPY COBCEXTRA.

        PROCEDURE DIVISION
            USING COBCURSES-EXTRAS.

            CALL "COBCURSES-EXTRA-INT-OPTIONS"
                USING COBCURSES-EXTRAS, WS-OPTION-FLAGS.

            CALL "NC_LOAD_COLUMN_HEADINGS"
                USING
                    NC-CSV-TEXT,
                    NC-CSV-LENGTH,
                    WS-OPTION-FLAGS.
            GOBACK.

        END PROGRAM COBCURSES-LOAD-CSV-HEADINGS.


        IDENTIFICATION DIVISION.
        PROGRAM-ID. COBCURSES-REGISTER-CSV-COLUMN.
      *>
      *> THIS IS AN INTERFACE ROUTINE TO THE C MODULE THAT DOES
      *> REGISTERS A USER'S CSV RECEIVING BUFFER AND LENGTH 
      *> INTO COBCURSES ASSOCIATIVE ARRAY, BY NAME.
      *>
        DATA DIVISION.
        WORKING-STORAGE SECTION.
            01  NC-HEADING-NAME-PTR         POINTER.
            01  NC-HEADING-NAME-LENGTH      PIC 9999 COMP-5.

        LINKAGE SECTION.
            COPY COBCEXTRA.

        PROCEDURE DIVISION
            USING COBCURSES-EXTRAS.

            SET NC-HEADING-NAME-PTR
                TO ADDRESS OF NC-CSV-HEADING.
            MOVE LENGTH OF NC-CSV-HEADING
                TO NC-HEADING-NAME-LENGTH.

            CALL "NC_REGISTER_COLUMN"
                USING
                    NC-HEADING-NAME-PTR,
                    NC-HEADING-NAME-LENGTH,
                    NC-CSV-COL-BUFFER,
                    NC-CSV-COL-BUFLEN.
            GOBACK.

        END PROGRAM COBCURSES-REGISTER-CSV-COLUMN.


        IDENTIFICATION DIVISION.
        PROGRAM-ID. COBCURSES-REGISTER-CSV-COL-HDG.
      *>
      *> FORMERLY COBCURSES-REGISTER-CSV-COLUMN-HEADING.
      *>
      *> THIS IS AN INTERFACE ROUTINE TO THE C MODULE THAT DOES
      *> REGISTERS A USER'S CSV RECEIVING BUFFER AND LENGTH 
      *> INTO COBCURSES ASSOCIATIVE ARRAY, BY NAME.
      *>
        DATA DIVISION.
        WORKING-STORAGE SECTION.
            01  NC-HEADING-NAME-PTR         POINTER.
            01  NC-HEADING-NAME-LENGTH      PIC 9999 COMP-5.

        LINKAGE SECTION.
            COPY COBCEXTRA.

        PROCEDURE DIVISION
            USING COBCURSES-EXTRAS.

            SET NC-HEADING-NAME-PTR
                TO ADDRESS OF NC-CSV-HEADING.
            MOVE LENGTH OF NC-CSV-HEADING
                TO NC-HEADING-NAME-LENGTH.

            CALL "NC_REGISTER_COLUMN_HEADING"
                USING
                    NC-HEADING-NAME-PTR,
                    NC-HEADING-NAME-LENGTH,
                    NC-CSV-COL-BUFFER,
                    NC-CSV-COL-BUFLEN.
            GOBACK.

        END PROGRAM COBCURSES-REGISTER-CSV-COL-HDG.


        IDENTIFICATION DIVISION.
        PROGRAM-ID. COBCURSES-REGISTER-CSV-COL-NO.
      *>
      *> FORMERLY COBCURSES-REGISTER-CSV-COLUMN-NO.
      *>
      *> THIS IS AN INTERFACE ROUTINE TO THE C MODULE THAT DOES
      *> REGISTERS A USER'S CSV RECEIVING BUFFER AND LENGTH 
      *> INTO COBCURSES ASSOCIATIVE ARRAY, BY NUMBER.
      *>
        DATA DIVISION.
        LINKAGE SECTION.
            COPY COBCEXTRA.

        PROCEDURE DIVISION
            USING COBCURSES-EXTRAS.

            CALL "NC_REGISTER_COLUMN_NO"
                USING
                    NC-CSV-COLUMN-NO,
                    NC-CSV-COL-BUFFER,
                    NC-CSV-COL-BUFLEN.
            GOBACK.

        END PROGRAM COBCURSES-REGISTER-CSV-COL-NO.


        IDENTIFICATION DIVISION.
        PROGRAM-ID. COBCURSES-EXTRACT-CSV-RECORD.
      *>
      *> THIS IS AN INTERFACE ROUTINE TO THE C MODULE THAT DOES
      *> PARSES A CSV RECORD ACCORDING TO ALL OF THE REGISTERED
      *> COLUMNS (SEE COBCURSES-REGISTER-CSV-COLUMN).
      *>
        DATA DIVISION.
        WORKING-STORAGE SECTION.
            01  WS-OPTION-FLAGS         PIC X(3).
        LINKAGE SECTION.
            COPY COBCEXTRA.

        PROCEDURE DIVISION
            USING COBCURSES-EXTRAS.

            CALL "COBCURSES-EXTRA-INT-OPTIONS"
                USING COBCURSES-EXTRAS, WS-OPTION-FLAGS.

            CALL "NC_EXTRACT_CSV_RECORD"
                USING
                    NC-CSV-TEXT,
                    NC-CSV-LENGTH,
                    WS-OPTION-FLAGS.
            GOBACK.

        END PROGRAM COBCURSES-EXTRACT-CSV-RECORD.


        IDENTIFICATION DIVISION.
        PROGRAM-ID. COBCURSES-EMIT-CSV-HEADINGS.
      *>
      *> THIS IS AN INTERFACE ROUTINE TO THE C MODULE THAT
      *> ASSEMBLES COBOL FIELDS INTO A CSV RECORD, BASED UPON
      *> THE CURRENT CSV COLUMNS FOR EACH COLUMN.
      *> (SEE COBCURSES-REGISTER-CSV-COLUMN).
      *>
        DATA DIVISION.
        WORKING-STORAGE SECTION.
            01  WS-OPTION-FLAGS         PIC X(3).
        LINKAGE SECTION.
            COPY COBCEXTRA.

        PROCEDURE DIVISION
            USING COBCURSES-EXTRAS.

            CALL "COBCURSES-EXTRA-INT-OPTIONS"
                USING COBCURSES-EXTRAS, WS-OPTION-FLAGS.

            CALL "NC_EMIT_CSV_HEADINGS"
                USING
                    NC-CSV-TEXT,
                    NC-CSV-LENGTH,
                    WS-OPTION-FLAGS.
            GOBACK.

        END PROGRAM COBCURSES-EMIT-CSV-HEADINGS.


        IDENTIFICATION DIVISION.
        PROGRAM-ID. COBCURSES-EMIT-CSV-RECORD.
      *>
      *> THIS IS AN INTERFACE ROUTINE TO THE C MODULE THAT 
      *> ASSEMBLES COBOL FIELDS INTO A CSV RECORD, BASED UPON
      *> THE CURRENT CSV COLUMNS FOR EACH COLUMN.
      *> (SEE COBCURSES-REGISTER-CSV-COLUMN).
      *>
        DATA DIVISION.
        WORKING-STORAGE SECTION.
            01  WS-OPTION-FLAGS         PIC X(3).
        LINKAGE SECTION.
            COPY COBCEXTRA.

        PROCEDURE DIVISION
            USING COBCURSES-EXTRAS.

            CALL "COBCURSES-EXTRA-INT-OPTIONS"
                USING COBCURSES-EXTRAS, WS-OPTION-FLAGS.

            CALL "NC_EMIT_CSV_RECORD"
                USING
                    NC-CSV-TEXT,
                    NC-CSV-LENGTH,
                    WS-OPTION-FLAGS.
            GOBACK.

        END PROGRAM COBCURSES-EMIT-CSV-RECORD.


        IDENTIFICATION DIVISION.
        PROGRAM-ID. COBCURSES-COUNT-CSV-COLUMNS.
      *>
      *> THIS IS AN INTERFACE ROUTINE TO THE C MODULE THAT DOES
      *> COUNTS THE NUMBER OF CSV COLUMNS FOUND IN THE TEXT RECD.
      *>
        DATA DIVISION.
        WORKING-STORAGE SECTION.
            01  WS-OPTION-FLAGS         PIC X(3).
        LINKAGE SECTION.
            COPY COBCEXTRA.

        PROCEDURE DIVISION
            USING COBCURSES-EXTRAS.

            CALL "COBCURSES-EXTRA-INT-OPTIONS"
                USING COBCURSES-EXTRAS, WS-OPTION-FLAGS.

            CALL "NC_COUNT_CSV"
                USING
                    NC-CSV-TEXT,
                    NC-CSV-LENGTH,
                    WS-OPTION-FLAGS,
                    NC-CSV-COLUMNS.
            GOBACK.

        END PROGRAM COBCURSES-COUNT-CSV-COLUMNS.

