# Is it possible to check for more than 1 value in a EXAMINE SUBSTRING?

**URL:** <https://techcommunity.softwareag.com/t/is-it-possible-to-check-for-more-than-1-value-in-a-examine-substring/263580>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, natural-mainframe\
**Created:** [September 12, 2022, 9:32pm UTC](https://techcommunity.softwareag.com/t/is-it-possible-to-check-for-more-than-1-value-in-a-examine-substring/263580 "2022-09-12T21:32:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Priscilla\_G\_Souza](https://avatars.discourse-cdn.com/v4/letter/p/c4cdca/32.png) [@Priscilla\_G\_Souza](https://techcommunity.softwareag.com/u/Priscilla_G_Souza)\
**Post date:** [September 12, 2022, 9:32pm UTC](https://techcommunity.softwareag.com/t/is-it-possible-to-check-for-more-than-1-value-in-a-examine-substring/263580/1 "2022-09-12T21:32:17Z")

</div>

#### 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.

---

<div class="post-metadata">

**Author:** ![MICK.FITZPATRICK](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@MICK.FITZPATRICK](https://techcommunity.softwareag.com/u/MICK.FITZPATRICK)\
**Post date:** [September 12, 2022, 9:47pm UTC](https://techcommunity.softwareag.com/t/is-it-possible-to-check-for-more-than-1-value-in-a-examine-substring/263580/2 "2022-09-12T21:47:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [September 13, 2022, 5:12am UTC](https://techcommunity.softwareag.com/t/is-it-possible-to-check-for-more-than-1-value-in-a-examine-substring/263580/3 "2022-09-13T05:12:32Z")

</div>

For a single character, use Mick’s IF example. EXAMINE is used to interrogate a string.

```auto
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

```

```auto
#STRING: Pb3De6Sh!P
#FOUND: 4

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [March 12, 2023, 5:12am UTC](https://techcommunity.softwareag.com/t/is-it-possible-to-check-for-more-than-1-value-in-a-examine-substring/263580/4 "2023-03-12T05:12:54Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
