Ignoring ON Phrases for Absent Fields

How to:

To make report requests flexible, options may be included that are not needed in every situation. User selections then control the options used for each execution of the request.

Options such as subtotals and page breaks are included in a report request using an ON phrase. Some options specified with an ON phrase require a sort field, and others accept a sort or display field. By default, if the field referenced in the ON phrase is not present in the request, or if the option is not supported with the type of field specified, the following message is generated and processing terminates:

(FOC013) The 'ON FIELDNAME' FIELD IS NOT A SORT FIELD: sortfield

You can use the SET ONFIELD=IGNORE command to instruct FOCUS to ignore ON phrases that reference absent fields or fields that are not supported by the specified option.

Note that any field used must be present in the Master File for the data source or the following message is generated and execution terminates:

(FOC003) THE FIELDNAME IS NOT RECOGNIZED: field

Syntax: How to Control Processing of ON Phrases

SET ONFIELD = {ALL|IGNORE}
ON TABLE SET ONFIELD {ALL|IGNORE}

where:

ALL

Issues a message and terminates execution when a field referenced in an ON phrase is not present in the request. ALL is the default value.

IGNORE

Ignores ON phrases that reference fields that are not present in the request, as well as ON phrases that include options not supported by the type of field specified.

Example: Ignoring ON Phrases for Absent Fields

The following request against the EMPDATA data source has ON phrases for the fields DEPT, DIV, and PIN. PIN is a sort field, but the other sort field must be entered at run time as the amper variable &F1:

SET USER = EUSER               
 TABLE FILE EMPDATA            
   SUM SALARY                  
   BY &F1                      
   BY PIN                      
      ON DEPT SKIP-LINE NOSPLIT
      ON &F1  SUBTOTAL         
      ON DIV   PAGE-BREAK      
      ON TABLE SET ONFIELD ALL
       END

Run the request supplying the value DEPT for the variable &F1. The following messages are generated:

 ERROR AT OR NEAR LINE      8  IN PROCEDURE IGNORE3 FOCEXEC *
(FOC013) THE 'ON FIELDNAME' FIELD IS NOT A SORT FIELD: DIV   
 BYPASSING TO END OF COMMAND                                 
(FOC009) INCOMPLETE REQUEST STATEMENT

Now change the value of the ONFIELD parameter to IGNORE and run the request again, supplying the value DEPT for the variable &F1. The partial output is:

DEPT                  PIN                 SALARY
----                  ---                 ------
                                                
ACCOUNTING            000000070       $83,000.00
                      000000100       $32,400.00
                      000000300       $79,000.00
                      000000370       $62,500.00
                      000000400       $26,400.00
                                                
*TOTAL ACCOUNTING                    $283,300.00
                                                
                                                
ADMIN SERVICES        000000170       $30,800.00
                      000000180       $25,400.00
                                                
*TOTAL ADMIN SERVICES                 $56,200.00

Information Builders