Wouldn't it be simpler (and a whole lot prettier) to combine the four flags
into a single field and use that as the comparison key to search an array
containing the patterns - then just use the resulting index to increment the
appropriate pattern element?

Like so (not tested so ....)

  Working-Storage Section.

 01  Patterns.
     05 Current-Pattern.
       10 RS-SUMG       Pic x.
       10 RS-SUMW       Pic x.
       10  RS-FALLG     Pic x.
       10  RS-FALLW     Pic x.

     05 Pattern-Values.
       10 Filler         Pic x(4) value "X   ".
       10 Filler         Pic x(4) value " X  ".
       10 Filler         Pic x(4) value "  X ".
       10 Filler         Pic x(4) value "   X".
       10 Filler         Pic x(4) value "X   ".
*      etc. etc. for the rest of the patterns

     05 Pattern-Array  Redefines Pattern-Values
                       Pic x(4) occurs 14.
 01  Pattern-Counts.
     05 Pattern-Index  Pic S9(3) Comp-3.
     05 Pattern        Pic S9(5) Comp-3  Occurs 14.

 Procedure Division.
     Search Pattern-Array varying Pattern-Index
         when Pattern-Array(Pattern-Index) = Current-Pattern
             Add 1 to Pattern(Pattern-Index).

Jon Paris

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.