MOVE PRM-COMPANY TO DB-COMPANY. MOVE SPACES TO FILTER-STRING. MOVE WS-PRD-FILTER TO FILTER-STRING. PERFORM 890-CREATE-FILTER. MOVE PRM-FROM-DATE TO FILTER-STRING. PERFORM 890-SET-DATETIME-FILTER-VALUE. MOVE PRM-FROM-DATE TO FILTER-STRING. PERFORM 890-SET-DATETIME-FILTER-VALUE. MOVE "0" TO FILTER-STRING. PERFORM 890-SET-ALPHANUM-FILTER-VALUE.
MOVE PRDSET2-COMPANY TO WS-DB-BEG-RNG. PERFORM 850-FILTER-BEGRNG-PRDSET2. Below is the Filter definition in Working Storage: 02 WS-PRD-FILTER-GROUP. 03 FILLER PIC X(23) VALUE "((PRD-GL-DATE < ?) AND ". 03 FILLER PIC X(23) VALUE "(PRD-RUN-DATE < ?) AND ". 03 FILLER PIC X(19) VALUE "(PRD-CHECK-ID > ?))". 02 FILLER REDEFINES WS-PRD-FILTER-GROUP. 03 WS-PRD-FILTER PIC X(65). This should equate to the SQL statement: SELECT * FROM PRDISTRIB WHERE PRM-COMPANY = COMPANY AND GL_DATE < PRM-FROM-DATE AND RUN_DATE< PRM-FROM-DATE AND CHECK_ID > 0 (zero)