Midrange News for the IBM i Community

CLSCAN Command Published by: Bob Cozzi on 28 Aug 2012 view comments

CLSCAN - Scan (Search) a CL Variable

The CLSCAN command allows the CL programmer to search for a pattern within a CL variable and return the "found" position of that pattern into a CL variable.

Parameter Definition

PATTERN - The data that is search for within the CL variable specified on the SCHDATA parameter.

SCHDATA - A CL variable containing the data that is to be searched for the pattern specified on the PATTERN parameter.

CASE - Specify CASE(*MATCH) to do a upper/lower case-sensitive search. Use CASE(*IGNORE) to ignore upper/lower case differences when searching. Note CASE(*YES) is the same as CASE(*MATCH) and CASE(NO) is the same as CASE(*IGNORE).

START - Specify the start position within the SCHDATA variable to begin the search.

LEN -Specify the length of the search or the special value LEN(*END) to search until the end of the SCHDATA CL variable. The length indicates the total number of positions to be search starting with the START position.

RTNPOS -Specify a numeric CL variable to receive the position within the SCHDATA where the PATTERN was found. If the PATTERN is not found, 0 is returned.

RTNCHAR - Specify an option character CL variable to receive the found position in text format, left-justified.



The CLSCAN along with the CLCASE and CLEDIT commands are included in the runtime and Developer Editions of COZTOOLS, available at www.cozTools.com

Return to midrangenews.com home page.
Sort Ascend | Descend