logical condition mask(P)

Hi,

Can someone explain me :
If #a ^= mask (p)

Hi Hezi;

P (probably an abbreviation for Printable) includes the four categories U (upper case alphabetic), L (lower case alphabetic) N (numeric) and S (Special Character).

You would have to check with your DBA to see what constitutes your special characters.

As for the ^= . This appears nowhere in the documentation that I can find. Played with it a bit. Seems to be the equivalent of GE, but am not sure yet.

steve

^= is equivalent of
Not Equal
or
Not =
or
<>
or …

The Natural “chameleon syntax” :wink:

Also, NE

I am guessing now; Hezi, was this code in production somewhere?

Very annoying when someone discovers undocumented syntax, then proceeds to use it in production just to appear clever.

Better is to report the syntax to Software AG, who will either document it, or change code so that the undocumented syntax is now illegal. (perhaps there was a reason the syntax was not allowed)

steve

Never heard about that ^-Operator :shock:

To appaer much more clever use the following code instead of a simple EQ-Operator:

if 1 ^> 1 and 1 ^< 1
write 'X'
end-if

:wink:

Hi Steve - you sent me googling :wink:

A qualified guess could be that it is a workaround in connection with NDB ?!

"The DB2 precompiler changes the logical not sign to the circumflex accent because the logical not symbol is a 2-byte character (X’C2AC’) in Unicode, and the circumflex accent is a single byte character (X’5E’) in Unicode. "

from Parser changes the logical not sign character to the circumflex accent character.

Hi Finn;

Thanks; followed your link. I must confess, I do not find <> more readable than NE. Of course, NE is an english abbreviation, and I speak english. I appreciate the fact that programmers who are not fluent in english might prefer a language independent set of operators.

I also use the word “not” rather than the logical not symbol. Reason? The symbol is not on my keyboard. Perhaps that is why the use of ^ is permitted; it is probably on more keyboards (it is on mine) than the logical not symbol.

However, regardless of the philosophy of whether or not ^ should be permitted; if it is permitted, it should be documented.

steve

Hi Steve,
Totally agree it should be documented (or not there at all)

But I have seen it at several of our customers here in the Nordic, so for me it was obvious what it meant - although I would never dream of using it myself :wink:

  • give me “NE” or “<>” anyday - but then again Pascal and COBOL was where I came from before Natural !

But where it originated from was a mystery to me until this morning…
Finn

Perhaps due to my Fortran beginnings, I have always preferred the scientific representations (eg “>=”, “<=”, and “¬=”) to the English abbreviations.

Even before the advent of Natural for Windows, I often used a PC to transfer source code between mainframes (remember diskettes?). This required FTP processes which translated the code from EBCDIC to ASCII and back again. This translation wasn’t strictly necessary, but allowed me to view and verify the code while on the PC platform.

There I discovered that I could not rely on the translation of the “not” character. Windows would see a caret (“^”), and this was not converted back to a “not” upon upload. (Natural for Windows treats the caret as a “not”, so the code compiles.) That is when I began using “<>” instead of “¬=” to mean not equal (NE).

It is nice to see that the caret is accepted on the mainframe (tested with Nat423), eliminating my translation/upload problem, but I don’t recall seeing an announcement of this enhancement in the Release Notes.

It is currently legal and documented:
http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat425mf/pg/pg_furth_lcc.htm#Rel_Expression

I remember using ¬= (not-sign equals) back in Natural 1, particularly since this character wandered off the keyboard when we transitioned from 3270 terminals to PC’s with terminal emulation (and I remember having issues like Ralph cites). We also had to switch to NE at one customer site as the terminal reader for the blind couldn’t handle the not-sign ¬.

So I don’t know that it was never documented back then (anybody have printed manuals around??), but I’m fairly sure it wasn’t just someone being clever!

On a standard US ASCII keyboard, the caret is shift-6, which is just where the not sign was on 3270 keyboards. So at least you didn’t lose your muscle memory.

Hi Douglas;

Followed the link. I could not find ^ anywhere in the table. I did find ¬=.

steve

Back to the original question, you can read an article I wrote last year at:

http://www.naturalconference.com/Nattips/Nat-tip-05-12-2008.html

Also, you don’t have to ask your DBA, mainly because they would be just as surprised as you might be. It is installation dependent; you can test your environment with the following:

DEFINE DATA LOCAL
1 #BIN-CHAR (B1)
1 REDEFINE #BIN-CHAR
2 #ALPHA-CHAR (A1)
1 #X (I2)
1 PRINTABLE (L)
1 SPECIAL (L)
END-DEFINE
*
FOR #X = 0 TO 255
MOVE #X TO #BIN-CHAR
IF #ALPHA-CHAR = MASK(P)
MOVE TRUE TO PRINTABLE
ELSE
MOVE FALSE TO PRINTABLE
END-IF
IF #ALPHA-CHAR = MASK(S)
MOVE TRUE TO SPECIAL
ELSE
END-IF
DISPLAY #X ‘Char’ #ALPHA-CHAR ‘Bin’ #BIN-CHAR
5X PRINTABLE (EM=NO/YES) SPECIAL (EM=NO/YES)
END-FOR
*
END