IF

IF <expr>

   <statements to execute if true>

ELSE

   <statements to execute if false>

ENDIF

IF allows for the flow of control within a command file based on various conditions that can be tested. Refer to Command Files for more information.

Example

Here is a simple example of a DO file that takes a filename argument. If the file (with a BAS extension) does not exist, it is created by making a copy of a file called applib:stdhdr.txt. Then, in either case, the file is VUE’d.

IF LOOKUP("$0.BAS") = 0

   COPY $0.BAS=APPLIB:STDHDR.TXT

ENDIF

VUE $0.BAS