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.
Searching string in PL/I.
- Robert Sample
- Global Moderator
- Posts: 1896
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Searching string in PL/I.
Are you looking for three digits in a row or do you want a particular 3-digit value?
-
- Global Moderator
- Posts: 826
- Joined: Wed Sep 11, 2013 3:57 pm
Re: Searching string in PL/I.
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 ...
the $ is a character that must NOT exist in your_string
Code: Select all
where = index(your_string,'987')
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,'$$$'')
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute