DESL


DESL Home | Website Outline | Commands | Examples | Download | Contacts

( BB) Details concerning the DESL if command.


(See example(s) of the use of the if command.)
[Jump to the list of available options.]
General description of the if command :

The DESL "if" function is a special function which serves to logically determine whether a block of DESL commands will be executed or not. It is a "conditional" command which is a part of a more complete "if elseif else endif" structure which can be included in any DESL command stream which is NOT being entered in the purely interactive mode; ie, via entry of each command at the keyboard.

The (conditional) arguments associated with the "if" command must begin on the command line and can be continued to one or more subsequent lines via the inclusion of the blank-delimited ampersand symbol (&) as the last item on the line. Up to 10 conditions, separated by conjunctions, can be specified.

If the conditions following the "if", considered altogether, accounting for ALL conjunctions and processing from left to right, are TRUE then any commands immediately following the line containing the "if" command, up to and including the command immediately preceding either the next "elseif", "else", "endif", or the end of input, whichever is encountered first, will be processed.

An "if" block CANNOT be nested within another "if" block. This includes the situation which could arise when a macro, itself containing one or more "if" blocks, is referenced from within an "if" block, since the macro's contents is effectively put inline in the input stream at the point of its mention, whether or not it is actually called.

After processing the pertinent block of commands, control jumps to the command immediately following the closing "endif" statement, OR to the end-of-file if no "endif" is detected.

If one or more of the conditions following the "if", considered altogether, accounting for ALL conjunctions and processing from left to right, are FALSE then control jumps to the next "elseif", "else", or "endif" command, whichever is encountered first. If an "elseif" command has been jumped to, the conditions included in this command are evaluated and processing continues as it did after the evaluation of the opening "if" statement. If an "else" command has been jumped to, any DESL commands immediately following that "else" command, until the next "endif" command, or end-of-file if no "endif" is detected, will be executed, after which control will jump to the command immediately following the closing "endif" command, or to the end-of-file if no "endif" is detected.

An example of two "if elseif else endif" structures which could be be contained in an alternate input file or macro is the following :



reg set *N10 = off
if os = on then
reg set *N10 = on
endif
os on
if *N1 eq run10 and *V7 > 10 then
copy
files run10 newfiles f10 go
elseif *N1 = run11 or *N10 ne nf10 then
copy
files run11 newfiles f11 go
elseif not exist file f12 then
copy
files run12 newfiles f12 go
else
copy
files run12 newfiles nf10 go
endif
os *N10


(See the "register" command for an explanation of the meaning of the register names *N1 --> *N20 and *V1 --> *V20.)

There are two fundamental types of condition syntaxes which can be used :

  1. (else)if cond1 ( [and/or] cond2 ... [and/or] cond10 ) then where, "cond1", etc. represent "conditions".
  2. (else)if (not) exist(s) file(s) fn1 fn2 ... fni then where, "fn1", etc. represent file names

The first type of "(else)if" command evaluates the True/False state of each condition, logically links them, from LEFT to RIGHT, via the expressed conjunction(s) ("and" or "or") and determines an overall True/False state. For this type of "(else)if" command up to ten (10) "conditions" can be referenced.

The second type of "(else)if" command involves checking to see if one or more files either are ALL in existence or are ALL NOT in existence. The resulting True/False state is set accordingly.

Then, for EITHER type of "(else)if" command, based on this resulting state, the following block of commands are processed or skipped.

The structure of a "condition", used in the first type "if(else)" commands, (1) above, can be either of the following :



. [*N# ] [= ] [*N# ] or [*V#] [= ] [*V#]
. [str] [eq] [str] [##] [eq] [##]
. [ne] [ne]
. [ge]
. [gt]
. [> ]
. [le]
. [lt]
. [< ]
where

A condition involves EITHER name-type OR value-type arguments but NOT a mixture of both. An "(else)if" STATEMENT can, however, contain one or more of EACH type of condition. If the "str" character string is one of several strings recognized by DESL as having SPECIAL meaning, then an equivalent new string is substituted for that special string. The special strings defined thus far are the following, accompanied by their possible new (substitution) string(s) and meaning :

special string possible new string(s) meaning
os on, off current overstore state
echo on, off current echo state
[Top][Bottom][Option list]


DESL Home | Website Outline | Commands | Examples | Download | Contacts




ViGYAN, Inc.


DESL Manager at ViGYAN, Inc.

30 Research Drive
Hampton, VA 23666
Voice: (757) 865-1400
Toll Free: (800) 288-3998
FAX: (757) 865-8177

© 1998 ViGYAN, Inc.