FORM.CALC

Note to CICS users

FORM.CALC uses expressions written in REXX, which is not available in CICS.

On the FORM.CALC panel you can enter expressions for report calculations. It initially contains only one row, a place for one expression. However, up to 998 additional rows can be inserted.

Each entry area is described in terms of its effect on reports. FORM.CALC does not affect charts.

FORM.CALC
                                                      C       D      E 
 A              B                                    PASS    For &CALCid
 ID   CALCULATION EXPRESSION                         NULLS?  WIDTH  EDIT
 ---  ---------------------------------------------  ------  -----  -----
                                                     NO      10     C
 
      *** END ***
 
 1=Help        2=Check     3=End     4=Show        5=Chart       6=Query
 7=Backward    8=Forward   9=       10=Insert     11=Delete     12=Report
 OK, Cursor positioned.
 COMMAND ===>                                            SCROLL ===> PAGE
 
 A  ID
Enter a one to three character identifier for the corresponding calculation expression. The identifier is any number from 1 through 999. When appended to the usage code CALCid (see Usage Codes) or the &CALC variable (&CALCid), it identifies which expression on FORM.CALC is to be used in a calculation.

The&CALCid variable can be used only in detail block text, final text, and break footing text. CALCid and &CALCid activate the evaluation of the calculation expression on FORM.CALC whose ID equals id.

For an &CALC variable, the evaluated result is edited according to the width and edit code specified for the expression in the FORM.CALC panel (subject to the special factors described in Summary of Editing Expressions). For a CALCid usage code, the evaluated result is edited according to the width of the columns and the edit code of the CALC.

 B  CALCULATION EXPRESSION
Enter an expression. It can contain up to 50 characters. You cannot execute QMF commands (using the callable or command interfaces) from within a REXX EXEC used in FORM.CALC.

Other than &CALCid, any valid form variable can be used in the expressions. The following variables are valid:

Global variables
Use SET GLOBAL to set variables for use in calculation expressions. See SET GLOBAL for details about this command.
Column variables: &n
n is a column number.
Aggregation variables: &an
n is a valid column number, and a is one of the following QMF aggregation functions: AVG, COUNT, CPCT, CSUM, FIRST, LAST, MAX, MIN, PCT, STDEV, SUM, TCPCT, TPCT.
&ROW
Print the number of the data row at the time the calculation is evaluated. The &ROW variable is replaced just before the &CALCid variable or CALC usage code is evaluated.

&COUNT
Row count
&DATE
The current date
&TIME
The current time
&PAGE
The current page (always 1 for displayed reports)

For a description of &COUNT, see page*** under BREAK1 FOOTING TEXT.

For descriptions of &DATE, &TIME, and &PAGE, see page *** under BREAK1 HEADING TEXT.

When an expression is entered, its variables are validated. Column variables are checked for valid column numbers and for compatible usages or edit codes or both. For example, if the sixth column has an edit code of C and the expression uses &SUM6, an error exists and a message is issued.

Be sure to use substitution variables that are compatible with the expression. QMF does not check for nonnumeric substitution variables in an arithmetic expression.

If you encounter a syntax error on the expression, you must correct it either in the REXX exec itself or in the REXX expression. Be sure to follow the REXX coding rules.

For example, you include in the expression an exec name that does not exist. After you correct the exec name or create the exec, show F.CALC and make any necessary modifications. If you do not need to make any other changes, retype one of the characters in the expression. Doing this causes QMF to validate the variables again to ensure you have built your form correctly. If you do not revalidate your form, you might get unpredictable results.

 C  PASS NULLS
Enter YES or NO.
YES
Allows you to use the following QMF-provided values to change the default handling in the corresponding situations:
Value
Situation
DSQNULL
Data is null
DSQUNDEF
Data is undefined
DSQOFLOW
Data has numeric overflow
DSQNOINS
Data has no instance
DSQNOREL
Data has no relationship
For example, any database variable that is null (a database null) is replaced with the character string DSQNULL before the expression is passed to REXX for evaluation. You can provide a REXX expression or EXEC that checks for the string and substitutes 0 (or whatever is appropriate for your purpose) for the database null.

If a null value is returned by the REXX expression, you can pass it to your report.

If the expression contains a substitution value that is null, undefined, overflow, has no instance or no relationship, then the entire expression will be set to that value that represents that condition. This expression reduction is performed only on expressions, not comparisons.

If the expression contains more than one substitution value that is null, undefined, overflow, has no instnace or no relationship, then the following order of precedence will be used for expression reduction:

  1. Undefined
  2. Overflow
  3. Null
  4. No instance
  5. No relationship

If a null value is returned by the REXX expression, you can pass it to your report.

For more information see the:@IF function.

NO
Returns a null for the values listed above. Nothing is passed to REXX for evaluation.
 D  WIDTH
Enter the width (in single-byte characters) to which the evaluated result of the corresponding expression is edited in report text. It is applicable only to results obtained for &CALCid variables. If the CALCid usage cannot be edited according to the edit code for the column, the edit code of the CALCid is used.

WIDTH is a five character entry field. It must contain a number from 1 through 32767. The default is 10.

 E  EDIT
Enter the edit code to be used when the evaluated result of the corresponding expression is edited in report text. It is applicable only to results obtained for &CALCid variables. Results of CALCid usages are edited using the edit code specified for the column on FORM.MAIN or FORM.COLUMNS.

EDIT is a five character field. The default is C for character data when a line is inserted in FORM.COLUMNS. Only the following edit codes are accepted:

[ Previous Page | Next Page | Contents | Index ]