# Use of Ampersand(&) symbol in IF statement

**URL:** <https://techcommunity.softwareag.com/t/use-of-ampersand-symbol-in-if-statement/177979>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [August 8, 2014, 11:31am UTC](https://techcommunity.softwareag.com/t/use-of-ampersand-symbol-in-if-statement/177979 "2014-08-08T11:31:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinodh\_k\_r](https://avatars.discourse-cdn.com/v4/letter/v/c67d28/32.png) [@vinodh\_k\_r](https://techcommunity.softwareag.com/u/vinodh_k_r)\
**Post date:** [August 8, 2014, 11:31am UTC](https://techcommunity.softwareag.com/t/use-of-ampersand-symbol-in-if-statement/177979/1 "2014-08-08T11:31:05Z")

</div>

Hi,

While going through a Natural program, came across a statement like

IF & NE ’ ’  
IF & = #BLOCK-CODE  
REINPUT FULL ’ Not valid for Block ’  
END-IF  
END-IF

What does & here refers to?

Can anyone please help me on this. I tried to check in documentation and i found it as \*LANGUAGE which is in no way relevant to my question.

Thanks in advance!

Regards,  
Vinodh

---

<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:** [August 8, 2014, 11:57am UTC](https://techcommunity.softwareag.com/t/use-of-ampersand-symbol-in-if-statement/177979/2 "2014-08-08T11:57:18Z")

</div>

Was the code actually like:

IF &BLOCK NE ’ ’  
IF &BLOCK = #BLOCK-CODE  
REINPUT FULL ’ Not valid for Block ’  
END-IF  
END-IF

In which case &BLOCK is an “ampersand variable”. At compile time, &BLOCK will be replaced by the contents of the global variable +BLOCK.

Was the code in a copycode module and not a program? Was it of the form &1& ? In which case it was an “insertable” argument for the copycode (the first one).

Finally, how sure are you that \*language is not relevant? SCAN the code for \*language and see if someone was moving a value to \*language. Then in a copycode, & would be \*language, and you would be testing for the value last moved into \*language

---

<div class="post-metadata">

**Author:** ![vinodh\_k\_r](https://avatars.discourse-cdn.com/v4/letter/v/c67d28/32.png) [@vinodh\_k\_r](https://techcommunity.softwareag.com/u/vinodh_k_r)\
**Post date:** [August 8, 2014, 12:01pm UTC](https://techcommunity.softwareag.com/t/use-of-ampersand-symbol-in-if-statement/177979/3 "2014-08-08T12:01:54Z")

</div>

Hi Steve,

Thanks for your reply!

The Code was present in VALIDATION part inside NSM file.  
It was just as below.

…  
…  
IF & NE ’ ’  
IF & = #BLOCK-CODE  
REINPUT FULL ‘Not Valid For Block’  
END-IF  
END-IF  
…  
…

---

<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:** [August 8, 2014, 12:07pm UTC](https://techcommunity.softwareag.com/t/use-of-ampersand-symbol-in-if-statement/177979/4 "2014-08-08T12:07:30Z")

</div>

See the updated post which includes the possibility it might be \*language (if it was copycode).

---

<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:** [August 8, 2014, 12:10pm UTC](https://techcommunity.softwareag.com/t/use-of-ampersand-symbol-in-if-statement/177979/5 "2014-08-08T12:10:13Z")

</div>

What are valid values for #block-code? is it numeric?

---

<div class="post-metadata">

**Author:** ![vinodh\_k\_r](https://avatars.discourse-cdn.com/v4/letter/v/c67d28/32.png) [@vinodh\_k\_r](https://techcommunity.softwareag.com/u/vinodh_k_r)\
**Post date:** [August 8, 2014, 12:21pm UTC](https://techcommunity.softwareag.com/t/use-of-ampersand-symbol-in-if-statement/177979/6 "2014-08-08T12:21:22Z")

</div>

Hi Steve,

#Block-Code is Alphabetical type with length 15. (A015)

As said earlier, this part of code is in \*.NSM file which contains Map definition and validation of fields.

Regards,  
Vinodh

---

<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:** [August 8, 2014, 12:55pm UTC](https://techcommunity.softwareag.com/t/use-of-ampersand-symbol-in-if-statement/177979/7 "2014-08-08T12:55:16Z")

</div>

Sorry. I just skipped by that the first time.

In a processing rule, & stands for the field for which the processing rule has been written.

Thus, you could apply a processing rule to several different fields on a map without changing the code (since & would have different meaning in each of the processing rules.

Just a note; a “map” is NOT a program. (Okay, it is a special case of a subprogram; sort of). Which is why I was looking for the problem in the context of a program, subprogram, or copycode.

My fault however, for not picking up on the “NSM file”. “Map” would however, been far more likely to have been picked up, especialy if you said it was in a processing rule.

---

<div class="post-metadata">

**Author:** ![vinodh\_k\_r](https://avatars.discourse-cdn.com/v4/letter/v/c67d28/32.png) [@vinodh\_k\_r](https://techcommunity.softwareag.com/u/vinodh_k_r)\
**Post date:** [August 8, 2014, 1:10pm UTC](https://techcommunity.softwareag.com/t/use-of-ampersand-symbol-in-if-statement/177979/8 "2014-08-08T13:10:00Z")

</div>

Hi Steve,

Thanks a lott in getting me the answer by your quick response!  
My questions might look silly but for those who are new to NATURAL, these type of posts helps a lott rather than documentation.

Once again thanks again! 😃

Regards,  
Vinodh

---

<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:31pm UTC](https://techcommunity.softwareag.com/t/use-of-ampersand-symbol-in-if-statement/177979/9 "2021-04-02T15:31:48Z")

</div>


