Actually, "LOOP WHILE LOCATE" is incorrect syntax, and will fail on
compilation. You have to use the PICK flavor of LOCATE to do this.
Still, you are correct in that "LOOP WHILE LOCATE()" works fine, but "IF
LOCATE() THEN" will not compile.
A side note, TRUE.FALSE.FLAG = LOCATE() also will not compile.
However, if instead of using "IF LOCATE() THEN", you simply use "LOCATE()
THEN" it will work.
I realize you were venting, and I must agree in part that it would appear to
present somewhat of an inconsistency, but I can more see why "IF LOCATE()"
would not work, than I can tell you why "WHILE LOCATE()" does work. I would
have expected neither to work.
Hmmm....
See the following three examples.
------------------------------------------------------------
>ED BP TEST.PGM.1
0001: ABC = "A":@FM:"B":@FM:"C"
0002: ABCD = "ABCD"
0003: CNTR = 0
0004: LOOP
0005: CNTR += 1
0006: X = ABCD[CNTR,1]
0007: WHILE LOCATE(X,ABC;POS)
0008: PRINT X:" FOUND."
0009: REPEAT
0010: STOP
>RUN BP TEST.PGM.1
A FOUND.
B FOUND.
C FOUND.
------------------------------------------------------------
>ED BP TEST.PGM.2
0001: ABC = "A":@FM:"B":@FM:"C"
0002: ABCD = "ABCD"
0003: CNTR = 0
0004: FOR CNTR = 1 TO 4
0005: X = ABCD[CNTR,1]
0006: IF LOCATE(X,ABC;POS) THEN
0007: PRINT X:" FOUND."
0008: END ELSE
0009: PRINT X:" was not found."
0010: END
0011: NEXT CNTR
0012: STOP
>BASIC BP TEST.PGM.2
0006 IF LOCATE(X,ABC;POS) THEN
^
';' unexpected, Was expecting: '!', ')', '=', "AND", "OR", "LT", "LE","GT",
"GE", "NE", "EQ", "MATCH"
0008 END ELSE
^
"ELSEEOL" unexpected, Was expecting: END, "NEXT", "UNTIL", "WHILE"
Array 'LOCATE' never dimensioned.
3 Errors detected, No Object Code Produced.
------------------------------------------------------------
>ED BP TEST.PGM.3
0001: ABC = "A":@FM:"B":@FM:"C"
0002: ABCD = "ABCD"
0003: CNTR = 0
0004: FOR CNTR = 1 TO 4
0005: X = ABCD[CNTR,1]
0006: LOCATE(X,ABC;POS) THEN
0007: PRINT X:" FOUND."
0008: END ELSE
0009: PRINT X:" was not found."
0010: END
0011: NEXT CNTR
0012: STOP
>RUN BP TEST.PGM.3
A FOUND.
B FOUND.
C FOUND.
D was not found.
------------------------------------------------------------
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Stuart Boydell
Sent: Sunday, February 08, 2004 11:19 PM
To: U2-Users
Subject: using locate in compound true/false statement
A mild annoyance at some inconsistence using boolesque statements such as
locate. One can use the syntax: loop while locate moon in sky setting sun do
;* a thing of beauty ...repeat
yet cannot use:
if locate spoon in pudding setting jelly then ... ;* food fight!
Just thinking it would be nice if the boolean nature of the first syntax was
applicable with something firmer than the wobbly inconsistency of the
second. </vent>
Regards,
Stuart
**********************************************************************
This email message and any files transmitted with it are confidential and
intended solely for the use of addressed recipient(s). If you have
received this email in error please notify the Spotless IS Support Centre
(61 3 9269 7555) immediately who will advise further action.
This footnote also confirms that this email message has been scanned for the
presence of computer viruses.
**********************************************************************
--
u2-users mailing list
[EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users