SEARCH

Use in the same manner as the COBOL SEARCH verb, including conditionals and looping for each WHEN condition.
Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

Syntax: for Format 1

SEARCH identifier1 VARYING indexname|identifier2
... [[AT] END]
    statementblock
[WHEN searchcondition1
    statementblock  ]
         .
         .
[WHEN searchconditionN
    statementblock  ]

Syntax: for Format 2

SEARCH ALL identifier [[AT] END]
    statementblock
WHEN searchcondition
    statementblock

Example:

Use SEARCH to achieve the NEXT SENTENCE concept. If the condition in lines 1040-1050 is true, pass control to line 1110.
001010  PARA   SEARCH-TABLE
001020             SEARCH STOCK-ELEMENT AT END
001030                 PERFORM END-ROUTINE
001040             WHEN QUAN-ON-HAND (STOCK-INDEX) NOT <
001050             ... QUAN-NEEDED (STOCK-INDEX)
001060             WHEN QUAN-ON-HAND (STOCK-INDEX) = ZERO
001070                 PERFORM NO-STOCK-ROUTINE
001080             WHEN QUAN-ON-HAND (STOCK-INDEX) <
001090             ... QUAN-NEEDED (STOCK-INDEX)
001100                 PERFORM DETERMINE-IF-ORDER-ROUTINE
001110             WORK-QUAN = QUAN-ON-HAND (STOCK-INDEX)