HP 3000 Manuals

TOPIC: STATEMENT SYNTAX [ USING VPLUS/V AN INTRO. TO FORMS DESIGN Self-Paced Training Guide ] MPE/iX 5.0 Documentation


USING VPLUS/V AN INTRO. TO FORMS DESIGN Self-Paced Training Guide

TOPIC: STATEMENT SYNTAX 

Now that you have entered some edit statements and looked at examples of
others, you should be getting familiar with their format.  Basically,
there is the statement name followed by some sort of value or pattern.
This basic format of the FORMSPEC edit statements is shown in the syntax
diagram below.  Notice that you also have the option of specifying a
custom error message (errormsg) with an edit statement.  Before you
finish entering the edit statements used in this exercise, read the
following discussion of the value, pattern, and error message parameters
used with FORMSPEC edit statements.

Syntax of the FORMSPEC Edit Statements 

MINLEN value ["errormsg"]

{GT}
{LT}
{GE}
{LE} value ["errormsg"]
{EQ}
{NE}

{IN } {value[,value]...                          }
{NIN} {lowvalue:highvalue[,lowvalue:highvalue]...} ["errormsg"]
      {value[,lowvalue:highvalue]...             }

MATCH pattern ["errormsg"]

The Value Parameter 

Values used in comparisons may be constants, field names, or expressions.
Examples of these are:

constants                    Includes values such as "JONES", 123.56,
                             !9/1/86!, $TODAY, $LENGTH or $EMPTY

fieldnames                   such as ORDNUM, QTY or NAME

expressions                  such as 5+10, QTY*UPRICE or 6%TPRICE

Constants.  Constants are divided into categories corresponding to the
three main data types:  character, numeric, and date.  Character type
constants must be enclosed within quotation marks and date constants
between exclamation points.  In addition, there are four system-defined
constants:

$TODAY means today's date and is a date type constant, which means the
DType must be MDY, DMY, or YMD.

$LENGTH means the current field length and is a numeric constant, which
means the DType must be one of the numeric data types, DIG, NUM, or IMP.

$EMPTY means a null value and can be any data type.

$STATE means a two-character abbreviation (upper or lowercase) of the
state code for one of the 50 states or 5 territories of the United
States.  It is a character type constant.  The state codes are contained
in a special table provided by VPLUS/V and are listed in Appendix F of
the VPLUS/V Reference Manual.

The system-defined constants must be compatible with the data type of the
field to be edited.

Expressions.  Expressions can be formed only with numeric data types, and
can only use the operators shown in Table 4-3.

          Table 4-3.  Operators 

---------------------------------------------------------------------------------------------
|                                |                                                          |
|               +                |                         addition                         |
|               -                |                       subtraction                        |
|               %                |                         percent                          |
|               *                |                      multiplication                      |
|               /                |                         division                         |
|                                |                                                          |
---------------------------------------------------------------------------------------------

The Pattern Parameter 

The MATCH statement pattern allows you to group characters and to repeat
single or grouped characters.  Grouping is indicated by pairs of brackets
or braces; repetition by following the character or grouped characters by
a plus (+) or asterisk (*) character.  The pattern control characters are
shown in Table 4-4.  The choice of symbols depends on whether a character
or group of characters can be omitted or not.  However, leading and
trailing blanks are not allowed in a MATCH pattern.

You can also specify that the pattern include a specific character such
as the hyphen shown in the example above.  If you want to include any of
the pattern control characters as a specific character, you must precede
it by an exclamation point (!).  For example:

MATCH !a???c     Value must start with the letter a followed by any three
                 characters, and then the letter c.

MATCH a???c      Value must start with any upper or lowercase letter
                 followed by any three characters and then the letter
                 lowercase c.

          Table 4-4.  Pattern Control Characters 

--------------------------------------------------------------------------------------------
|                 |                                                                        |
|    Character    |                                Meaning                                 |
|                 |                                                                        |
--------------------------------------------------------------------------------------------
|                 |                                                                        |
| a               | upper or lowercase letter of alphabet (A-Z,a-z)                        |
|                 |                                                                        |
| u               | uppercase letter of alphabet (A-Z)                                     |
|                 |                                                                        |
| l               | lowercase letter of alphabet (a-z)                                     |
|                 |                                                                        |
| b               | blank (must not be specified as first or last character of pattern)    |
|                 |                                                                        |
| d               | any digit (0-9)                                                        |
|                 |                                                                        |
| ?               | any character                                                          |
|                 |                                                                        |
--------------------------------------------------------------------------------------------

The Error Message Parameter 

A custom message is any series of up to 80 characters enclosed within
quotation marks.  The message should follow the field edit statement,
either on the same line or a following line, and must precede any
subsequent processing statements.

[]
Figure 4-6. Field Menu for STATE in the ORDER Form


MPE/iX 5.0 Documentation