Alastair:

The following code runs fine; when you trace it, it goes through all the
lines correctly. Obviously, if you change the definition of the variables so
the IF condition will not be met, it skips to the ENDIF statement.

SET VAR vReloadBackup = 'Reload'
SET VAR vDBtoCopy = 'MenuData test'
SET VAR vOutPut_file = 'F:\test'
IF vReloadBackUp = 'Reload' +
   AND vDBtoCopy    CONTAINS 'MenuData' +
   AND vOutPut_File CONTAINS 'F:' THEN
   SET VAR vMessage = 'Insert the MenuData Zip disk now!'
   SET VAR vCaption = 'Waiting...'
   SET VAR vButton  = 'Continue...'
--   RUN D:\DBCOPY\SOURCE\MultiDat\Pause_Sub.CMD USING 2 CONFIRM 0
ENDIF
-- RUN LaunchBackUp.CMD

I have obviously not run the RUN commands
Javier,

Javier Valencia, PE
President
Valencia Technology Group, L.L.C.
14315 S. Twilight Ln, Suite #14
Olathe, Kansas 66062-4578
Office (913)829-0888
Fax (913)649-2904
Cell (913)915-3137
================================================
Attention:
The information contained in this message and or attachments is intended
only for the person or entity to which it is addressed and may contain
confidential and/or privileged material.  Any review, retransmission,
dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient
is prohibited. If you received this in error, please contact the sender and
delete the material from all system and destroy all copies.
======================================================

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Alastair Burr
Sent: Wednesday, August 18, 2004 5:02 PM
To: RBG7-L Mailing List
Subject: [RBG7-L] - Re: IF... THEN query

Thanks, Javier & David.

If I use this code then the run command at the end just seems to "hang":

  IF vReloadBackUp = 'Reload' +
        AND vDBtoCopy    CONTAINS 'MenuData' +
        AND vOutPut_File CONTAINS 'F:' THEN
      SET VAR vMessage = 'Insert the MenuData Zip disk now!'
      SET VAR vCaption = 'Waiting...'
      SET VAR vButton  = 'Continue...'
      RUN D:\DBCOPY\SOURCE\MultiDat\Pause_Sub.CMD USING 2 CONFIRM 0
    ENDIF
    RUN LaunchBackUp.CMD

However, this version seems to work:

    IF vReloadBackUp = 'Reload' THEN
      IF vDBtoCopy CONTAINS 'MenuData' THEN
        IF vOutPut_File CONTAINS 'F:' THEN
          SET VAR vMessage = 'Insert the MenuData Zip disk now!'
          SET VAR vCaption = 'Waiting...'
          SET VAR vButton  = 'Continue...'
          RUN D:\DBCOPY\SOURCE\MultiDat\Pause_Sub.CMD USING 2 CONFIRM 0
        ENDIF
      ENDIF
    ENDIF
    RUN LaunchBackUp.CMD

I can't see any reason or difference. Obviously, I have a work-around but it
would be nice to know what's happening.

TRACE doesn't even seem to "see" the first version. It's as if there is a
bracket or quote missing but it "sees" the second version quite normally
(with no other changes).

Regards,
Alastair.


Alastair:
I have been doing this for years without any problems.
Javier,
----- Original Message -----
From: David M. Blocker
To: RBG7-L Mailing List
Sent: Wednesday, August 18, 2004 8:52 PM
Subject: [RBG7-L] - Re: IF... THEN query


Alastair

Either is fine, but it depends on the logic

For example, if x=1 and y=2 you do one action, but if x=1 and y <>2  you do
a different, you'd do this:

IF X = 1 THEN
  IF Y = 2 THEN
    -- actions for x=1 and y=2
  ELSE
   -- actions for x=1 and y<>2
  ENDIF
ENDIF

But if the actions are ONLY done if both conditions are met and there is no
alternative action, then this is fine

IF X = 1 AND Y = 2 THEN
  -- actions
ENDIF

David Blocker
[EMAIL PROTECTED]
781-784-1919
Fax: 781-784-1860
Cell: 339-206-0261
----- Original Message -----
From: Alastair Burr
To: RBG7-L Mailing List
Sent: Wednesday, August 18, 2004 1:44 PM
Subject: [RBG7-L] - IF... THEN query


Is it permissible to combine conditions with AND in the statement like this:

IF x=1 AND y=2 THEN
...
ENDIF

or is it better to break it into two parts:

IF x=1 THEN
  IF y=2 THEN
...
  ENDIF
ENDIF

I don't remember having any problems in the past but one particular piece of
code seems only to work the second way at the moment and I can't find any
other error.

(This is an error that's been around for a while so it's not an upgrade
problem.)

Regards,
Alastair.

----------------------------------
A D B Burr,
St. Albans, UK.
----------------------------------
[EMAIL PROTECTED]
----------------------------------

Reply via email to