Page 1 of 1
Searching string in PL/I.
Posted: Wed Jul 22, 2015 7:55 pm
by MariaJames
I have a variable declared in PL/I as character. Variable may have 15,000 length of data. The data can be mix of differnt characters inclusing special signs. I need to search the occurance of 3 consecutive numbers in this set of 15,000 characters. Ccan you please guide on how can I do it?
Thanks.
Re: Searching string in PL/I.
Posted: Wed Jul 22, 2015 8:10 pm
by Robert Sample
Are you looking for three digits in a row or do you want a particular 3-digit value?
Re: Searching string in PL/I.
Posted: Thu Jul 23, 2015 1:01 am
by enrico-sorichetti
if You know what You are searching for - 987 for example - a simple
will do
otherwise if You are searching for three consecutive numeric chars You will need a two stage approach ...
Code: Select all
work_string=translate(your_string,'$$$$$$$$$$','0123456789')
where = index(work_string,'$$$'')
the
$ is a character that must NOT exist in your_string