Skip to Content
0
Former Member
May 11, 2009 at 08:46 AM

Extending the "Pattern" concept

26 Views

Hi, i have to develop a report which has performance issues on some of its coding.

Essentially, i have to extract from a table (about 4 millions records) which contains long strings, every substring that contains determined patterns.

The patterns are in form

12 numerical, with a space or comma at the end and start

10 numerical, with a space or comma at the end and start

specific letter + 9 numerical, with a space or comma at the end and start

This is part of it, with a loop for every pattern.

CONSTANTS ca_set_numeric(10) TYPE c VALUE '0123456789'.

    CLEAR: vn_l_fdpos, fl_l_check_this.
    vn_l_endpos = 12.
    WHILE ( vn_l_endpos LE vn_l_infolength ).
      IF vn_l_fdpos EQ 0.
        IF va_l_bon_info(12) CO ca_set_numeric.
          fl_l_check_this = 'X'.
          va_l_string12 = va_l_bon_info(12).
        ENDIF.
      ELSEIF vn_l_endpos EQ vn_l_infolength.
        IF va_l_bon_info+vn_l_fdpos(12) CO ca_set_numeric.
          fl_l_check_this = 'X'.
          va_l_string12 = va_l_bon_info+vn_l_fdpos(12).
        ENDIF.
      ELSE.
        va_l_string14 = va_l_bon_info+vn_l_fdpos(14).
        IF va_l_string14(1) NA ca_set_numeric
          AND va_l_string14+13(1) NA ca_set_numeric
          AND va_l_string14+1(12) CO ca_set_numeric.
          fl_l_check_this = 'X'.
          va_l_string12 = va_l_string14+1(12).
        ENDIF.
      ENDIF.
ADD 1 to: vn_l_fdpos, vn_l_endpos.
ENDWHILE.

If i could do it like a single pattern, like the CP operator does, i could save looping three times, and the time spent in accessing subfields. Is there anything which does it, or a standard "tokenizer" which allows me to define symbols other than the * and ?

Even if not, any suggestion to improvement is appreciated.

Thanks in advance.