UDCUSSL Discard Exit Routine Example

In the following example of the UDCUSSL discard exit routine, a condition is tested. If this condition is not complied with, the return code is set to “ER”, thus disabling the writing of the record on the output file.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.   UDCUSSL.
      ******************************************************************
      *
      *      Source name: UDCUSSL
      *      Function   : DATA CHANGER - USER EXIT FOR RECORD SELECTION
      *
      ******************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
       DATA DIVISION.
       FILE SECTION.
      ****************************************************************
       WORkING-STORAGE SECTION.
      ****************************************************************
      *
       01  WS-COMODI.
           05  FILLER                 PIC  X.
      *
       01  WS-AREA-RECORD.
           05  FILLER                 PIC  X(30).
           05  WS-FIELD-SELECT        PIC  X(10).
           05  FILLER                 PIC  X(82).
      ****************************************************************
       LINkAGE SECTION.
      ****************************************************************
       COPY UDCUSSLW.
      ****************************************************************
       PROCEDURE DIVISION  USING  UDCUSSL-RECORD UDCUSSL-RETCODE.
      ****************************************************************
      *
       START-PGM.
      *
           MOVE SPACE                     TO UDCUSSL-RETCODE.
      *
           MOVE UDCUSSL-RECORD(1:122)     TO WS-AREA-RECORD.
      *
           IF   WS-FIELD-SELECT        NOT = "CBL       "
                MOVE "ER"                 TO UDCUSSL-RETCODE
           END-IF.
      *
       END-PGM.
      *
           GOBACK.
      *