Define META Commands

All Define related meta commands.

DEFINE

DEFINE @keyword <option>

Creates keywords which can be used to instruct a program to read a file, a DB entry or command(s). Enter the variable from the command line of a program preceded by the at sign (@).

Valid Options

  • Command
  • &specfile
  • &&dbentry
  • Text

Once a keyword is assigned to some operation, it can be used at any time during a program session to execute the operation. The keyword is not case-sensitive.

EXAMPLE:

>DEFINE @HEADER &header
Where &header is a file containing PREPARE header statement options: 
ERROR_BEEP,ALLOW_ABORT,SPEC_WIDTH=132,&

EXAMPLE:

[STUDY1,1000,”study comment”,&
@HEADER
]

You could create a file of definitions for specifications you use often, and either read this file in at the top of your specifications file or put it in the either the INITIAL or MENTINITIAL files which are read each time you access a Survox program. These files are located in the cfmc/control directory or group.

EXAMPLE:

>DEFINE @STUDY sample

Define the study name at the top of your specifications file, then reference @STUDY in place of the study name on any META or TILDE command throughout your file.

You can append letters and/or numbers to @STUDY on a particular command, e.g., >PRINT_FILE @STUDY~2 to open the print file SAMPLE2.PRT. The tilde (~) delimiter is required.

To revoke definition of a keyword use >-DEFINE @keyword.

See also >SHOW_DEFINES to display a list of all defined keywords.

>Define can also be used to do simple math to set the value of other defines.

EXAMPLE:

>DEFINE @TEXTSTART 7001
>DEFINE @LASTDATA = TEXTSTART - 1
>echo @LASTDATA “will echo 7000”

NOTE:  The “=” sign after the define. You can use other defines and any math statements in the defined variable (+. -, /, *).

Another option is to use two (@@) at signs:

The syntax is:

>DEFINE @@name string

This stores the string in a DB file (must be opened ReadWrite) with the specified name (14-character limit).

By default, defined items are not expanded when they appear inside a quoted string.

Use >FILL_DEFINES_INSIDE_QUOTES to have define items expand.

See also >IF_DEFINED, and >SHOW_DEFINES.

ECHO_DEFINES

Shows the assignment of the defined keywords in the list file. The default is >-ECHO_DEFINE.

EXAMPLE:

The following lines in a spec file:

>ECHO_DEFINES
>DEFINE @STUDY Gemini
>PRINT_FILE @STUDY
>USE_DB @STUDY

Would generate these lines in a list file:

>DEFINE @STUDY Gemini
>PRINT_FILE @STUDY
(after define) >PRINT_FILE Gemini
>USE_DB @STUDY
(after define) >USE_DB Gemini

FILL_DEFINES_INSIDE_QUOTES

Expands @define items when they appear inside a quoted string. The default is that they are not expanded.

EXAMPLE:

>DEFINE @month March
PRINT "This is the report for @month"

would print:

This is the report for March.

SHOW_DEFINES

SHOW_DEFINES <option>

Lists keywords (created with >DEFINE) and their definitions.

Valid Options

  • * – Lists all keywords and definitions.
  • keyword – Lists only the keyword specified. The at sign (@) must not be specified as part of the keyword.
  • letter*letter – Lists all keywords beginning with the first letter and having the second letter somewhere in the name.

EXAMPLE:

>SHOW_DEFINES MENU

Also see >DEFINE.

IF_DEFINE

IF_DEFINE @keyword

Says that if the @keyword is defined, then do what comes next. Requires an >END_IF command to end the IF block, and allows an >ELSE command to do actions if the statement is not defined. Use this as a conditional statement to control branching in a spec file.

ELSE

ELSE @keyword

Controls the spec file execution; It gets specified after an >IF_DEFINE command. This allows you to specify actions to occur if the >IF_DEFINE condition is not true. You can specify the @keyword on the >ELSE line to be sure you are in the right nested block of the >IF_DEFINE.

EXAMPLE:

>DEFINE @a command
>IF_DEFINE @a
specs or another meta command
>ELSE @a
specs or another meta command
>END_IF

ELSE_IF

ELSE_IF @keyword

Allows you to specify another defined @keyword within a >IF_DEFINE @keyword block as a condition for executing what comes next.

END_IF

END_IF @keyword

Ends the IF block begun with >IF_DEFINE. To ensure that you are ending nested IFs correctly you can specify the @keyword specified on >IF_DEFINE on the >END_IF. If the keywords do not match you will get an error.

IF/ELSE/ENDIF

Says that if the expression is true, do the following commands, otherwise skip them. You may use nested >IF blocks and may use it in conjunction with the >IF_DEFINE command. You may use this with defined keywords as well to check the value of the keyword.  See >ELSE, >ELSEIF, and >ENDIF META commands above.

NOTE: You will need to set >FILL_DEFINES_INSIDE_QUOTES to use this option with defined keywords.

EXAMPLE:

>IF “@Prodtype” = “Software”
{ PRODUCTS:
Enter the name of the software products you use.
!TEXT }
>ENDIF

NOTE1: Use = or <> to compare strings.

NOTE2: For numeric comparisons, use =, <>, >, <, >=, or <=.

NOTE3: You can use “AND” and “OR” for complex expressions.