# Trailing space/s entered are not recognized in the EXAMINE statement

**URL:** <https://techcommunity.softwareag.com/t/trailing-space-s-entered-are-not-recognized-in-the-examine-statement/180521>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [February 11, 2015, 2:05pm UTC](https://techcommunity.softwareag.com/t/trailing-space-s-entered-are-not-recognized-in-the-examine-statement/180521 "2015-02-11T14:05:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ray\_Victor\_Paet](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@Ray\_Victor\_Paet](https://techcommunity.softwareag.com/u/Ray_Victor_Paet)\
**Post date:** [February 11, 2015, 2:05pm UTC](https://techcommunity.softwareag.com/t/trailing-space-s-entered-are-not-recognized-in-the-examine-statement/180521/1 "2015-02-11T14:05:19Z")

</div>

I am having problem in getting the actual length size including the trailing space/s entered.  
example: '_-_ ’

Already considered using EXAMINE/GIVING statement and with the above example the result is 2.

1. EXAMINE #SEARCH-VAL for ‘ ‘ GIVING LENGTH #LENGTH

2. I also considered the hexadecimal value of space, same result  
EXAMINE #SEARCH-VAL FOR H’40’ REPLACE ‘\*’ GIVING LENGTH #LENGTH

I need the actual lenght size entered by the user including trailing space/s to have a reference/ starting point on the next step to pad all trailing spaces (not entered by the user) with ‘%’ for the SQL statement.

Please advise. Thanks.

---

<div class="post-metadata">

**Author:** ![Giles](https://avatars.discourse-cdn.com/v4/letter/g/c68b51/32.png) [@Giles](https://techcommunity.softwareag.com/u/Giles)\
**Post date:** [February 11, 2015, 3:24pm UTC](https://techcommunity.softwareag.com/t/trailing-space-s-entered-are-not-recognized-in-the-examine-statement/180521/2 "2015-02-11T15:24:28Z")

</div>

I don’t see how you can tell the difference between the default space value for the field and what’s been entered. You could try initialising the whole input field to H’6D’ then examine field for the first occurrence of this value after the user has entered their search value.

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [February 12, 2015, 1:26pm UTC](https://techcommunity.softwareag.com/t/trailing-space-s-entered-are-not-recognized-in-the-examine-statement/180521/3 "2015-02-12T13:26:32Z")

</div>

Here is the code:

DEFINE DATA LOCAL  
1 #STRING (A30)  
1 #POS (N2)  
END-DEFINE  
\*  
MOVE ALL H’6D’ TO #STRING  
INPUT ‘ENTER #STRING HERE==\>’ #STRING (AD=M)  
EXAMINE FULL #STRING FOR H’6D’ GIVING POSITION #POS  
WRITE ‘=’ #POS  
END

You want position, not length which would be 30 for my code above.

NOTE: this will not work on PC Natural, which nulls out an AD=M field when anything is entered in the field

---

<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:** [April 2, 2021, 3:32pm UTC](https://techcommunity.softwareag.com/t/trailing-space-s-entered-are-not-recognized-in-the-examine-statement/180521/4 "2021-04-02T15:32:51Z")

</div>


