Fcode

Format

F [ ; ] element [ ; element ...]

The F code performs mathematical operations on the data values of a record, or manipulates strings. It comprises any number of operands or operators in reverse Polish format (Lukasiewicz) separated by semicolons.

The program parses the F code from left to right, building a stack of operands. Whenever it encounters an operator, it performs the requested operation, puts the result on the top of the stack, and pops the lower stack elements as necessary.

The semicolon ( ; ) is the element separator.

element can be one or more of the items from the following categories:

A data location or string

loc[R]
Numeric location specifying a data value to be pushed onto the stack, optionally followed by an R (repeat code).
Cn
n is a constant to be pushed onto the stack.
string
Literal string enclosed in pairs of double quotation marks ( " ), single quotation marks ( ' ), or backslashes ( \ ).
number
Constant number enclosed in pairs of double quotation marks ( " ), single quotation marks ( ' ), or backslashes ( \ ). Any integer, positive, negative, or zero can be specified.
D
System date (in internal format).
T
System time (in internal format).

A special system counter operand

@NI
Current® item counter (number of items listed or selected).
@ND
Number of detail lines since the last BREAK on a break line.
@NV
Current value counter for columnar listing only.
@NS
Current subvalue counter for columnar listing only.
@NB
Current BREAK level number. 1 = lowest level break. This has a value of 255 on the grand-total line.
@LPV
Load Previous Value: load the result of the last correlative code onto the stack.

An operator

Operators specify an operation to be performed on top stack entries. stack1 refers to the value on the top of the stack, stack2 refers to the value just below it, stack3 refers to the value below stack2, and so on.

*[n]
Multiply stack1 by stack2. The optional n is the descaling factor (that is, the result is divided by 10 raised to the nth power).
/
Divide stack1 into stack2, result to stack1.
R
Same as /, but instead of the quotient, the remainder is returned to the top of the stack.
+
Add stack1 to stack2.
-
Subtract stack1 from stack2, result to stack1 (except for REALITY flavor, which subtracts stack2 from stack1).
:
Concatenate stack1 string onto the end of stack2 string.
[ ]
Extract substring. stack3 string is extracted, starting at the character specified by stack2 and continuing for the number of characters specified in stack1. This is equivalent to the BASIC [m,n] operator, where m is in stack2 and n is in stack1.
S
Sum of multivalues in stack1 is placed at the top of the stack.
_
Exchange stack1 and stack2 values.
P or \
Push stack1 back onto the stack (that is, duplicate stack1).
^
Pop the stack1 value off the stack.
(conv)
Standard conversion operator converts data in stack1, putting the result into stack1.

A logical operator

Logical operators compare stack1 to stack2. Each returns 1 for true and 0 for false:

=
Equal to.
<
Less than.
>
Greater than.
# or <>
Not equal to.
[
Less than or equal to.
]
Greater than or equal to.
&
Logical AND.
!
Logical OR.
\n\
A label is defined by a positive integer enclosed by two backslashes (\\).
#n
Connection to label n if stack1 differs from stack2.
>n
Connection to label n if stack1 is greater than stack2.
<n
Connection to label n if stack1 is less than stack2.
=n
Connection to label n if stack1 equals stack2.
}n
Connection to label n if stack1 is greater than or equal to stack2.
{n
Connection to label n if stack1 is less than or equal to stack2.
IN
Tests stack1 to see if it is the null value.
Fnnnn
If stack1 evaluates to false, branch forward nnnn characters in the F code, and continue processing.
Bnnnn
Branch forward unconditionally nnnn characters in the F code, and continue processing.
Gnnnn
Go to label nnnn. The label must be a string delimited by backslashes ( \ ).
G*
Go to the label defined in stack1. The label must be a string delimited by backslashes ( \ ).
Note: The F code performs only integer arithmetic.