# How ask if a variable is uppercase

**URL:** <https://techcommunity.softwareag.com/t/how-ask-if-a-variable-is-uppercase/76606>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [April 23, 2008, 11:58pm UTC](https://techcommunity.softwareag.com/t/how-ask-if-a-variable-is-uppercase/76606 "2008-04-23T23:58:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbrossi](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@mbrossi](https://techcommunity.softwareag.com/u/mbrossi)\
**Post date:** [April 23, 2008, 11:58pm UTC](https://techcommunity.softwareag.com/t/how-ask-if-a-variable-is-uppercase/76606/1 "2008-04-23T23:58:42Z")

</div>

How can I ask if a alfanumeric variable is UPPERCASE or LOWERCASE ?

Thanks for the Help. :?:

---

<div class="post-metadata">

**Author:** ![Jerome\_LeBlanc](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jerome_leblanc/32/111_2.png) [@Jerome\_LeBlanc](https://techcommunity.softwareag.com/u/Jerome_LeBlanc)\
**Post date:** [April 24, 2008, 1:20am UTC](https://techcommunity.softwareag.com/t/how-ask-if-a-variable-is-uppercase/76606/2 "2008-04-24T01:20:05Z")

</div>

How about:

```auto
move field to hold
examine hold and translate into upper
if field = hold
   /* field is upper case
   ...
end-if
```

---

<div class="post-metadata">

**Author:** ![mbrossi](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@mbrossi](https://techcommunity.softwareag.com/u/mbrossi)\
**Post date:** [April 24, 2008, 2:34am UTC](https://techcommunity.softwareag.com/t/how-ask-if-a-variable-is-uppercase/76606/3 "2008-04-24T02:34:17Z")

</div>

Thanks a lot for the tip Jerome !!!

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [April 24, 2008, 11:19am UTC](https://techcommunity.softwareag.com/t/how-ask-if-a-variable-is-uppercase/76606/4 "2008-04-24T11:19:44Z")

</div>

Use the MASK operand:

```auto

if field = MASK(UUUU)
  then write 'uppercase'
end-if
if field = MASK(NNNN)
  then write 'numbers'
end-if
```

If you just want to verify if it is numeric, suitable for use in an INPUT statement or VAL function, use

```auto

if field is (n5)
  #num := val(field)
end-if
```

---

<div class="post-metadata">

**Author:** ![Jerome\_LeBlanc](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jerome_leblanc/32/111_2.png) [@Jerome\_LeBlanc](https://techcommunity.softwareag.com/u/Jerome_LeBlanc)\
**Post date:** [April 24, 2008, 7:51pm UTC](https://techcommunity.softwareag.com/t/how-ask-if-a-variable-is-uppercase/76606/5 "2008-04-24T19:51:49Z")

</div>

The uppercase mask works unless there are blanks in the variable.

mbrossi, the best way to find out how something works, after reading the Natural manual, is to try it for yourself in an ad-hoc program, like…

```auto
DEFINE DATA LOCAL
1 #A (A6)
END-DEFINE
*
MOVE 'ABC DE' TO #A
REPEAT
   INPUT #A (AD=MI'_')
   IF #A = ' ' 
      STOP
   END-IF
   IF #A = MASK (UUUUUU)
      WRITE 'UPPER CASE'
   ELSE
      WRITE 'NOT UPPER CASE'
   END-IF
END-REPEAT
END
```

Happy coding!

---

<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, 2:49pm UTC](https://techcommunity.softwareag.com/t/how-ask-if-a-variable-is-uppercase/76606/6 "2021-04-02T14:49:24Z")

</div>


