Usha,
M is very strict about interpreting logic
sequences and about evaluating each separate element and operator. In your
first statement M does something like this:
$L(X) is 6, is 6 greater than 30? No, so that
evaluates False or 0. Now OR that with $L(X) which is 6, giving 0 OR
6. 0 is False, 6 is True, so result is True or 1. Now is 1 less than
6? Yes, so whole logic equation evaluates as True and we Write
"Done.
The solution to making it perform as
intended is to use parentheses:
>S X="0115LV" I ($L(X)>30)!($L(X)<6) W
"DONE"
For the sake of pure logic, you don't need
the parentheses around $L(X)>30 but using them helps clarify the intent
to the next programmer that reads it.
tjh From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Usha Sent: Tuesday, October 25, 2005 7:25 AM To: hardhats-members@lists.sourceforge.net Subject: [Hardhats-members] M statements Hi
Just wondering what brings in the difference in
output of the following statements
EHR 3f0>S X="0115LV" I $L(X)>30!$L(X)<6 W
"DONE"
DONE EHR 3f0>S X="0115LV" I $L(X)<6!$L(X)>30 W "DONE" EHR 3f0> Why does the respond in the way it is?
Usha |
- [Hardhats-members] M statements Usha
- Re: [Hardhats-members] M statements steven mcphelan
- RE: [Hardhats-members] M statements Holloway, Thomas (EDS)
- RE: [Hardhats-members] M statements Robert DeWayne
- RE: [Hardhats-members] M statements Pringle, Duncan