Hi. Is it possible to check for more than one value in a EXAMINE SUBSTRING? For example: this code below tests if the first position of the variable #REGISTER-CODE is equal ‘S’ only.
EXAMINE SUBSTRING (#REGISTER-CODE , 1, 1) ‘S’ GIVING #NUMBER
But in case I need to check if the 1st position is equal to ‘S’ or ‘D’ or ‘P’, is there a way to do this? To check for more values in this statement?
I mean, something like this (but it doesn’t work ):
EXAMINE SUBSTRING (#REGISTER-CODE , 1, 1) ‘S’, ‘D’, ‘P’ GIVING #NUMBER
Thanks in advance.
Don’t have access to an editor anymore but isn’t it as simple as
If substring (variable,1,1) = ‘S’ or = ‘D’ or = ‘P’
Mick Fitzpatrick - 301-529-8022
Expert Technology Consultant
1 Like
For a single character, use Mick’s IF example. EXAMINE is used to interrogate a string.
DEFINE DATA LOCAL
1 #STRING (A10) INIT <'Pb3De6Sh!P'>
1 #SEEK (A1/3) INIT <'D', 'P', 'S'>
1 #FOUND (I4)
END-DEFINE
WRITE '=' #STRING
EXAMINE #STRING FOR #SEEK (*) GIVING NUMBER #FOUND
WRITE '=' #FOUND
END
#STRING: Pb3De6Sh!P
#FOUND: 4
1 Like
system
(system)
Closed
March 12, 2023, 5:12am
4
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.