THE EDIT SCREEN

Up to 100 lines of Edits may be coded for each
format level, with a maximum of 1000 Edit lines
used for the entire format.  Pressing Ctl+F1 will
switch the Format Generator to the Edit screen.
As each edit line is entered by the operator, the
program will check the Syntax.  This will ensure
that all lines are entered correctly.  The Home,
End, PgUp, and PgDn keys may be used to move
around in the Edit section.  When the Edits have
been completed, press Alt+F10 to switch the
Format Generator back to the Heading or
Attributes screen for that level.

Edits may be performed or executed by the program
at four different times during the cycle of the
Data Entry Program.  The four different times
are:

  -  At the beginning of the record, before it is
     displayed on the screen.

  -  After each field is entered by the operator.

  -  After the last field is entered by the
     operator, or the Rec Adv key is pressed, but
     before the record is written to the disk.

  -  At the end of the record, after the record
     has been written to the disk.

As you code your edits, you will decide when the
edit should take place, and code a label to tell
the program when to execute it.  The labels are:

     *BOR:     Beginning of the Record.
     field-id: After a field is entered.
     *ALF:     After the last field.
     *EOR:     End of the record.

In the example below, the first two edit lines
are executed when the operator keys the Employee
Number field (EmpNr:), and the last four edit
lines are executed after the last field is
entered on the data entry screen (*ALF:).

     Empnr: IF Empnr IN **F1 THEN SET Trade=*EF1
     ELSE WARN 'Missing Employee Number'

     *ALF: IF *VERIFY THEN EXIT
     IF Shift<>3 THEN EXIT
     IF Trade IN **T3 THEN EXIT
     WARN ON Trade 'Not a Shift 3 Trade!'

*BOR:     Beginning of the Record

Edits with this label are executed before a
record is displayed on the screen.  The most
common use for these edits will be to preset
fields, or to clear field totals or work fields
for a new set of records.  You can also check the
data on existing records (in Update mode) to
switch format levels, if desired.  If any changes
are made to the record number (by setting *RN),
or if RECADV or RECBKSP is performed, the current
record will never be displayed to the operator.
ERROR and WARN statements do not work in *BOR:
edits.

field-id: After a Field is Entered

These edits are performed immediately after the
operator keys the specified field.  This is the
place that you would normally code individual
field edits, to validate the data.  The operator
will be immediately notified of any error
conditions.

Note: These edits are only performed when the
operator exits a field.  This means that if the
operator leaves a field blank by pressing the
Field Advance key instead of keying any data for
the field, the edit for that field will not be
executed.  Also, if the operator presses the
Record Advance key, all fields that have not been
entered yet, will never have their edits
executed.  For this reason, Mandatory Entry type
of edits should not be performed at this time,
they should be placed with the *ALF: edits.

*ALF:     After the Last Field

Edits that follow this label are performed after
the last field is entered, or after the operator
presses the Record Advance key.  This is the
normal place to code field to field comparisons,
and terminal error type conditions.  ERROR or
WARN statements should specify which field to
place the cursor on, otherwise the cursor will be
placed on the first unprotected field on the
screen.  Normally, you should not do any format
level or record number changes in a *ALF: edit.
If you do, the current record will never be
written to disk.

These edits are always performed before a record
is written to disk.  The operator cannot key,
change, or verify any record without going
through these edits.  They are executed
repeatedly until the operator has corrected all
errors, then the record is written to the disk.
During a record advance in Update mode, however,
if no fields were keyed or changed, then the
*ALF: edits are bypassed.

*EOR:     End of the Record

Edits that follow this label are only executed
once per record as you Enter, Update, or Verify
the file.  It is performed at the end of the
record, after any Field Totals are accumulated,
after any Storage Fields are updated, and after
the record is written to the file.  If no changes
were made to a record during a Record Advance,
this edit is still performed.  This is where you
would normally code any format level changes for
the following record.  It can also be used to
check or reset Field Totals or other Work Fields.
ERROR, WARN, GOTO, RECADV, and RECBKSP
statements should not be used here.  Also edits
that set any field that was on the screen would
have no function, as the record has already been
written to the disk.

THE EDIT STATEMENTS

Statements are keyed on each line with the
following syntax:

     [label:] statement[; statement ...]

Please keep the following coding rules in mind:

  -  Items in square brackets [] are optional.
  -  An ellipsis (...) indicates that an item can
     be repeated.
  -  Items in braces {} indicate that one of the
     values inclosed within the braces must be
     coded.
  -  Words in capital letters are keywords and
     must be entered as shown, except that they
     can be entered in any combination of upper
     and lower case letters.  The Format
     Generator will automatically convert letters
     to uppercase where needed.

There are 11 different edit statements that you
can use to direct the program with:

     CLEAR
     ERROR [ON]
     EXIT
     FIND   IN
     GOTO
     IF   THEN  [ELSE]
     JUMP
     RECADV
     RECBKSP
     SET
     WARN [ON]

CLEAR variable[,variable ...]

This statement is used to zero or blank out any
variable.  See "Edit Variables" later in this
section, for a list of the valid variables.

Example:  CLEAR *FT1,*FT2,*WF1,EmpNr

ERROR [ON field-id] 'error message'

This statement is used to signal an error to the
operator.  An ERROR statement causes the program
to exit the edits.  The program will return to
allow the operator to correct the field.  The
error must be corrected before the program will
allow the operator to continue.  The operator
will not be able to override the error with the
Alt+F9 key.  Use the WARN statement, if this is
desired.

The message in single quotes is displayed to the
operator at the bottom of the screen.  The
optional ON field-id parameter will direct the
cursor to a particular field.  If not specified,
the cursor will be placed at the beginning of the
current field.

Example:  IF Qty=0 THEN ERROR 'Qty is zero'

EXIT

This statement terminates the edits and returns
the program back to its regular cycle as if there
were no more edits to be executed.  You normally
use an EXIT statement to prevent edits from being
performed under certain conditions.

In the following example, the second line will
never be executed in Update mode:

     IF *UPDATE THEN EXIT
     SET *WF1=EmpNr

FIND variable IN file

This statement is used to look up a record in an
External File, defined in the Table section.  If
the record is found, any External Fields that
were defined for the file will be loaded with the
data found in the record.  The variable used in
the statement must be the "key" to the External
File.  This statement does not report back to the
program if the record does not exist in the file.
It will simply leave all of the External Fields
unchanged.

Example:  FIND EmpNr IN **F1

If you wish to determine if a record exists or
not, you must use an IF statement, which will
also load any External Fields.  The IF statement
below, looks up a record in an External File.  If
the record is found, any External Fields are
loaded.  If the record is not found, the
statement following the THEN keyword is
executed.

     IF EmpNr NI **F1 THEN WARN 'Not in file'

GOTO field-id

This statement is used to cause the cursor to
jump to a particular field.  Using the GOTO
statement, the order that fields are processed on
the screen can be changed.  The GOTO statement
causes the program to exit the edits.  The
program returns to the data entry screen to allow
the operator to enter the field named.

In the following example, the cursor will jump
from the Employee Number field to the Regular
Hours field whenever the Employee Number is left
blank:

     EmpNr: IF EmpNr=' ' THEN GOTO RgHrs

IF logical-expression THEN clause [ELSE clause]
     -or-
IF logical-expression THEN clause
ELSE clause

An IF statement is used to make a decision
regarding program flow based on the result of a
logical expression.  If the logical expression is
true, the THEN clause is executed.  THEN is
followed by one or more statements to be
executed.  If the logical expression is false,
the optional ELSE clause is executed.  The
optional ELSE clause may be placed on the current
line or on the following line and is followed by
one or more statements to be executed.  See
"Expressions" later in this section for more
information.

Please note that once an IF statement occurs on a
line, everything else on that line is part of the
IF statement.  IF statements can be nested,
however, any ELSE clause will be executed by
either IF statement that has a false logical
expression.  Nesting is limited only by the
length of the line.  For example:

     IF A=B THEN IF B=C THEN EXIT
     ELSE ERROR 'A<>B or B<>C'

JUMP #-of-lines

This statement branches out of the normal program
sequence to a specified edit line.  #-of-lines is
the # of lines to jump to.  It can be negative as
well as positive or even 0.

JUMP -1 will jump to the previous line.  JUMP 0
will jump to the beginning of the current line.
JUMP 1 will jump to the next line, and so on.

Using the JUMP statement you will be able to set
up loops in the edit code.  You may also set up
code that is performed by more than one process.
Then use a JUMP statement to get to the code
whenever it is supposed to be executed.

In the following example, the program will jump
to the fourth edit line (SET *WF1=CODE) if the
Code field is blank or greater than 200:

     Code: IF Code=' ' THEN JUMP 3
     IF Code>200 THEN JUMP 2
     ERROR 'Code is not blank or > 200'
     SET *WF1=Code

RECADV or RECBKSP

These statements will cause the program to
perform a Record Advance or a Record Backspace
just as if the operator had pressed the Rec Adv
key or the Rec Bksp key.

If these statements are executed in a *BOR: edit,
the record will not be shown to the operator.  If
the RECADV statement is performed in a field-id:
edit, the *ALF: edits will still be executed
before the record is written to disk.  The
RECBKSP statement will prevent any changes that
may have been made on the current screen from
being recorded in the file.

In the following example, several records will be
automatically created (based on a value that is
placed in Work Field #1).  The records are not
actually shown to the operator:

*BOR: IF *WF1>0 THEN SET *WF1=*WF1-1; RECADV

SET variable=arithmetic-expression

Assigns the value of an arithmetic expression to
a variable.  See "Expressions" later in this
section for more information.

Example:  SET *WF1=Qty*Price

WARN [ON field-id] 'error message'

This statement is used to signal a warning error
to the operator.  A WARN statement causes the
program to exit the edits.  The program will
return to the data entry screen to allow the
operator to correct the field.  The warning must
be corrected or overridden before the program
will allow the operator to continue.  The
operator may press the Alt+F9 key (Accept with
Error) to override a warning error condition.

The message in single quotes is displayed to the
operator at the bottom of the screen.  The
optional ON field-id parameter will direct the
cursor to a particular field.  If not specified,
the cursor will be placed at the beginning of the
current field.

Example:  IF Qty=0 THEN WARN 'Qty is zero'

EDIT VARIABLES

A list of the valid edit variable names and their
descriptions follow:

field-id  Any field described on the display
          screen may be used as a variable.

'Constant'     Surround alphabetic constants with
               single quotes.

value     Numeric values may be positive or
          negative.  Place a minus sign prior to
          the number for negative values.
          (Ex: -25)

*BTn      Balance Totals; the 9 different balance
          totals may be set or tested.  "n" may
          be 0-9.  *BT0 is the total record
          count.  If *BT0 is set to any value
          other than 0, then the total record
          count must match this figure before
          *BALANCE will be considered TRUE.

*DMY      Current Date; in the DDMMYY format.
          The current date may be tested or set.
          Setting *DMY will affect *MDY and
          *YMD.

*DUP      You may set or test *DUP for an ON or
          OFF state.  *DUP is the same as
          Dup/Skip mode that is set by pressing
          F1.

*EFnn     External Field; defined in the Table
          section.  "nn" may be 0-29.  These
          fields are set automatically when you
          look up a record in an External File,
          using IF-IN, IF-NI, or FIND-IN
          statements.

*FM       Format Level; the current format level
          that is being displayed.  Setting the
          format level will cause an immediate
          reaction to the current record before
          it is written to disk, for all edits
          except *EOR:.  The format level is set
          for the next record in *EOR: edits.

*FMN      Format Name; the current format name.
          This is an 8 character long name which
          identifies the format that is being
          used.  You may not change this
          variable.

*FN       File Name; the name of the current
          file.  This is an 8 character long name
          which identifies the file being keyed
          into.  You may not change this
          variable.

*FTn      Field Totals; the 10 different field
          total accumulators may be set or
          tested.  "n" may be 0-9.  *FT0 is the
          total record count.

*MDY      Current Date; in the MMDDYY format.
          The current date may be tested or set.
          Setting *MDY will affect *DMY and
          *YMD.

*OFF      This is used for setting or testing
          *DUP for an OFF state.

*ON       This is used for setting or testing
          *DUP for an ON state.

*OPR      Operator ID; This is a 3 character long
          field containing the User-ID of the
          operator that is currently signed on.
          You may not change this variable.

*RN       Record Number; the current record
          number may be set or tested.  Setting
          the record number will cause an
          immediate reaction, before the current
          record is written to disk, for all
          edits except *EOR:.  In *EOR:  edits,
          the current record is written first
          then the next record number set to the
          value specified.

          If you attempt to set a value into the
          record number that is greater than the
          last record that exists in the data
          entry file, then the program will set
          the record number to the next available
          record number.

*SFn      Storage Field; these 10 fields are the
          same Storage fields that you can define
          in the Prefill column of the Format
          Generator.  "n" may be 0-9.

*SPnnn    Start Position; any character in the
          data entry record may be tested or set.
          "nnn" may be 1-1024 but not larger than
          the record length.  When setting data
          into a start position, the entire
          variable will be placed in the record
          starting at the specified position.

*TIME     Time; in the HHMMSS format.  This is a
          6 digit number that contains the
          current time based on the 24 hour time
          system.  If you wish to use only HHMM
          with no seconds, simply divide the
          field by 100.  All results are
          truncated to whole numbers.  You may
          not change this variable.

*WFnn     Work Field; these fields may be used to
          store values temporarily, then used or
          tested later in the program.  "nn" may
          be 0-29.

*YMD      Current Date; in the YYMMDD format.
          The current date may be tested or set.
          Setting *YMD will affect *DMY and
          *MDY.

**Fn      External File; cannot be set or tested.
          This variable is used in FIND or IF
          statements to look up records in a
          file.  The file must be defined in the
          Table section.  "n" may be 0-9.

**Tn      Table; cannot be set or tested.  This
          variable is used in IF statements to
          look up fields in an internal table.
          The table must be defined in the Table
          section.  "n" may be 0-9.

SUBSTRING FUNCTION

A substring function produces a character string
that is a subset of an existing string.  It may
be used on any variable in an IF statement, or on
any variable to the right of the equal sign in a
SET statement.  The format of the substring
function is:

variable-name(starting-position, length)

The substring function produces a substring from
the contents of the variable specified.  It
begins at the specified starting position (which
can be a variable name) and continues for the
length specified (which can be a variable name).
Neither the starting position nor the length can
be 0, negative, or larger than the original
field.

Example:  SET *WF1=Code(2,1)

EXPRESSIONS

There are two different types of expressions that
you may use.  Arithmetic expressions in a SET
statement are used to generate arithmetic results
that will be placed in another variable.
Logical expressions in an IF statement are used
to compare one variable to another.

ARITHMETIC EXPRESSIONS:

variable[operator variable ...]

An arithmetic expression can be a constant, a
numeric value, a variable, or a single value
obtained by combining constants, values, and
variables with operators.  Operations are
executed in the order they are coded on the edit
line, from left to right.

Arithmetic Operators:

     +    Addition.
     -    Subtraction.
     *    Multiplication.
     /    Division.
     |    Concatenation.

All arithmetic results are truncated to whole
numbers.  Any fractional portion of a result is
dropped.  (Ex: 8/3 will yield 2).

Examples:

     SET *WF1=RgHrs+OtHrs*2.45
     SET *WF2='FILE'; SET *WF3=*WF2|'NAME'

In the first example, Work Field #1 is assigned
the result after summing the fields RgHrs and
OtHrs then multiplying the result by (2.45).

In the second example, Work Field #2 is assigned
the value 'FILE', then Work Field #3 is assigned
the value 'FILENAME' which is the combination of
two variables.

LOGICAL EXPRESSIONS:

variable operator variable[,variable ...]
variable {IN,NI} {table,file}[,{table,file} ...]
mode[,mode ...]

Logical expressions may be coded in one of three
different forms, as shown above.  Each form will
return a true or false value to be used in making
a decision.

In the first form, the expression uses logical
operators to compare one variable to one or more
other variables.  One variable may be placed on
the left side of a logical expression, but
multiple variables may be placed on the right
side of the expression, separated with commas.
Each variable will be compared to the first
variable to see if the expression is true.  Only
one of the comparisons are needed to make the
entire expression true.  When you are using the
operator <> (not equal), all variables must be
not equal to make the expression true.

In the second form, the expression tests to see
if the variable specified can be found in either
a Table or a File.  The Table or File must be
defined in the Table section of the Format
Generator.  If multiple Tables or Files are named
in the expression, then each is searched to find
a match to the variable.  If the variable is
found in at least one of the Tables or Files,
then the expression is true.  When you are using
the operator NI (not found in), the expression is
true only if the variable is not found in any of
the Tables or Files.  Any External Fields that
were defined with the Files, will be loaded with
data from the File whenever a search is
successful.

In the third form, the expression tests to see if
the Data Entry Program is in a particular mode.
If the program is in any of the modes listed then
the expression is considered true.

Logical Operators:

     =    Equal to.
     >    Greater than.
     <    Less than.
     >=   Greater than or equal.
     <=   Less than or equal.
     <>   Not equal to.
     IN   Found in the file or table.
     NI   Not found in the file or table.

Modes:

     *ENTER     In Enter mode, at the end of the
                file, or reactivating a deleted
                record (using Alt+F6).
     *UPDATE    In Update mode.
     *VERIFY    In Verify mode.
     *RECADV    Record Advancing.
     *RECBKSP   Record Backspacing.
     *WRAP      Field Wrap.  The operator keyed a
                word in a Text field that would
                not fit.  If the operator presses
                a Field Exit key in a Text field,
                then *WRAP will not be true.
     *BALANCE   All Balance fields in balance.

Examples:

     IF RgHrs>15 THEN WARN 'Too large'
     IF RgHrs<TtlHrs,8 THEN GOTO WC
     IF Trade NI **T1,**T2 THEN EXIT
     IF *VERIFY,*RECBKSP THEN CLEAR *WF1
     IF *WRAP THEN SET *FM=5

In the first example, the message 'Too large' is
given to the operator if the RgHrs field is
larger than 15.

In the second example, the cursor will jump to
the field named WC if the RgHrs field is either
less than TtlHrs field or less than 8.

In the third example, the edits will be exited if
the Trade field is not found in either Table #1
or in Table #2.

In the fourth example, Work Field #1 is cleared
whenever the program is in Verify mode or
whenever the program has performed a Record
Backspace.

In the last example, the format level will
automatically switch to 5 if the operator keyed a
word that would not fit in a Text field.  The
word that would not fit will be placed in the
next Text field that is found on level 5.

MAXIMUM CAPACITIES

There are 10 different Storage areas that may be
used.

There are 9 different Field Total accumulators
that may be used.

A maximum of 100 Edit lines may be defined in
each level.

A maximum of 1000 Edit lines may be defined in
each format.

Up to 10 different External Files may be defined
in each format.

Up to 30 different Work Fields may be used in the
Edits for each format.
**************** end of section *****************
