Use of Ampersand(&) symbol in IF statement

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

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

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

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

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

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

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.

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! :smiley:

Regards,
Vinodh