INSPECT

ACUCOBOL-GT extension to the INSPECT statement.

Formats 1 and 2

Formats 1 and 2 are identical to MF COBOL. Refer to the Micro Focus COBOL Language Reference section or the ACUCOBOL-GT Reference manual.

Format 3

INSPECT source

    [ TALLYING counter FOR TRAILING comp-value ] 
    [ REPLACING TRAILING target BY replace ] 

TRAILING is an ACUCOBOL-GT extension. It is used to find the rightmost occurrence, or set of contiguous occurrences, in the source data item. If a TRAILING occurrence is found, a right to left scan of the source data item is made to find contiguous occurrences.

If the TRAILING phrase is present, the REPLACING option causes all contiguous occurrences of target to be replaced by replace, provided that these occurrences end in the rightmost character position of source.

Source and Comp-value must be of usage DISPLAY.

Comp-value, Target, and Replace must be nonnumeric literals or single-character alphanumeric data items.