Features Added in FOCUS 7.6.1

In this section:

 

Starting in FOCUS 7.6.1, you can compare alphanumeric fields to a pattern using an IF phrase, assign column numbers to all fields or only those displayed on the report output, control underlining of ACROSS objects, use combinations of summary commands in a request, produce summary columns for ACROSS fields, specify a multi-field join to a fixed format sequential file, rank sort field values, display a row for data excluded by a sort phrase, produce ANSI-compliant reports when no records are retrieved, preserve filter definitions across joins, prevent propagation of subtotals to the grand total, create a left outer join, retrieve FML captions and tag values or lists, and change the titles of columns produced using a prefix operator.


Top of page

x
Comparing Alphanumeric Fields to a Pattern With IF

How to:

Reference:

The IF phrase can specify the LIKE and UNLIKE operators to compare alphanumeric fields to a pattern. The pattern used for the comparison is called a mask.

The mask can use the following wildcard characters:

There may be times when you want to use the percent sign or underscore as a normal character in the mask, not as a wildcard character. You can indicate when you want to treat the percent sign or underscore as a normal character by preceding them with an escape character in the mask. This technique enables you to search for the percent sign or underscore character in the data.



x
Syntax: How to Screen Using LIKE and UNLIKE in an IF Phrase

To search for records with the LIKE operator, use

IF field LIKE 'mask1' [OR 'mask2' ... ]

To reject records based on the mask value, use

IF field UNLIKE 'mask1' [OR 'mask2' ...]

where:

field

Is any valid field name or alias.

mask1, mask2

Are the alphanumeric patterns you want to use for comparison. The single quotation marks are required if the mask contains blanks. There are two wildcard characters that you can use in a mask: the underscore (_) indicates that any single character in that position is acceptable; the percent sign (%) allows any following sequence of zero or more characters. Every other character in the mask accepts only itself in that position as a match to the pattern.



Example: Screening on Initial Characters

To list all employees who have taken basic-level courses, where every basic course begins with the word BASIC, issue the following request:

TABLE FILE EMPLOYEE
PRINT COURSE_NAME COURSE_CODE
BY LAST_NAME BY FIRST_NAME
IF COURSE_NAME LIKE 'BASIC%'
END

The output is:

LAST_NAME        FIRST_NAME  COURSE_NAME                     COURSE_CODE
---------        ----------  -----------                     -----------
BLACKWOOD        ROSEMARIE   BASIC REPORT PREP NON-PROG      102
CROSS            BARBARA     BASIC REPORT PREP DP MGRS       107
JONES            DIANE       BASIC REPORT PREP FOR PROG      103
SMITH            MARY        BASIC REPORT PREP FOR PROG      103
                 RICHARD     BASIC RPT NON-DP MGRS           108

To list all employees who have taken higher level courses which do not begin with the word BASIC, issue the following request:

TABLE FILE EMPLOYEE
PRINT COURSE_NAME COURSE_CODE
BY LAST_NAME BY FIRST_NAME
IF COURSE_NAME UNLIKE 'BASIC%'
END

The output is:

LAST_NAME        FIRST_NAME  COURSE_NAME                     COURSE_CODE
---------        ----------  -----------                     -----------
BLACKWOOD        ROSEMARIE   DECISION SUPPORT WORKSHOP       301
                             WHAT'S NEW IN FOCUS             202
                             TIMESHARING WORKSHOP            106
                             FILE DESC & MAINT NON-PROG      104
CROSS            BARBARA     HOST LANGUAGE INTERFACE         302
JONES            DIANE       FOCUS INTERNALS                 203
                             ADVANCED TECHNIQUES             201
                             FILE DESCRPT & MAINT            101
MCKNIGHT         ROGER       FILE DESCRPT & MAINT            101
SMITH            MARY        FILE DESCRPT & MAINT            101
STEVENS          ALFRED      FILE DESCRPT & MAINT            101


Example: Screening on a Single Character

If you want to list all employees who have taken a 20x-series course, and you know that all of these courses have the same code except for the final character, issue the following request:

TABLE FILE EMPLOYEE
PRINT COURSE_NAME COURSE_CODE
BY LAST_NAME BY FIRST_NAME
  IF COURSE_CODE LIKE '20_'
END

The output is:

LAST_NAME        FIRST_NAME  COURSE_NAME                     COURSE_CODE
---------        ----------  -----------                     -----------
BLACKWOOD        ROSEMARIE   WHAT'S NEW IN FOCUS             202
JONES            DIANE       FOCUS INTERNALS                 203
                             ADVANCED TECHNIQUES             201


x
Syntax: How to Specify an Escape Character for a Mask in an IF Phrase

You can assign any single character as an escape character by prefacing it with the word ESCAPE in the LIKE or UNLIKE syntax

IF field {LIKE|UNLIKE} 'mask1' ESCAPE 'a' [OR 'mask2' ESCAPE 'b' ...

where:

field

Is any valid field name or alias to be evaluated in the selection test.

mask1, mask2

Are search patterns that you supply. The single quotation marks are required.

a, b ...

Are single characters that you identify as escape characters. Each mask can specify its own escape character or use the same character as other masks. If you embed the escape character in the mask, before a % or _, the % or _ character is treated as a literal, rather than as a wildcard. The single quotation marks are required if the mask contains blanks.



x
Reference: Usage Notes for Escape Characters in IF Phrases


Example: Screening With an Escape Character in an IF Phrase

The VIDEOTR2 data source contains an e-mail address field. To search for e-mail addresses with the characters 'handy_' you can issue the following request:

TABLE FILE VIDEOTR2
PRINT CUSTID LASTNAME FIRSTNAME EMAI
IF EMAIL LIKE 'handy_%'
END

Because the underscore character functions as a wildcard character, this request returns two instances, only one of which contains the underscore character.

The output is:

CUSTID  LASTNAME         FIRSTNAME   EMAIL
------  --------         ---------   -----
0944    HANDLER          EVAN        handy_man@usa.com
0944    HANDLER          EVAN        handyman@usa.com

To retrieve only the instance that contains the underscore character, you must indicate that the underscore should be treated as a normal character, not a wildcard. The following request retrieves only the instance with the underscore character in the e-mail field:

TABLE FILE VIDEOTR2
PRINT CUSTID LASTNAME FIRSTNAME EMAI
IF EMAIL LIKE 'handy\_%' ESCAPE '\'
END

The output is:

CUSTID  LASTNAME         FIRSTNAME   EMAIL
------  --------         ---------   -----
0944    HANDLER          EVAN        handy_man@usa.com

Top of page

x
Assigning Column Numbers Only to Fields Displayed on Report Output

How to:

Reference:

Column notation assigns a sequential column number to each column in the internal matrix created for a report request. You can use column notation in COMPUTE and RECAP commands to refer to these columns in your request.

Because column numbers refer to columns in the internal matrix, they are assigned after retrieval and aggregation are completed. Columns not actually displayed on the report output may exist in the internal matrix. For example, calculated values used in the request generate one or more columns in the internal matrix. Fields with the NOPRINT option take up a column in the internal matrix, and a reformatted field generates an additional column for the reformatted value. Certain RECAP calculations such as FORECAST or REGRESS generate multiple columns in the internal matrix.

BY fields are not assigned column numbers but, by default, every other column in the internal matrix is assigned a column number, which means that you have to account for all of the internally generated columns if you want to refer to the appropriate column value in your request. You can change this default column assignment behavior with the SET CNOTATION=PRINTONLY command, which assigns column numbers only to columns that display on the report output.

To create a column reference in a request, you can:



x
Syntax: How to Control the Creation of Column References
SET CNOTATION={ALL|PRINTONLY|EXPLICIT}

where:

ALL

Assigns column reference numbers to every column in the internal matrix. ALL is the default value.

PRINTONLY

Assigns column reference numbers only to columns that display on the report output.

EXPLICIT

Assigns column reference numbers to all columns used in a request, whether displayed or not. Details are described in the feature named Assigning Column Numbers to All Fields Used in a Request.

Note: This setting is not supported in an ON TABLE phrase.



Example: Using Column Notation in a Non-FML Request With CNOTATION=ALL

In the following request with CNOTATION=ALL, the product of C1 and C2 does not calculate TRANSTOT times QUANTITY because the reformatting generates additional columns.

SET CNOTATION = ALL
TABLE FILE VIDEOTRK
SUM TRANSTOT/D12.2 QUANTITY/D12.2
AND COMPUTE
PRODUCT = C1 * C2;
BY TRANSDATE
END

The output is:

TRANSDATE        TRANSTOT        QUANTITY         PRODUCT
---------        --------        --------         -------
 91/06/17           57.03           12.00        3,252.42
 91/06/18           21.25            2.00          451.56
 91/06/19           38.17            5.00        1,456.95
 91/06/20           14.23            3.00          202.49
 91/06/21           44.72            7.00        1,999.88
 91/06/24          126.28           12.00       15,946.63
 91/06/25           47.74            8.00        2,279.11
 91/06/26           40.97            2.00        1,678.54
 91/06/27           60.24            9.00        3,628.85
 91/06/28           31.00            3.00          961.00

BY fields do not get a column reference, so the first column reference is for TRANSTOT with its original format, then the reformatted version. Next is QUANTITY with its original format and then the reformatted version. Last is the calculated value, PRODUCT, which represents TRANSTOT (F7.2) multiplied by TRANSTOT (D12.2).



Example: Using Column Notation in a Non-FML Request With CNOTATION=PRINTONLY

Setting CNOTATION=PRINTONLY assigns column references to the output columns only. In this case the product of C1 and C2 does calculate TRANSTOT times QUANTITY.

SET CNOTATION = PRINTONLY
TABLE FILE VIDEOTRK
SUM TRANSTOT/D12.2 QUANTITY/D12.2
AND COMPUTE
PRODUCT = C1 * C2;
BY TRANSDATE
END

The output is:

TRANSDATE        TRANSTOT        QUANTITY         PRODUCT
---------        --------        --------         -------
 91/06/17           57.03           12.00          684.36
 91/06/18           21.25            2.00           42.50
 91/06/19           38.17            5.00          190.85
 91/06/20           14.23            3.00           42.69
 91/06/21           44.72            7.00          313.04
 91/06/24          126.28           12.00        1,515.36
 91/06/25           47.74            8.00          381.92
 91/06/26           40.97            2.00           81.94
 91/06/27           60.24            9.00          542.16
 91/06/28           31.00            3.00           93.00


Example: Using CNOTATION=PRINTONLY With Column Numbers in an FML Request

In the following request, the reformatting of fields generates additional columns in the internal matrix. In the second RECAP expression, note that because of the CNOTATION setting:

SET CNOTATION=PRINTONLY
DEFINE FILE LEDGER
CUR_YR/I5C=AMOUNT;
LAST_YR/I5C=.87*CUR_YR - 142;
END
TABLE FILE LEDGER
SUM CUR_YR/F9.2 AS 'CURRENT,YEAR'
LAST_YR/F9.2 AS 'LAST,YEAR'
FOR ACCOUNT
1010 AS 'CASH ON HAND'                             OVER
1020 AS 'DEMAND DEPOSITS'                          OVER
1030 AS 'TIME DEPOSITS'                            OVER
BAR                                                OVER
RECAP TOTCASH/F9.2C= R1 + R2 + R3; AS 'TOTAL CASH' OVER
" "                                                OVER
RECAP GROCASH(2)/F9.2C=100*TOTCASH(1)/TOTCASH(2) - 100;
AS 'CASH GROWTH(%)'
END

The output is:

                   CURRENT       LAST
                   YEAR          YEAR
                   -------       ----
CASH ON HAND       8784.00    7214.00
DEMAND DEPOSITS    4494.00    3482.00
TIME DEPOSITS      7961.00    6499.00
                 ---------  ---------
TOTAL CASH       21,239.00  17,195.00
 
CASH GROWTH(%)                  23.52


Example: Using CNOTATION=PRINTONLY to RECAP Over Contiguous Columns in an FML Request

In this example, the RECAP calculation for ATOT occurs only for displayed columns 2 and 3, as specified in the request. No calculation is performed for displayed column 1.

SET CNOTATION=PRINTONLY
DEFINE FILE LEDGER
CUR_YR/I5C=AMOUNT;
LAST_YR/I5C=.87*CUR_YR - 142;
NEXT_YR/I5C=1.13*CUR_YR + 222;
END
TABLE FILE LEDGER
SUM NEXT_YR/F9.2 CUR_YR/F9.2 LAST_YR/F9.2
FOR ACCOUNT
10$$ AS 'CASH'                      OVER
1100 AS 'ACCOUNTS RECEIVABLE'       OVER
1200 AS 'INVENTORY'                 OVER
BAR                                 OVER
RECAP ATOT(2,3)/I5C = R1 + R2 + R3;
AS 'ASSETS  ACTUAL'
END

The output is:

                       NEXT_YR     CUR_YR    LAST_YR
                       -------     ------    -------
CASH                  25991.00   21239.00   17195.00
ACCOUNTS RECEIVABLE   21941.00   18829.00   15954.00
INVENTORY             31522.00   27307.00   23329.00
                     ---------  ---------  ---------
ASSETS  ACTUAL                     67,375     56,478


Example: Using CNOTATION=PRINTONLY With Relative Column Addressing in an FML Request

This example computes the change in cash (CHGCASH) for displayed columns 1 and 2.

SET CNOTATION=PRINTONLY
DEFINE FILE LEDGER
CUR_YR/I5C=AMOUNT;
LAST_YR/I5C=.87*CUR_YR - 142;
NEXT_YR/I5C=1.13*CUR_YR + 222;
END
TABLE FILE LEDGER
SUM NEXT_YR/F9.2 CUR_YR/F9.2 LAST_YR/F9.2
FOR ACCOUNT
10$$ AS 'TOTAL CASH' LABEL TOTCASH           OVER
" "                                          OVER
RECAP CHGCASH(1,2)/I5SC = TOTCASH(*) - TOTCASH(*+1); AS 'CHANGE IN CASH'
END

The output is:

 
                  NEXT_YR     CUR_YR    LAST_YR
                  -------     ------    -------
TOTAL CASH       25991.00   21239.00   17195.00
 
CHANGE IN CASH      4,752      4,044


Example: Using CNOTATION=PRINTONLY With Cell Notation in an FML Request

In this request, two RECAP expressions derive VARIANCEs (EVAR and WVAR) by subtracting values in four displayed columns (1, 2, 3, 4) in row three (PROFIT); these values are identified using cell notation (r,c).

SET CNOTATION=PRINTONLY
TABLE FILE REGION
SUM E_ACTUAL/F9.2 E_BUDGET/F9.2 W_ACTUAL/F9.2 W_BUDGET/F9.2
FOR ACCOUNT
3000 AS 'SALES'                         OVER
3100 AS 'COST'                          OVER
BAR                                     OVER
RECAP PROFIT/I5C = R1 - R2;             OVER
" "                                     OVER
RECAP EVAR(1)/I5C = E(3,1) - E(3,2);
AS 'EAST  VARIANCE'                     OVER
RECAP WVAR(3)/I5C = E(3,3) - E(3,4);
AS 'WEST  VARIANCE'
END

The output is:

                 E_ACTUAL   E_BUDGET   W_ACTUAL   W_BUDGET
                 --------   --------   --------   --------
SALES             6000.00    4934.00    7222.00    7056.00
COST              4650.00    3760.00    5697.00    5410.00
                ---------  ---------  ---------  ---------
PROFIT              1,350      1,174      1,525      1,646
EAST  VARIANCE        176
WEST  VARIANCE                             -121



The following request has a field that is not printed, several reformatted fields and three calculated values. With SET CNOTATION=PRINTONLY, the column references result in correct output.

SET CNOTATION = PRINTONLY
DEFINE FILE LEDGER
CUR_YR/I5C=AMOUNT;
LAST_YR/I5C=.87*CUR_YR - 142;
NEXT_YR/I5C=1.13*CUR_YR + 222;
END
TABLE FILE LEDGER
SUM NEXT_YR NOPRINT CUR_YR
COMPUTE AMT2/D6 = AMOUNT *2;
LAST_YR/D5   AMOUNT NEXT_YR
COMPUTE AMT3/D6  = AMOUNT*3;
COMPUTE AMT4/D6  = AMOUNT*4;
FOR ACCOUNT
10$$ AS 'CASH'                                 OVER
1100 AS 'ACCTS. REC.'                          OVER
1200 AS 'INVENTORY'                            OVER
BAR                                            OVER
RECAP ATOT/I8C = R1 + R2 + R3; AS 'TOTAL'      OVER
RECAP DIFF(2,10,2)/D8  = ATOT(*) - ATOT(*-1);
END

The output is:

             CUR_YR     AMT2  LAST_YR  AMOUNT  NEXT_YR     AMT3     AMT4
             ------     ----  -------  ------  -------     ----     ----
CASH         21,239   42,478   17,195  21,239   25,991   63,717   84,956
ACCTS. REC.  18,829   37,658   15,954  18,829   21,941   56,487   75,316
INVENTORY    27,307   54,614   23,329  27,307   31,522   81,921  109,228
             ------  -------   ------  ------   ------  -------  -------
TOTAL        67,375  134,750   56,478  67,375   79,454  202,125  269,500
DIFF                  67,375           10,897           122,671


x
Reference: Usage Notes for SET CNOTATION

Top of page

x
Assigning Column Numbers to All Fields Used in a Request

How to:

Reference:

Column notation enables you to refer to columns in the internal matrix by number instead of field name when performing calculations on those values.

Certain reporting options create additional columns in the internal matrix that do not display on the report output. For example, when the request reformats a field, the original field and the reformatted field both become columns in the internal matrix. In this case, both versions of the field are assigned column numbers. Other reporting options can create several generated fields in the internal matrix to hold intermediate calculations. By default, you must take all of these additional columns into account when using column notation in a request.

The CNOTATION = EXPLICIT parameter assigns column numbers only to fields that are explicitly referenced in the request, eliminating the need to think about column notation references for generated fields in the matrix. This parameter also applies to FML requests that use column numbers, contiguous column notation in RECAP expressions, column addressing, relative column addresses, and cell notation.

CNOTATION has three possible values:



x
Syntax: How to Control the Creation of Column Reference Numbers
SET CNOTATION={ALL|PRINTONLY|EXPLICIT}

where:

ALL

Assigns column reference numbers to every column in the internal matrix. ALL is the default value.

PRINTONLY

Assigns column reference numbers only to columns that display in the report output.

EXPLICIT

Assigns column reference numbers to all fields referenced in the request, whether displayed or not.



x
Reference: Usage Notes for Column Numbers


Example: Using Column Notation With NOPRINT in a non-FML Request

The following request, sums TRANSTOT, QUANTITY, and TRANSCODE by TRANSDATE. TRANSTOT has the NOPRINT option, so it is not displayed on the report output. The request also calculates the following fields using COMPUTE commands:

SET CNOTATION = ALL
TABLE FILE VIDEOTRK
SUM TRANSTOT/D7.2 NOPRINT QUANTITY/D7.2 TRANSCODE
  COMPUTE TTOT2/D7.2 = C1;
  COMPUTE UNIT_COST1/D7.2 = C1/C2;
  COMPUTE UNIT_COST2/D7.2 = C1/QUANTITY;
BY TRANSDATE
END

In this request, only the setting CNOTATION=EXPLICIT gives the correct result. The following discussion clarifies the reason the EXPLICIT setting is required.

With CNOTATION=ALL, all fields in the internal matrix are assigned column numbers. In particular, the request creates the following column references:

UNIT_COST1 is C1/C2. These column numbers have both been assigned to TRANSTOT, so UNIT_COST1 always equals 1. UNIT_COST2 is C1 (TRANSTOT) divided by QUANTITY. The output is:

TRANSDATE  QUANTITY  TRANSCODE     TTOT2  UNIT_COST1  UNIT_COST2
---------  --------  ---------     -----  ----------  ----------
 91/06/17     12.00         10     57.03        1.00        4.75
 91/06/18      2.00          2     21.25        1.00       10.63
 91/06/19      5.00          4     38.17        1.00        7.63
 91/06/20      3.00          3     14.23        1.00        4.74
 91/06/21      7.00          6     44.72        1.00        6.39
 91/06/24     12.00          9    126.28        1.00       10.52
 91/06/25      8.00          7     47.74        1.00        5.97
 91/06/26      2.00          2     40.97        1.00       20.48
 91/06/27      9.00          7     60.24        1.00        6.69
 91/06/28      3.00          3     31.00        1.00       10.33

With CNOTATION = PRINTONLY, the field TRANSTOT, which has the NOPRINT option, is not assigned any column numbers. QUANTITY with its original format is not assigned a column number because it is not displayed on the report output. The reformatted QUANTITY field is displayed and is assigned a column number. Therefore, the request creates the following column references:

UNIT_COST1 is C1/C2, QUANTITY/TRANSCODE. UNIT_COST2 is C1 (QUANTITY) divided by QUANTITY. Therefore, UNIT_COST2 always equals 1. The output is:

TRANSDATE  QUANTITY  TRANSCODE     TTOT2  UNIT_COST1  UNIT_COST2
---------  --------  ---------     -----  ----------  ----------
 91/06/17     12.00         10     12.00        1.20        1.00
 91/06/18      2.00          2      2.00        1.00        1.00
 91/06/19      5.00          4      5.00        1.25        1.00
 91/06/20      3.00          3      3.00        1.00        1.00
 91/06/21      7.00          6      7.00        1.17        1.00
 91/06/24     12.00          9     12.00        1.33        1.00
 91/06/25      8.00          7      8.00        1.14        1.00
 91/06/26      2.00          2      2.00        1.00        1.00
 91/06/27      9.00          7      9.00        1.29        1.00
 91/06/28      3.00          3      3.00        1.00        1.00

With CNOTATION = EXPLICIT, the results are correct. The reformatted TRANSTOT field is explicitly referenced in the request, so it is assigned a column number even though it is not displayed. However, the TRANSTOT field with its original format is not assigned a column number. The QUANTITY field with its original format is not assigned a column number because it is not explicitly referenced in the request. The reformatted QUANTITY field is assigned a column number. Therefore, the request creates the following column references:

UNIT_COST1 is C1/C2, TRANSTOT/QUANTITY. UNIT_COST2 is C1 (TRANSTOT) divided by QUANTITY. Therefore, UNIT_COST2 always equals UNIT_COST1. The output is:

TRANSDATE  QUANTITY  TRANSCODE     TTOT2  UNIT_COST1  UNIT_COST2
---------  --------  ---------     -----  ----------  ----------
 91/06/17     12.00         10     57.03        4.75        4.75
 91/06/18      2.00          2     21.25       10.63       10.63
 91/06/19      5.00          4     38.17        7.63        7.63
 91/06/20      3.00          3     14.23        4.74        4.74
 91/06/21      7.00          6     44.72        6.39        6.39
 91/06/24     12.00          9    126.28       10.52       10.52
 91/06/25      8.00          7     47.74        5.97        5.97
 91/06/26      2.00          2     40.97       20.48       20.48
 91/06/27      9.00          7     60.24        6.69        6.69
 91/06/28      3.00          3     31.00       10.33       10.33


Example: Using Cell Notation in an FML Request

In the following request, CUR_YR has the NOPRINT option. The CHGCASH RECAP expression is supposed to subtract CUR_YR from LAST_YR and NEXT_YR.

SET CNOTATION = ALL
DEFINE FILE LEDGER
CUR_YR/I7C = AMOUNT;
LAST_YR/I5C = .87*CUR_YR - 142;
NEXT_YR/I5C = 1.13*CUR_YR + 222;
END
TABLE FILE LEDGER
SUM CUR_YR/I5C NOPRINT LAST_YR NEXT_YR
FOR ACCOUNT
10$$ AS 'TOTAL CASH ' LABEL TOTCASH OVER
" " OVER
RECAP CHGCASH(1,3)/I5SC=(TOTCASH(*) - TOTCASH(1));
  AS 'CHANGE FROM CURRENT'
END

When CNOTATION = ALL, C1 refers to the CUR_YR field with its original format, C2 refers to the reformatted value, C3 is LAST_YR, and C4 is NEXT_YR. Since there is an extra column and the RECAP only refers to columns 1 and 3, the calculation for NEXT_YR - CUR_YR is not performed. The output is:

                     LAST_YR  NEXT_YR
                     -------  -------
TOTAL CASH            17,195   25,991
 
CHANGE FROM CURRENT   -4,044

When CNOTATION = PRINTONLY, the CUR_YR field is not assigned any column number, so there is no column 3. Therefore, no calculations are performed. The output is:

                     LAST_YR  NEXT_YR
                     -------  -------
TOTAL CASH            17,195   25,991
 
CHANGE FROM CURRENT

When CNOTATION = EXPLICIT, the reformatted version of the CUR_YR field is C1 because it is referenced in the request even though it is not displayed. Both calculations are performed correctly. The output is:

                     LAST_YR  NEXT_YR
                     -------  -------
TOTAL CASH            17,195   25,991
 
CHANGE FROM CURRENT   -4,044    4,752

Top of page

x
Controlling Underlining of ACROSS Objects

How to:

The SET ACROSSLINE command allows users to turn off/on optional underlining in reports to highlight ACROSS objects. The feature is only available for Hotscreen reports and report output formats WP, HTML and PDF.



x
Syntax: How to Control Underlining for ACROSS Objects

Issue the following command in any supported profile, in a FOCEXEC, or at the command prompt:

SET ACROSSLINE= (ON|OFF|SKIP)

where:

ON

Underlines ACROSS objects in report headings with a dashed line. ON is the default value.

OFF

Replaces the underline with a blank line.

SKIP

Specifies no underline and no blank line.



Example: Underlining ACROSS Objects With a Dashed Line (SET ACROSSLINE=ON)
SET ACROSSLINE=ON
TABLE FILE GGSALES
SUM UNITS BY PRODUCT
ACROSS REGION
END

The output is:

                    Region
                      Midwest    Northeast   Southeast         West
Product
-------------------------------------------------------------------
Biscotti               86105       145242       119594        70436
Cappuccino                 .        44785        73264        71168
Coffee Grinder         50393        40977        47083        48081
Coffee Pot             47156        46185        49922        47432
Croissant             139182       137394       156456       197022
Espresso              101154        68127        68030        71675
Latte                 231623       222866       209654       213920
Mug                    86718        91497        88474        93881
Scone                 116127        70732        73779        72776
Thermos                46587        48870        48976        45648


Example: Removing Underlines for ACROSS Objects (SET ACROSSLINE=SKIP)
SET ACROSSLINE=SKIP
TABLE FILE GGSALES
SUM UNITS BY PRODUCT
ACROSS REGION
END

The output is:

                   Region
                    Midwest     Northeast    Southeast         West
Product
Biscotti               86105       145242       119594        70436
Cappuccino                 .        44785        73264        71168
Coffee Grinder         50393        40977        47083        48081
Coffee Pot             47156        46185        49922        47432
Croissant             139182       137394       156456       197022
Espresso              101154        68127        68030        71675
Latte                 231623       222866       209654       213920
Mug                    86718        91497        88474        93881
Scone                 116127        70732        73779        72776
Thermos                46587        48870        48976        45648


Example: Replacing the Underline With a Blank LIne (SET ACROSSLINE=OFF)
SET ACROSSLINE=OFF
TABLE FILE GGSALES
SUM UNITS BY PRODUCT
ACROSS REGION
END

Turning ACROSSLINE=OFF replaces the (default) dashed line with an extra blank line between the report heading and the detail lines:

                     Midwest    Northeast    Southeast        West
Product
 
Biscotti               86105       145242       119594        70436
Cappuccino                 .        44785        73264        71168
Coffee Grinder         50393        40977        47083        48081
Coffee Pot             47156        46185        49922        47432
Croissant             139182       137394       156456       197022
Espresso              101154        68127        68030        71675
Latte                 231623       222866       209654       213920
Mug                    86718        91497        88474        93881
Scone                 116127        70732        73779        72776
Thermos                46587        48870        48976        45648

Top of page

x
Combinations of Summary Commands

How to:

Reference:

You can specify a different summary operation for each sort break (BY field). In prior releases, only one summary command (SUBTOTAL, SUB-TOTAL, SUMMARIZE, or RECOMPUTE) was supported in a request.

If you have multiple summary commands for the same sort field, the following message displays and the last summary command specified in the request is used:

(FOC36359)	MORE THAN 1 SUBTOTAL/SUB-TOTAL/RECOMPUTE/SUMMARIZE
 

There is more than one SUBTOTAL/SUB-TOTAL/RECOMPUTE/SUMMARIZE on the same key field which is not allowed. The last one specified will override the rest.

SUMMARIZE and SUB-TOTAL, which propagate their summary operations to higher level sort breaks, skip those fields at higher level sort breaks that have their own summary commands. The propagation of summary operations depends on whether prefix operator processing is used for summary lines. If prefix operators are:

Prefix operators on summary lines result in the same values whether the command is RECOMPUTE/SUMMARIZE or SUBTOTAL/SUB-TOTAL. For a computed field, the prefix operator is not applied, the value is recalculated using the expression in the COMPUTE command and the values from the summary line.

When you use different summary commands for different sort fields, the default grand total row inherits the summary command associated with the first sort field in the request. You can change the operation performed at the grand total level by using the ON TABLE phrase to specify a specific summary command.

Note: The grand total is considered the highest sort level. Therefore, although you can use the SUMMARIZE or SUB-TOTAL command at the grand total level, these commands apply only to the grand total and are not propagated to any other line on the report. On the grand total level SUMMARIZE operates as a RECOMPUTE command, and SUB-TOTAL operates as a SUBTOTAL command.



x
Syntax: How to Use Summary Commands

At a sort break, use the following syntax:

{BY|ON} breakfield [AS 'text1'] sumoption [MULTILINES]
        [pref.] [*|[field1 [[pref2.]field2 ...]]]
        [AS 'text2'] [WHEN expression;]

To replace the default grand total, use the following syntax

ON TABLE sumoption [pref.][field1 [[pref2.]field2 ...]] [AS 'text2']

where:

breakfield

Is the sort field whose change in value triggers the summary operation.

sumoption

Can be one of the following: SUBTOTAL, SUB-TOTAL, RECOMPUTE, or SUMMARIZE.

'text1'

Is the column heading to use for the break field on the report output.

MULTILINES

Suppresses the printing of a summary line for every sort break that has only one detail line. Note that MULTILINES suppresses the summary line even if a prefix operator is used to specify a different operation for the summary line. MULTI-LINES is a synonym for MULTILINES.

pref.

Is a prefix operator. When specified without a field list, the prefix operator is applied to every numeric column in the report output and every numeric column is populated with values on the summary row.

*

Includes all display fields on the summary line. If a prefix operator is specified, it is applied to all fields. If the prefix operator is not supported with alphanumeric fields, alphanumeric fields are not included on the summary line.

[field1 [field2 ... fieldn]]

Produces the type of summary specified by sumoption for the listed fields. If no field names are listed, the summary is produced for every numeric column in the report output.

pref. field1 [field2 ... fieldn] [pref2. fieldm ...]

The first prefix operator is applied to field1 through fieldn. The second prefix operator is applied to fieldm. Only the fields specified are populated with values on the summary row. Each prefix operator must be separated by a blank space from the following field name.

'text2'

Is the text that prints on the left of the summary row.

expression

Is an expression that determines whether the summary operation is performed at each break.



Example: Using SUBTOTAL and RECOMPUTE in a Request

In the following request, the first sort field specified is COPIES, which is associated with the RECOMPUTE command. Therefore, on the grand total line, the value of RATIO is correctly recomputed and the values of LISTPR and WHOLESALEPR are summed (because this is the default operation when the field is not calculated by a COMPUTE command).

TABLE FILE MOVIES
PRINT DIRECTOR LISTPR WHOLESALEPR
COMPUTE RATIO = LISTPR/WHOLESALEPR;
BY COPIES
BY RATING
WHERE COPIES LT 3
WHERE DIRECTOR EQ 'DISNEY W.' OR 'HITCHCOCK A.'
ON COPIES RECOMPUTE AS '*REC: '
ON RATING SUBTOTAL AS '*SUB:  '
END

The output is:

COPIES  RATING  DIRECTOR           LISTPR  WHOLESALEPR           RATIO
------  ------  --------           ------  -----------           -----
     1  NR      DISNEY W.           29.95        15.99            1.87
 
*SUB:   NR                          29.95        15.99            1.87
*REC:    1                          29.95        15.99            1.87
 
     2  NR      HITCHCOCK A.        19.98         9.00            2.22
 
*SUB:   NR                          19.98         9.00            2.22
 
        PG      HITCHCOCK A.        19.98         9.00            2.22
                HITCHCOCK A.        19.98         9.00            2.22
 
*SUB:   PG                          39.96        18.00            4.44
     2  PG13    HITCHCOCK A.        19.98         9.00            2.22
 
*SUB:   PG13                        19.98         9.00            2.22
 
        R       HITCHCOCK A.        19.98         9.00            2.22
 
*SUB:   R                           19.98         9.00            2.22
*REC:    2                          99.90        45.00            2.22
 
 
TOTAL                              129.85        60.99            2.13

If you reverse the BY fields, the grand total line sums the RATIO values as well as the LISTPR and WHOLESALEPR values because the SUBTOTAL command controls the grand total line:

TOTAL                              129.85        60.99           12.97

You can change the operation performed at the grand total level by adding the following command to the request:

ON TABLE RECOMPUTE

The grand total line then displays the recomputed values:

TOTAL                              129.85        60.99            2.13


Example: Using SUB-TOTAL With Multiple Summary Commands

In the following request, the SUB-TOTAL command propagates its operation to the DIRECTOR sort field (see the total line for HITCHCOCK, on which the RATIO values are subtotaled, not recomputed).

SUB-TOTAL is not propagated to the RATING sort field which has its own RECOMPUTE command, and for this sort field the RATIO value is recomputed.

The grand total line is recomputed because RECOMPUTE is performed on a higher level sort field than SUB-TOTAL.

TABLE FILE MOVIES
PRINT LISTPR WHOLESALEPR
COMPUTE RATIO = LISTPR/WHOLESALEPR;
BY DIRECTOR
BY RATING
BY COPIES
WHERE COPIES LT 3
WHERE DIRECTOR EQ 'HITCHCOCK A.'
ON COPIES SUB-TOTAL AS '*SUB: '
ON RATING RECOMPUTE AS '*REC:  '
END

The output is:

DIRECTOR           RATING  COPIES  LISTPR  WHOLESALEPR           RATIO
--------           ------  ------  ------  -----------           -----
HITCHCOCK A.       NR           2   19.98         9.00            2.22
 
*SUB:    2                          19.98         9.00            2.22
*REC:   NR                          19.98         9.00            2.22
 
                   PG           2   19.98         9.00            2.22
                                    19.98         9.00            2.22
 
*SUB:    2                          39.96        18.00            4.44
*REC:   PG                          39.96        18.00            2.22
 
                   PG13         2   19.98         9.00            2.22
*SUB:    2                          19.98         9.00            2.22
*REC:   PG13                        19.98         9.00            2.22
                                                                       
HITCHCOCK A.       R            2   19.98         9.00            2.22  
*SUB:    2                          19.98         9.00            2.22
*REC:   R                           19.98         9.00            2.22
*TOTAL DIRECTOR HITCHCOCK A.        99.90        45.00           11.10
 
 
TOTAL                               99.90        45.00            2.22


Example: Using Multiple Summary Commands With Prefix Operators

The following request prints the average value of LISTPR and the recomputed value of RATIO on the lines associated with sort field RATING. The SUB-TOTAL command associated with sort field COPIES is propagated to all fields on the DIRECTOR sort field lines and to the WHOLESALEPR and RATIO1 columns associated with the RATING sort field. The grand total line is suppressed for this request.

TABLE FILE MOVIES
PRINT LISTPR WHOLESALEPR
COMPUTE RATIO/D6.2 = LISTPR/WHOLESALEPR;
COMPUTE RATIO1/D6.2 = LISTPR/WHOLESALEPR;
BY DIRECTOR
BY RATING
BY COPIES
WHERE COPIES LT 3
  WHERE DIRECTOR EQ 'KAZAN E.'
  ON RATING  RECOMPUTE  AVE. LISTPR  RATIO AS '*REC:  '
  ON COPIES  SUB-TOTAL                     AS '*SUB:  '
  ON TABLE NOTOTAL
END

On the output:

The output is:

DIRECTOR           RATING  COPIES  LISTPR  WHOLESALEPR   RATIO  RATIO1
--------           ------  ------  ------  -----------   -----  ------
KAZAN E.           NR           1   24.98        14.99    1.67    1.67
 
*SUB:     1                         24.98        14.99    1.67    1.67
 
                                2   19.95         9.99    2.00    2.00
 
*SUB:     2                         19.95         9.99    2.00    2.00
*REC:   NR                          22.46        24.98     .90    3.66
*TOTAL DIRECTOR KAZAN E.            44.93        24.98    3.66    3.66


Example: Propagation of Summary Commands With Field Lists

In the following request, the RECOMPUTE command has a field list.

SET SUMMARYLINES = OLD
TABLE FILE MOVIES
PRINT LISTPR WHOLESALEPR
COMPUTE RATIO/D6.2 = LISTPR/WHOLESALEPR;
COMPUTE RATIO1/D6.2 = LISTPR/WHOLESALEPR;
BY DIRECTOR
BY RATING
BY COPIES
WHERE COPIES LT 3
  WHERE DIRECTOR EQ 'KAZAN E.'
  ON RATING RECOMPUTE LISTPR RATIO AS '*REC:  '
  ON COPIES SUB-TOTAL AS '*SUB:  '
END

With SUMMARYLINES=OLD, only those fields have values on the report output:

DIRECTOR           RATING  COPIES  LISTPR  WHOLESALEPR   RATIO  RATIO1
--------           ------  ------  ------  -----------   -----  ------
KAZAN E.           NR           1   24.98        14.99    1.67    1.67
 
*SUB:     1                         24.98                 1.67
 
                                2   19.95         9.99    2.00    2.00
 
*SUB:     2                         19.95                 2.00
*REC:   NR                          44.93                 1.80
*TOTAL DIRECTOR KAZAN E.            44.93                 3.66
 
 
TOTAL                               44.93                 1.80

With SUMMARYLINES=NEW, SUB-TOTAL propagates to all of the columns that would otherwise be unpopulated. The grand total line inherits the RECOMPUTE command for the fields listed in its field list, and the SUB-TOTAL command propagates to the other columns:

DIRECTOR           RATING  COPIES  LISTPR  WHOLESALEPR   RATIO  RATIO1
--------           ------  ------  ------  -----------   -----  ------
KAZAN E.           NR           1   24.98        14.99    1.67    1.67
 
*SUB:     1                         24.98        14.99    1.67    1.67
 
                                2   19.95         9.99    2.00    2.00
 
*SUB:     2                         19.95         9.99    2.00    2.00
*REC:   NR                          44.93        24.98    1.80    3.66
*TOTAL DIRECTOR KAZAN E.            44.93        24.98    3.66    3.66
 
 
TOTAL                               44.93        24.98    1.80    3.66


x
Reference: Usage Notes for Combinations of Summary Commands

Top of page

x
Producing Summary Columns for Horizontal Sort Fields

How to:

Reference:

The summary commands SUBTOTAL, SUB-TOTAL, SUMMARIZE, and RECOMPUTE can be used with horizontal sort breaks.



x
Syntax: How to Produce a Summary Operation on a Horizontal Sort Field
{ACROSS|ON} breakfield [AS 'text1'] sumoption [AS 'text2']
             [COLUMNS c1 [AND c2 ...]]

where:

breakfield

Is the ACROSS field whose for which you want to generate the summary option. The end of the values for the ACROSS field triggers the summary operation.

sumoption

Can be one of the following: SUBTOTAL, SUB-TOTAL, RECOMPUTE, or SUMMARIZE.

'text1'

Is the column heading to use for the break field on the report output.

'text2'

Is the text that prints on the top of the summary column.

COLUMNS c1, c2 ...

Lists the specific ACROSS values that you want to display on the report output in the order in which you want them. This list of values cannot be specified in an ON phrase. If it is specified in an ACROSS phrase, it must be the last option specified in the ACROSS phrase.



x
Reference: Usage Notes for Summaries on ACROSS Fields


Example: Using Summary Commands With ACROSS

The following request sums units and dollars and calculates the unit cost by product and across region and month. The ACROSS MNTH RECOMPUTE command creates totals of units and dollars, and recomputes the calculated value for the selected months within regions. The ACROSS REGION RECOMPUTE command does the same for the selected regions. The ON TABLE SUMMARIZE command creates summary rows. It has no effect on columns:

DEFINE FILE GGSALES
MNTH/MTr   = DATE;
END
TABLE FILE GGSALES
SUM
 UNITS/I5 AS 'UNITS'                   OVER
 DOLLARS/I6 AS 'DOLLARS'               OVER
 COMPUTE DOLLPER/I6 = DOLLARS/UNITS; AS 'UNIT COST'
BY PRODUCT
ACROSS REGION RECOMPUTE AS 'Region Sum' COLUMNS 'Northeast' AND 'West'
ACROSS MNTH   RECOMPUTE AS 'Month Sum' COLUMNS 'November' AND 'December'
WHERE DATE FROM '19971101' TO '19971231';
WHERE PRODUCT EQ 'Capuccino' OR 'Espresso';
ON TABLE SUMMARIZE AS 'Grand Total'
ON TABLE HOLD FORMAT HTML
END

The output is:


Top of page

x
Joining to a Fixed Format Sequential File Based on Multiple Fields

How to:

Reference:

A fixed format sequential data source can be the host or cross-referenced file in a join based on multiple fields. In a join TO a fixed format sequential file, both files that participate in the join must be sorted in ascending order of the concatenation of join fields and the sequential file must consist of a single segment.



x
Syntax: How to Join to a Fixed Format Sequential File Based on Multiple Fields
JOIN field1 AND field2 [AND field3 [AND field4]] IN file1 
 TO {ALL|MULTIPLE|UNIQUE} field1a AND field2a [AND field3a [AND field4a]]
 IN file2 AS joinname 
END

where:

file1

Is the host file.

file2

Is a single segment fixed format sequential file to be used as the cross referenced file.

field1, ... field4

Are up to four fields in the host file.

field1a, ... field4a

Are fields in the cross referenced file. Each join field must share formats and values with its corresponding field in the host file. The number of join fields in the cross referenced file must be the same as the number of join fields in the host file. The file must be sorted by the concatenation of the join fields.

joinname

Is a name assigned to the join.

ALL|MULTIPLE

Specifies a one-to-many join. All matching records in the cross referenced file will be retrieved.

UNIQUE

Specifies a one-to-one join. At most one matching record in the cross referenced file will be retrieved.

END

Is required to terminate the JOIN command if it spans multiple lines.



x
Reference: Usage Notes for Multi-Field Joins TO Fixed Format Sequential Files


Example: Joining to a Fixed Format Sequential Data Source Using Two Join Fields

The following request creates a fixed format sequential file named FIXSALE from the GGSALES data source. This file is sorted by store code and state:

SET ASNAMES = ON
TABLE FILE GGSALES
SUM PCD PRODUCT CATEGORY UNITS DOLLARS
BY STCD BY ST
ON TABLE HOLD AS FIXSALE FORMAT ALPHA
END

The following JOIN command joins the GGSTORES data source to the FIXSALE sequential file using two join fields. Both data sources are sorted on these join fields, store code and state:

JOIN STORE_CODE AND STATE IN GGSTORES
TO STCD AND ST IN FIXSALE AS JOIN1
END

The following request reports from the joined data source. The store name and zip code fields are from the GGSTORES data source and the UNITS and DOLLARS fields are from the FIXSALE file:

TABLE FILE GGSTORES
PRINT STORE_NAME ZIP UNITS DOLLARS
BY STORE_CODE BY ST
END

The output is:

Store ID  ST  Store Name               Zip Code     UNITS   DOLLARS
--------  --  ----------               --------     -----   -------
R1019     TX  GOTHAM GRINDS #1019      77201       299737   3714978
R1020     IL  GOTHAM GRINDS #1020      60601       307581   3924401
R1040     CA  GOTHAM GRINDS #1040      90001       298070   3772014
R1041     GA  GOTHAM GRINDS #1041      30314       330283   4100107
R1044     MA  GOTHAM GRINDS #1044      02101       301909   3707986
R1088     TN  GOTHAM GRINDS #1088      38104       294647   3687057
R1100     CT  GOTHAM GRINDS #1100      06901       302440   3782049
R1109     NY  GOTHAM GRINDS #1109      10001       312326   3902275
R1200     FL  GOTHAM GRINDS #1200      32853       310302   3923215
R1244     CA  GOTHAM GRINDS #1244      94132       312500   3870258
R1248     WA  GOTHAM GRINDS #1248      98101       321469   4010685
R1250     MO  GOTHAM GRINDS #1250      48880       297727   3761286

Top of page

x
Ranking Sort Field Values With the RNK. Prefix Operator

How to:

RANKED BY fieldname, when used in a sort phrase in a TABLE request, not only sorts the data by the specified field, but assigns a RANK value to the instances. The RNK. prefix operator also calculates the rank while allowing the RANK value to be printed anywhere on the page. You use this operator by specifying RNK.fieldname, where fieldname is a BY field in the request.

The ranking process occurs after selecting and sorting records. Therefore, the RNK. operator cannot be used in a WHERE or IF selection test or in a virtual (DEFINE) field. However, RNK.fieldname can be used in a WHERE TOTAL or IF TOTAL test or in a calculated (COMPUTE) value. You can change the default column title for the rank field using an AS phrase.

You can apply the RNK. operator to multiple sort fields, in which case the rank for each BY field is calculated within its higher level BY field.



x
Syntax: How to Calculate Ranks Using the RNK. Prefix Operator

In a PRINT command, COMPUTE expression, or IF/WHERE TOTAL expression:

RNK.field  ...

where:

field

Is a vertical (BY) sort field in the request.



Example: Ranking Within Sort Groups

The following request ranks years of service within department and ranks salary within years of service and department. Note that years of service depends on the value of TODAY. The output for this example was valid when run in September, 2006:

DEFINE FILE EMPDATA
  TODAY/YYMD = &YYMD;
  YRS_SERVICE/I9 = DATEDIF(HIREDATE,TODAY,'Y');
END
TABLE FILE EMPDATA
PRINT SALARY
  RNK.YRS_SERVICE AS 'RANKING,BY,SERVICE'
  RNK.SALARY AS 'SALARY,RANK'
     BY DEPT
     BY HIGHEST YRS_SERVICE
     BY HIGHEST SALARY NOPRINT
WHERE DEPT EQ 'MARKETING' OR 'SALES'
ON TABLE SET PAGE NOPAGE
END

The output is:

                                                    RANKING
                                                    BY       SALARY
DEPT                  YRS_SERVICE           SALARY  SERVICE  RANK
----                  -----------           ------  -------  ------
MARKETING                      17       $55,500.00        1       1
                                        $55,500.00        1       1
                               16       $62,500.00        2       1
                                        $62,500.00        2       1
                                        $62,500.00        2       1
                                        $58,800.00        2       2
                                        $52,000.00        2       3
                                        $35,200.00        2       4
                                        $32,300.00        2       5
                               15       $50,500.00        3       1
                                        $43,400.00        3       2
SALES                          17      $115,000.00        1       1
                                        $54,100.00        1       2
                               16       $70,000.00        2       1
                                        $43,000.00        2       2
                               15       $43,600.00        3       1
                                        $39,000.00        3       2
                               15       $30,500.00        3       3


Example: Using RNK. in a WHERE TOTAL Test

The following request displays only those rows in the highest two salary ranks within the years of service category. Note that years of service depends on the value of TODAY. The output for this example was valid when run in September, 2006:

DEFINE FILE EMPDATA
  TODAY/YYMD = &YYMD;
  YRS_SERVICE/I9 = DATEDIF(HIREDATE,TODAY,'Y');
END
TABLE FILE EMPDATA
PRINT LASTNAME FIRSTNAME RNK.SALARY
BY HIGHEST YRS_SERVICE BY HIGHEST SALARY
WHERE TOTAL RNK.SALARY LE 2
END

The output is:

                                                           RANK
YRS_SERVICE           SALARY  LASTNAME         FIRSTNAME   SALARY
-----------           ------  --------         ---------   ------
         17      $115,000.00  LASTRA           KAREN            1
                  $80,500.00  NOZAWA           JIM              2
         16       $83,000.00  SANCHEZ          EVELYN           1
                  $70,000.00  CASSANOVA        LOIS             2
         15       $62,500.00  HIRSCHMAN        ROSE             1
                              WANG             JOHN             1
                  $50,500.00  LEWIS            CASSANDRA        2


Example: Using RNK. in a COMPUTE Command

The following request sets a flag to Y for records in which the salary rank within department is less than or equal to 5 and the rank of years of service within salary and department is less than or equal to 6. Otherwise, the flag has the value N. Note that years of service depends on the value of TODAY. The output for this example was valid when run in September, 2006:

DEFINE FILE EMPDATA
  TODAY/YYMD = &YYMD;
  YRS_SERVICE/I9 = DATEDIF(HIREDATE,TODAY,'Y');
END
PRINT RNK.SALARY RNK.YRS_SERVICE
COMPUTE FLAG/A1 = IF RNK.SALARY LE 5  AND RNK.YRS_SERVICE LE 6
    THEN 'Y' ELSE 'N';
BY DEPT BY SALARY BY YRS_SERVICE
WHERE DEPT EQ 'MARKETING' OR 'SALES'
ON TABLE SET PAGE NOPAGE
END

The output is:

                                                 RANK   RANK
DEPT                          SALARY YRS_SERVICE SALARY YRS_SERVICE FLAG
----                          ------ ----------- ------ ----------- ----
MARKETING                 $32,300.00          16      1           1 Y
                          $35,200.00          16      2           1 Y
                          $43,400.00          15      3           1 Y
                          $50,500.00          15      4           1 Y
                          $52,000.00          16      5           1 Y
                          $55,500.00          17      6           1 N
                                                      6           1 N
                          $58,800.00          16      7           1 N
                          $62,500.00          16      8           1 N
                                                      8           1 N
                                                      8           1 N
SALES                     $30,500.00          15      1           1 Y
                          $39,000.00          15      2           1 Y
                          $43,000.00          16      3           1 Y
                          $43,600.00          15      4           1 Y
                          $54,100.00          17      5           1 Y
                          $70,000.00          16      6           1 N
                         $115,000.00          17      7           1 N

Top of page

x
Displaying a Row for Data Excluded by a Sort Phrase (PLUS OTHERS)

How to:

Reference:

In a sort phrase, you can restrict the number of sort values displayed. With the PLUS OTHERS phrase, you can aggregate all other values to a separate group and display this group as an additional report row.



x
Syntax: How to Display Data Excluded by a Sort Phrase
[RANKED] BY {HIGHEST|LOWEST|TOP|BOTTOM} nsrtfield [AS 'text']
            [PLUS OTHERS AS 'othertext']
            [IN-GROUPS-OF m1 [TOP n2]]
            [IN-RANGES-OF m3 [TOP n4]

where:

LOWEST

Sorts in ascending order, beginning with the lowest value and continuing to the highest value (a-z, A-Z, 0-9 for alphanumeric fields; 0-9 for numeric fields). BOTTOM is a synonym for LOWEST.

HIGHEST

Sorts in descending order, beginning with the highest value and continuing to the lowest value. TOP is a synonym for HIGHEST.

n

Specifies that only n sort field values are included in the report

srtfield

Is the name of the sort field.

text

Is the text to be used as the column heading for the sort field values.

othertext

Is the text to be used as the row title for the "others" grouping. This AS phrase must be the AS phrase immediately following the PLUS OTHERS phrase.

m1

Is the incremental value between sort field groups.

n2

Is an optional number that defines the highest group label to be included in the report.

m3

Is an integer greater than zero indicating the range by which sort field values are grouped.

n4

Is an optional number that defines the highest range label to be included in the report. The range is extended to include all data values higher than this value.



x
Reference: Usage Notes for PLUS OTHERS


Example: Displaying a Row Representing Sort Field Values Excluded by a Sort Phrase

The following request displays the top two ED_HRS values and aggregates the values not included in a row labeled Others:

TABLE FILE EMPLOYEE
PRINT CURR_SAL LAST_NAME
  BY HIGHEST 2 ED_HRS
  PLUS OTHERS AS 'Others'
END

The output is:

ED_HRS         CURR_SAL  LAST_NAME
------         --------  ---------
 75.00       $21,780.00  BLACKWOOD
 50.00       $18,480.00  JONES
             $16,100.00  MCKNIGHT
Others      $165,924.00


Example: Displaying a Row Representing Data Not Included in Any Sort Field Grouping

The following request sorts by highest 2 ED_HRS and groups the sort field values by increments of 25 ED_HRS. Values that fall below the lowest group label are included in the Others category. All values above the top group label are included in the top group:

TABLE FILE EMPLOYEE
PRINT CURR_SAL LAST_NAME
  BY HIGHEST 2 ED_HRS
  PLUS OTHERS AS 'Others'
IN-GROUPS-OF 25 TOP 50
END

The output is:

ED_HRS         CURR_SAL  LAST_NAME
------         --------  ---------
 50.00       $18,480.00  JONES
             $21,780.00  BLACKWOOD
             $16,100.00  MCKNIGHT
 25.00       $11,000.00  STEVENS
             $13,200.00  SMITH
             $26,862.00  IRVING
              $9,000.00  GREENSPAN
             $27,062.00  CROSS
Others       $78,800.00

If the BY HIGHEST phrase is changed to BY LOWEST, all values above the top grouping (50 ED_HRS and above) are included in the Others category:

TABLE FILE EMPLOYEE
PRINT CURR_SAL LAST_NAME
  BY LOWEST 2 ED_HRS
  PLUS OTHERS AS 'Others'
IN-GROUPS-OF 25 TOP 50
END

The output is:

ED_HRS         CURR_SAL  LAST_NAME
------         --------  ---------
   .00        $9,500.00  SMITH
             $29,700.00  BANNING
             $21,120.00  ROMANS
             $18,480.00  MCCOY
 25.00       $11,000.00  STEVEN
             $13,200.00  SMITH
             $26,862.00  IRVING
              $9,000.00  GREENSPAN
             $27,062.00  CROSS
Others       $56,360.00

Top of page

x
SET EMPTYREPORT=ANSI

How to:

The EMPTYREPORT=ANSI setting introduces ANSI-compliant handling of reports with zero records, producing a one-line report containing only the specified missing data character. If the request is a COUNT operation, however, a zero is displayed for the missing values.



x
Syntax: How to Produce ANSI-Compliant Reports With No Records
SET EMPTYREPORT={ANSI|ON|OFF}

where:

ANSI

Produces a single-line report and displays the missing data character or a zero if a COUNT is requested. in each case, &RECORDS will be 0, and &LINES will be 1.

If the SQL Translator is invoked, ANSI automatically replaces OFF as the default setting for EMPTYREPORT.

ON

Produces an empty report (column headings with no content). This was the default behavior in prior releases.

OFF

Produces no report output. OFF is the default value except for SQL Translator requests. When the SQL Translator is invoked, ANSI replaces OFF as the default setting for the EMPTYREPORT parameter, so the results are the same as for the ANSI setting.

The command can also be issued from within a request:

ON TABLE SET EMPTYREPORT ANSI


Example: Counting Fields With SET EMPTYREPORT=ANSI
SET EMPTYREPORT=ANSI
TABLE FILE EMPLOYEE
COUNT CURR_SAL AND DEPARTMENT
WHERE LAST_NAME EQ 'PATRICK'
END

The output shows no records and one line, with a zero displayed for CURR_SAL and a period for Department:

NUMBER OF RECORDS IN TABLE=        0  LINES=      1
PAUSE.. PLEASE ISSUE CARRIAGE RETURN WHEN READY
 
CURR_SAL  DEPARTMENT
COUNT     COUNT
--------  ----------
       0           0


Example: Summing Fields With EMPTYREPORT=ANSI
SET EMPTYREPORT=ANSI
TABLE FILE EMPLOYEE
SUM CURR_SAL
IF LAST_NAME EQ 'PATRICK'
END

Note that with SUM, the default missing data character (.) is displayed for CURR_SAL.

>
 NUMBER OF RECORDS IN TABLE=        0  LINES=      1
  PAUSE.. PLEASE ISSUE CARRIAGE RETURN WHEN READY
 
CURR_SAL
--------
       .


Example: Setting EMPTYREPORT=ON
SET EMPTYREPORT=ON
TABLE FILE EMPLOYEE
PRINT CURR_SAL AND DEPARTMENT
IF LAST_NAME EQ 'PATRICK'
END

With EMPTYREPORT=ON, there are no lines in the report.

>
 NUMBER OF RECORDS IN TABLE=        0  LINES=      0
  PAUSE.. PLEASE ISSUE CARRIAGE RETURN WHEN READY
 
CURR_SAL  DEPARTMENT
--------  ----------


Example: Printing Fields and Setting EMPTYREPORT=ANSI in the Request

With PRINT you get one line, with the default missing data character (.) displayed.

TABLE FILE EMPLOYEE
PRINT CURR_SAL AND DEPARTMENT
IF DEPARTMENT EQ 'PATRICK'
ON TABLE SET EMPTYREPORT ANSI
END

The output is:

NUMBER OF RECORDS IN TABLE=        0  LINES=      1
PAUSE.. PLEASE ISSUE CARRIAGE RETURN WHEN READY
 
CURR_SAL  DEPARTMENT
--------  ----------
       .  .

Top of page

x
Preserving Filter Definitions During Join Parsing

How to:

By default, filters defined on the host data source are cleared by a JOIN command. However, filters can be maintained when a JOIN command is issued, by issuing the SET KEEPFILTERS=ON command.

Setting KEEPFILTERS to ON reinstates filter definitions and their individual declared status after a JOIN command. The set of filters and virtual fields defined prior to each join is called a context (see your documentation on SET KEEPDEFINES and on DEFINE FILE SAVE for information about contexts as they relate to virtual fields). Each new JOIN or DEFINE FILE command creates a new context.

If a new filter is defined after a JOIN command, it cannot have the same name as any previously defined filter unless you issue the FILTER FILE command with the CLEAR option. The CLEAR option clears all filter definitions for that data source in all contexts.

When a JOIN is cleared, each filter definition that was in effect prior to the JOIN command and that was not cleared, is reinstated with its original status. Clearing a join by issuing the JOIN CLEAR join_name command removes all of the contexts and filter definitions that were created after the JOIN join_name command was issued.



x
Syntax: How to Preserve Filter Definitions With KEEPFILTERS
SET KEEPFILTERS = {OFF|ON}

where:

OFF

Does not preserve filters issued prior to a join. This is the default value.

ON

Preserves filters across joins.



Example: Preserving Filters With KEEPFILTERS

The first filter, UNITPR, is defined prior to issuing any joins, but after setting KEEPFILTERS to ON:

SET KEEPFILTERS = ON
FILTER FILE VIDEOTRK
PERUNIT/F5 = TRANSTOT/QUANTITY;
NAME=UNITPR
WHERE PERUNIT GT 2
WHERE LASTNAME LE 'CRUZ'
END

The ? FILTER command shows that the filter named UNITPR was created but not activated (activation is indicated by an asterisk in the SET column of the display:

? FILTER
 
SET FILE     FILTER NAME DESCRIPTION
--- -------- ----------- ---------------------------------
    VIDEOTRK UNITPR

Next the filter is activated:

SET FILTER= UNITPR IN VIDEOTRK ON

The ? FILTER query shows that the filter is now activated:

? FILTER
 
SET FILE     FILTER NAME DESCRIPTION
--- -------- ----------- --------------------------------- 
*   VIDEOTRK UNITPR

The following TABLE request is issued against the filtered data source:

TABLE FILE VIDEOTRK
SUM QUANTITY TRANSTOT BY LASTNAME
END

The output shows that the TABLE request retrieved only the data that satisfies the UNITPR filter:

NUMBER OF RECORDS IN TABLE=        6  LINES=      3
ACCESS LIMITED BY FILTERS
 
PAUSE.. PLEASE ISSUE CARRIAGE RETURN WHEN READY
 
LASTNAME         QUANTITY  TRANSTOT
--------         --------  --------
CHANG                   3     31.00
COLE                    2     18.98
CRUZ                    2     16.00

Now, the VIDEOTRK data source is joined to the MOVIES data source. The ? FILTER query shows that the join did not clear the UNITPR filter:

JOIN MOVIECODE IN VIDEOTRK TO ALL MOVIECODE IN MOVIES AS J1

The ? FILTER command shows that the UNITPR filter still exists and is still activated:

? FILTER
 
SET FILE     FILTER NAME DESCRIPTION
--- -------- ----------- --------------------------------- 
*   VIDEOTRK UNITPR

Next a new filter, YEARS1, is created and activated for the join between VIDEOTRK and MOVIES:

FILTER FILE VIDEOTRK
YEARS/I5 = (EXPDATE - TRANSDATE)/365;
NAME=YEARS1
WHERE YEARS GT 1
END
SET FILTER= YEARS1 IN VIDEOTRK ON

The ? FILTER query shows that both the UNITPR and YEARS1 filters exist and are activated:

? FILTER
 
SET FILE     FILTER NAME DESCRIPTION
--- -------- ----------- ---------------------------------
*   VIDEOTRK UNITPR
*   VIDEOTRK YEARS1

Now, J1 is cleared. The output of the ? FILTER command shows that the YEARS1 filter that was created after the JOIN command was issued no longer exists. The UNITPR filter created prior to the JOIN command still exists with its original status:

JOIN CLEAR J1
? FILTER
 
SET FILE     FILTER NAME DESCRIPTION
--- -------- ----------- ---------------------------------
*   VIDEOTRK UNITPR

Top of page

x
SET SUMMARYLINES=EXPLICIT

How to:

Reference:

The SET SUMMARYLINES=EXPLICIT command makes the processing of SUBTOTAL, SUB-TOTAL, SUMMARIZE, and RECOMPUTE on the grand total line consistent with how they work for sort field breaks.

When SUBTOTAL and RECOMPUTE are used at a sort break level, they do not propagate to other sort breaks. SUB-TOTAL and SUMMARIZE propagate to all higher level sort breaks.

The grand total can be considered the highest level sort field in a request. However, by default, all of the summary options, not just SUB-TOTAL and SUMMARIZE, propagate to the grand total level.

The SET SUMMARYLINES=EXPLICIT prevents the propagation of SUBTOTAL and RECOMPUTE to the grand total. In addition, if all summary commands in the request specify field lists, only the specified fields are aggregated and displayed on the grand total line.

When SUBTOTAL and RECOMPUTE are the only summary commands used in the request, a grand total line is produced only if it is explicitly specified in the request using the ON TABLE SUBTOTAL/SUB-TOTAL/RECOMPUTE/SUMMARIZE phrase. If the ON TABLE phrase specifies a field list, only those fields are aggregated and displayed.

Note that you can always suppress the grand total line using the ON TABLE NOTOTAL command in the request.



x
Syntax: How to Prevent Propagation of SUBTOTAL and RECOMPUTE to the Grand Total
SET SUMMARYLINES = {OLD|NEW|EXPLICIT}

where:

OLD

Propagates all summary operations to the grand total line. Does not allow mixing of fields with and without prefix operators on a summary command when the first field does not have an associated prefix operator. All fields listed in any summary command are populated on all summary lines. OLD is the default value.

NEW

Propagates all summary operations to the grand total line. Uses prefix operator processing for all summary commands (all summary fields without prefix operators are processed as though they had a SUM. operator). Fields listed in a summary command are populated only on summary lines created by that summary command and on summary lines created by propagation of that summary command. Supports display of alphanumeric fields on summary lines.

EXPLICIT

Does not propagate SUBTOTAL and RECOMPUTE to the grand total line. Uses prefix operator processing for all summary commands (all summary fields without prefix operators are processed as though they had a SUM. operator). Fields listed in a summary command are populated only on summary lines created by that summary command and on summary lines created by propagation of that summary command. Supports display of alphanumeric fields on summary lines.

Note: This command is not supported in a request using the ON TABLE SET syntax.



x
Reference: Usage Notes for SET SUMMARYLINES=EXPLICIT

If COLUMN-TOTAL is specified in the request, all numeric fields are totaled on the grand total line unless the COLUMN-TOTAL phrase lists specific fields. If the COLUMN-TOTAL phrase lists specific fields, those fields and any fields propagated by SUB-TOTAL or SUMMARIZE commands are totaled.



Example: Using SET SUMMARYLINES With SUBTOTAL

The following request using the MOVIES data source has a sort break for CATEGORY that subtotals the COPIES field and a sort break for RATING that subtotals the LISTPR field:

SET SUMMARYLINES=OLD
TABLE FILE MOVIES
SUM COPIES LISTPR WHOLESALEPR
BY RATING
BY CATEGORY
WHERE CATEGORY EQ 'CHILDREN'
WHERE RATING   EQ 'G'
ON RATING SUBTOTAL COPIES
ON CATEGORY SUBTOTAL LISTPR
END

Running the request with SUMMARYLINES=OLD subtotals both COPIES and LISTPR at every sort break and propagates them to the grand total line:

RATING  CATEGORY  COPIES  LISTPR  WHOLESALEPR
------  --------  ------  ------  -----------
G       CHILDREN       7  101.89        54.49
 
*TOTAL CHILDREN        7  101.89
*TOTAL G               7  101.89
 
 
TOTAL                  7  101.89

Running the request with SUMMARYLINES=NEW subtotals COPIES only for the RATING sort break and subtotals LISTPR only for the CATEGORY sort break but propagates both to the grand total line:

RATING  CATEGORY  COPIES  LISTPR  WHOLESALEPR
------  --------  ------  ------  -----------
G       CHILDREN       7  101.89        54.49
 
*TOTAL CHILDREN           101.89
*TOTAL G               7
 
 
TOTAL                  7  101.89

Running the request with SUMMARYLINES=EXPLICIT subtotals COPIES only for the RATING sort break and subtotals LISTPR only for the CATEGORY sort break. It does not produce a grand total line:

RATING  CATEGORY  COPIES  LISTPR  WHOLESALEPR
------  --------  ------  ------  -----------
G       CHILDREN       7  101.89        54.49
 
*TOTAL CHILDREN           101.89
*TOTAL G               7

Adding the phrase ON TABLE SUBTOTAL WHOLESALEPR with SUMMARYLINES=EXPLICIT produces a grand total line with the WHOLESALEPR field subtotaled:

RATING  CATEGORY  COPIES  LISTPR  WHOLESALEPR
------  --------  ------  ------  -----------
G       CHILDREN       7  101.89        54.49
 
*TOTAL CHILDREN           101.89
*TOTAL G               7
 
 
TOTAL                                   54.49


Example: Using COLUMN-TOTAL With SET SUMMARYLINES=EXPLICIT

The following request using the MOVIES data source has a sort break for CATEGORY for which subtotals the COPIES field and a sort break for RATING that subtotals the LISTPR field. It also has an ON TABLE COLUMN-TOTAL phrase:

SET SUMMARYLINES=EXPLICIT
TABLE FILE MOVIES
SUM COPIES LISTPR WHOLESALEPR
BY RATING
BY CATEGORY
WHERE CATEGORY EQ 'CHILDREN'
WHERE RATING   EQ 'G'
ON RATING SUBTOTAL COPIES
ON CATEGORY SUBTOTAL LISTPR
ON TABLE COLUMN-TOTAL
END

The grand total line displays a column total for all numeric columns because of the ON TABLE COLUMN-TOTAL phrase:

RATING  CATEGORY  COPIES  LISTPR  WHOLESALEPR
------  --------  ------  ------  -----------
G       CHILDREN       7  101.89        54.49
 
*TOTAL CHILDREN           101.89
*TOTAL G               7
 
 
TOTAL                  7  101.89        54.49

The following request has an ON TABLE SUBTOTAL WHOLESALEPR command. It also has an ON TABLE COLUMN-TOTAL phrase:

SET SUMMARYLINES=EXPLICIT
TABLE FILE MOVIES
SUM COPIES LISTPR WHOLESALEPR
BY RATING
BY CATEGORY
WHERE CATEGORY EQ 'CHILDREN'
WHERE RATING   EQ 'G'
ON RATING SUBTOTAL COPIES
ON CATEGORY SUBTOTAL LISTPR
ON TABLE SUBTOTAL WHOLESALEPR
ON TABLE COLUMN-TOTAL
END

The grand total line displays a column total only for the WHOLESALEPR column because of the ON TABLE SUBTOTAL command:

RATING  CATEGORY  COPIES  LISTPR  WHOLESALEPR
------  --------  ------  ------  -----------
G       CHILDREN       7  101.89        54.49
 
*TOTAL CHILDREN           101.89
*TOTAL G               7
 
 
TOTAL                                   54.49

Using SUB-TOTAL instead of SUBTOTAL causes COPIES and LISTPR to be aggregated on the grand total line. WHOLESALEPR is totaled because it is listed in the COLUMN-TOTAL phrase. The subtotal for LISTPR propagates to the RATING sort break as well as to the grand total:

SET SUMMARYLINES=EXPLICIT
TABLE FILE MOVIES
SUM COPIES LISTPR WHOLESALEPR
BY RATING
BY CATEGORY
WHERE CATEGORY EQ 'CHILDREN'
WHERE RATING   EQ 'G'
ON RATING SUB-TOTAL COPIES
ON CATEGORY SUB-TOTAL LISTPR
ON TABLE COLUMN-TOTAL WHOLESALEPR
END

The output is:

RATING  CATEGORY  COPIES  LISTPR  WHOLESALEPR
------  --------  ------  ------  -----------
G       CHILDREN       7  101.89        54.49
 
*TOTAL CHILDREN           101.89
*TOTAL G               7  101.89
 
 
TOTAL                  7  101.89        54.49

Top of page

x
ON TABLE SET BYPANEL

How to:

The SET BYPANEL command, which controls whether vertical sort (BY) fields are repeated on each panel of a report, is now supported in a TABLE request.



x
Syntax: How to Control Repetition of BY Fields on Report Panels in a Request
ON TABLE SET BYPANEL = option 
END

where:

option

Is one of the following:

ON displays all BY fields specified in the report request on each panel, and prevents column splitting.

OFF displays BY fields on the first panel only. Column splitting is permitted. OFF is the default value.

0 displays BY fields only on the first panel. This prevents column splitting.

n is the number of BY fields to be displayed; n is less than or equal to the total number of BY fields specified in the request, from the major sort (first BY field) down. This prevents column splitting.

Column splitting occurs when a report column is too large to fit on the defined panel. By default, the column is split, displaying as many characters as possible, and the remaining characters continue on the next panel.


Top of page

x
Left Outer Join Support

How to:

Reference:

When you join two data sources, some records in one of the files may lack corresponding records in the other file. When a report omits records that are not in both files, the join is called an inner join. When a report displays all matching records, plus all records from the host file that lack corresponding cross-referenced records, the join is called a left outer join.

The SET ALL command globally determines how all joins are implemented. If the SET ALL=ON command is issued, all joins are treated as outer joins. With SET ALL=OFF, the default, all joins are treated as inner joins.

Each JOIN command can specify explicitly which type of join to perform, locally overruling the global setting. This syntax is supported for FOCUS, XFOCUS, Relational, VSAM, IMS, and Adabas. If you do not specify the type of join in the JOIN command, the ALL parameter setting determines the type of join to perform.



x
Reference: Relational Data Adapters and Optimization of LEFT OUTER/INNER JOINs

The relational data adapters can optimize (translate to a single SQL SELECT statement processed by the relational engine) outer joins and combinations of joins under the following conditions:

A left outer join in the root path (path leading to the root segment) of an inner join is converted to an inner join and the following message is generated:

(FOC32456) ANSI-COMPLIANCE ENFORCED BY CHANGING OUTER JOIN TO INNER

A left outer join in the root-path of an inner join has been changed into an inner join.

Aggregation commands such as SUM or COUNT cause the RDBMS to duplicate data. This prevents the join from being optimized. However, in some cases the data adapter can eliminate duplicate rows before passing the data back to FOCUS. It does this by adding an ORDER BY clause on all primary key columns to the SELECT statement it passes to the RDBMS for each table so that it can compare the returned data from all of the tables. This is called data adapter managed native join optimization.

In order to invoke this type of optimization, primary keys must exist (KEYS>0 in the Access File) for all segments except for the lowest level segment referenced in a report request that includes:

In these situations, data adapter native join optimization is invoked regardless of the MULTIPATH setting.



x
Syntax: How to Specify an Inner or Left Outer Equijoin Between Real Fields
JOIN [LEFT_OUTER|INNER] hfld1 [AND hfld2 ...] IN hostfile [TAG tag1]
     TO [UNIQUE|MULTIPLE|ALL] crfield 
     [AND crfld2 ...] IN crfile [TAG tag2] [AS joinname]
END

where:

LEFT_OUTER

Specifies a left outer join. If you do not specify the type of join in the JOIN command, the ALL parameter setting determines the type of join to perform.

INNER

Specifies an inner join. If you do not specify the type of join in the JOIN command, the ALL parameter setting determines the type of join to perform.

hfld1

Is the name of a field in the host file containing values shared with a field in the cross-referenced file. This field is called the host field.

hfld2...

Can be an additional field in the host file, with the caveats noted below. The phrase beginning with AND is required when specifying multiple fields.

  • When you are joining two FOCUS data sources you can specify up to four alphanumeric fields in the host file that, if concatenated, contain values shared with the cross-referenced file. You may not specify more than one field in the cross-referenced file when the suffix of the file is FOC. For example, assume the cross-referenced file contains a phone number field with an area code-prefix-exchange format. The host file has an area code field, a prefix field, and an exchange field. You can specify these three fields to join them to the phone number field in the cross-referenced file. The JOIN command treats the three fields as one. Other data sources do not have this restriction on the cross-referenced file.
  • For data adapters that support multi-field and concatenated joins, you can specify up to 16 fields. See your data adapter documentation for specific information about supported join features. Note that FOCUS data sources do not support these joins.
hostfile

Is the name of the host file.

tag1

Is a tag name of up to eight characters (usually the name of the Master File), which is used as a unique qualifier for fields and aliases in the host file.

The tag name for the host file must be the same in all the JOIN commands of a joined structure.

TO [UNIQUE|MULTIPLE|ALL] crfld1

Is the name of a field in the cross-referenced file containing values that match those of hfld1 (or of concatenated host fields). This field is called the cross-referenced field.

Note: UNIQUE returns only one instance and, if there is no matching instance in the cross-referenced file, it supplies default values (blank for alphanumeric fields and zero for numeric fields).

Use the MULTIPLE parameter when crfld1 may have multiple instances in common with one value in hfld1. Note that ALL is a synonym for MULTIPLE, and omitting this parameter entirely is a synonym for UNIQUE.

crfld2...

Is the name of a field in the cross-referenced file with values in common with hfld2.

Note: crfld2 may be qualified. This field is only available for data adapters that support multi-field joins.

crfile

Is the name of the cross-referenced file.

tag2

Is a tag name of up to eight characters (usually the name of the Master File), which is used as a unique qualifier for fields and aliases in cross-referenced files. In a recursive join structure, if no tag name is provided, all field names and aliases are prefixed with the first four characters of the join name.

The tag name for the host file must be the same in all the JOIN commands of a joined structure.

joinname

Is an optional name of up to eight characters that you may assign to the join structure. You must assign a unique name to a join structure if:

  • You want to ensure that a subsequent JOIN command does not overwrite it.
  • You want to clear it selectively later.
  • The structure is recursive.

Note: If you do not assign a name to the join structure with the AS phrase, the name is assumed to be blank. A join without a name overwrites an existing join without a name.

END

Required when the JOIN command is longer than one line; it terminates the command.

For information about required conditions for cross-referenced fields and restrictions on group fields, see the Creating Reports manual.



x
Syntax: How to Specify an Inner or Left Outer DEFINE-based Equijoin
JOIN [LEFT_OUTER|INNER] deffld WITH host_field ... 
     IN hostfile [TAG tag1]
     TO [UNIQUE|MULTIPLE|ALL] cr_field 
     IN crfile [TAG tag2] [AS joinname]
END

where:

LEFT_OUTER

Specifies a left outer join. If you do not specify the type of join in the JOIN command, the ALL parameter setting determines the type of join to perform.

INNER

Specifies an inner join. If you do not specify the type of join in the JOIN command, the ALL parameter setting determines the type of join to perform.

deffld

Is the name of a virtual field for the host file (the host field). The virtual field can be defined in the Master File or with a DEFINE command.

host_field

Is the name of any real field in the host segment with which you want to associate the virtual field. This association is required to locate the virtual field.

The WITH phrase is required unless the KEEPDEFINES parameter is set to ON and deffld was defined prior to issuing the JOIN command.

To determine which segment contains the virtual field, use the ? DEFINE query after issuing the DEFINE command.

hostfile

Is the name of the host file.

tag1

Is a tag name of up to eight characters (usually the name of the Master File), which is used as a unique qualifier for fields and aliases in host files.

The tag name for the host file must be the same in all the JOIN commands of a joined structure.

TO [UNIQUE|MULTIPLE|ALL] crfld1

Is the name of a real field in the cross-referenced data source whose values match those of the virtual field. This must be a real field declared in the Master File.

Note: UNIQUE returns only one instance and, if there is no matching instance in the cross-referenced file, it supplies default values (blank for alphanumeric fields and zero for numeric fields).

Use the MULTIPLE parameter when crfld1 may have multiple instances in common with one value in hfld1. Note that ALL is a synonym for MULTIPLE, and omitting this parameter entirely is a synonym for UNIQUE.

crfile

Is the name of the cross-referenced file.

tag2

Is a tag name of up to eight characters (usually the name of the Master File), which is used as a unique qualifier for fields and aliases in cross-referenced files. In a recursive joined structure, if no tag name is provided, all field names and aliases are prefixed with the first four characters of the join name.

The tag name for the host file must be the same in all the JOIN commands of a joined structure.

joinname

Is an optional name of up to eight characters that you may assign to the joined structure. You must assign a unique name to a join structure if:

  • You want to ensure that a subsequent JOIN command does not overwrite it.
  • You want to clear it selectively later.
  • The structure is recursive, and you do not specify tag names.

If you do not assign a name to the joined structure with the AS phrase, the name is assumed to be blank. A join without a name overwrites an existing join without a name.

END

Required when the JOIN command is longer than one line; terminates the command.

For information about required conditions for cross-referenced fields and restrictions on group fields, see the Creating Reports manual.



x
Syntax: How to Specify an Inner or Left Outer Conditional JOIN
JOIN [LEFT_OUTER|INNER] FILE hostfile AT hfld1     [WITH hfld2] [TAG tag1]
     TO {UNIQUE|MULTIPLE|ALL} 
     FILE crfile AT crfld [TAG tag2] [AS joinname]
     [WHERE expression1;
     [WHERE expression2;
     ...]
 
END

where:

LEFT_OUTER

Specifies a left outer join. If you do not specify the type of join in the JOIN command, the ALL parameter setting determines the type of join to perform.

INNER

Specifies an inner join. If you do not specify the type of join in the JOIN command, the ALL parameter setting determines the type of join to perform.

hostfile

Is the host Master File.

AT

Links the correct parent segment or host to the correct child or cross-referenced segment. The field values used as the AT parameter are not used to cause the link. They are simply used as segment references.

hfld1

Is the field name in the host Master File whose segment will be joined to the cross-referenced data source. The field name must be at the lowest level segment in its data source that is referenced.

tag1

Is the optional tag name that is used as a unique qualifier for fields and aliases in the host data source.

hfld2

Is a data source field with which to associate a DEFINE-based conditional JOIN. For a DEFINE-based conditional join, the KEEPDEFINES setting must be ON, and you must create the virtual fields before issuing the JOIN command.

UNIQUE

Specifies a one-to-one relationship between from_file and to_file. Note that ONE is a synonym for UNIQUE.

Note: Unique returns only one instance and, if there is no matching instance in the cross-referenced file, it supplies default values (blank for alphanumeric fields and zero for numeric fields).

MULTIPLE|ALL

Specifies a one-to-many relationship between from_file and to_file. Note that ALL is a synonym for MULTIPLE.

crfile

Is the cross-referenced Master File.

crfld

Is the join field name in the cross-referenced Master File. It can be any field in the segment.

tag2

Is the optional tag name that is used as a unique qualifier for fields and aliases in the cross-referenced data source.

joinname

Is the name associated with the joined structure.

expression1, expression2

Are any expressions that are acceptable in a DEFINE FILE command. All fields used in the expressions must lie on a single path.

Note: Single line JOIN syntax is not supported. The END command is required.



x
Reference: Usage Notes for Inner and Outer JOIN Command Syntax


x
Procedure: How to Create Data Sources Used in Inner and Left Outer Join Examples

The following procedure creates three FOCUS data sources:

The procedure then adds an employee to EMPINFO named Fred Newman who has no matching record in the JOBINFO or EDINFO data sources.

TABLE FILE EMPLOYEE
SUM LAST_NAME FIRST_NAME CURR_JOBCODE
BY EMP_ID
ON TABLE HOLD AS EMPINFO FORMAT FOCUS INDEX EMP_ID CURR_JOBCODE
END
-RUN
 
TABLE FILE JOBFILE
SUM JOB_DESC
BY JOBCODE
ON TABLE HOLD AS JOBINFO FORMAT FOCUS INDEX JOBCODE
END
-RUN
 
TABLE FILE EDUCFILE
SUM COURSE_CODE COURSE_NAME
BY EMP_ID
ON TABLE HOLD AS EDINFO FORMAT FOCUS INDEX EMP_ID
END
-RUN
 
MODIFY FILE EMPINFO
FREEFORM EMP_ID LAST_NAME FIRST_NAME CURR_JOBCODE
MATCH EMP_ID
ON NOMATCH INCLUDE
ON MATCH REJECT
DATA
111111111, NEWMAN, FRED, C07,$
END

The following request prints the contents of EMPINFO. Note that Fred Newman has been added to the data source:

TABLE FILE EMPINFO
PRINT *
END

The output is:

EMP_ID     LAST_NAME        FIRST_NAME  CURR_JOBCODE
------     ---------        ----------  ------------
071382660  STEVENS          ALFRED      A07
112847612  SMITH            MARY        B14
117593129  JONES            DIANE       B03
119265415  SMITH            RICHARD     A01
119329144  BANNING          JOHN        A17
123764317  IRVING           JOAN        A15
126724188  ROMANS           ANTHONY     B04
219984371  MCCOY            JOHN        B02
326179357  BLACKWOOD        ROSEMARIE   B04
451123478  MCKNIGHT         ROGER       B02
543729165  GREENSPAN        MARY        A07
818692173  CROSS            BARBARA     A17
111111111  NEWMAN           FRED        C07


Example: Creating an Inner Join

The following JOIN command creates an inner join between the EMPINFO data source and the JOBINFO data source.

JOIN CLEAR *
JOIN INNER CURR_JOBCODE IN EMPINFO TO MULTIPLE JOBCODE IN JOBINFO AS J0

Note that the JOIN command specifies a multiple join. In a unique join, the cross-referenced segment is never considered missing, and all records from the host file display on the report output. Default values (blank for alphanumeric fields and zero for numeric fields) display if no actual data exists.

The following request displays fields from the joined structure:

TABLE FILE EMPINFO
PRINT LAST_NAME FIRST_NAME JOB_DESC
END

Fred Newman is omitted from the report output because his job code does not have a match in the JOBINFO data source:

LAST_NAME        FIRST_NAME  JOB_DESC
---------        ----------  --------
STEVENS          ALFRED      SECRETARY
SMITH            MARY        FILE QUALITY
JONES            DIANE       PROGRAMMER ANALYST
SMITH            RICHARD     PRODUCTION CLERK
BANNING          JOHN        DEPARTMENT MANAGER
IRVING           JOAN        ASSIST.MANAGER
ROMANS           ANTHONY     SYSTEMS ANALYST
MCCOY            JOHN        PROGRAMMER
BLACKWOOD        ROSEMARIE   SYSTEMS ANALYST
MCKNIGHT         ROGER       PROGRAMMER
GREENSPAN        MARY        SECRETARY
CROSS            BARBARA     DEPARTMENT MANAGER


Example: Creating a Left Outer Join

The following JOIN command creates a left outer join between the EMPINFO data source and the EDINFO data source:

JOIN CLEAR *
JOIN LEFT_OUTER EMP_ID IN EMPINFO TO MULTIPLE EMP_ID IN EDINFO AS J1

The following request displays fields from the joined structure:

TABLE FILE EMPINFO
PRINT LAST_NAME FIRST_NAME COURSE_NAME
END

All employee records display on the report output. The records for those employees with no matching records in the EDINFO data source display the missing data character (.) in the COURSE_NAME column. If the join were unique, blanks would display instead of the missing data character.

LAST_NAME        FIRST_NAME  COURSE_NAME
---------        ----------  -----------
STEVENS          ALFRED      FILE DESCRPT & MAINT
SMITH            MARY        BASIC REPORT PREP FOR PROG
JONES            DIANE       FOCUS INTERNALS
SMITH            RICHARD     BASIC RPT NON-DP MGRS
BANNING          JOHN        .
IRVING           JOAN        .
ROMANS           ANTHONY     .
MCCOY            JOHN        .
BLACKWOOD        ROSEMARIE   DECISION SUPPORT WORKSHOP
MCKNIGHT         ROGER       FILE DESCRPT & MAINT
GREENSPAN        MARY        .
CROSS            BARBARA     HOST LANGUAGE INTERFACE
NEWMAN           FRED        .


Example: Creating Two Inner Joins With a Multipath Structure

The following JOIN commands create an inner join between the EMPINFO and JOBINFO data sources and an inner join between the EMPINFO and EDINFO data sources:

JOIN CLEAR *
JOIN INNER CURR_JOBCODE IN EMPINFO TO MULTIPLE JOBCODE IN JOBINFO AS J0
JOIN INNER EMP_ID IN EMPINFO TO MULTIPLE EMP_ID IN EDINFO AS J1

The structure created by the two joins has two independent paths:

         SEG01
 01      S1
**************
*EMP_ID      **I
*CURR_JOBCODE**I
*LAST_NAME   **
*FIRST_NAME  **
*            **
***************
 **************
       I
       +-----------------+
       I                 I
       I SEG01           I SEG01
 02    I KM        03    I KM
..............    ..............
:EMP_ID      ::K  :JOBCODE     ::K
:COURSE_CODE ::   :JOB_DESC    ::
:COURSE_NAME ::   :            ::
:            ::   :            ::
:            ::   :            ::
:............::   :............::
 .............:    .............:
 JOINED  EDINFO    JOINED  JOBINFO

The following request displays fields from the joined structure:

SET MULTIPATH=SIMPLE
TABLE FILE EMPINFO
PRINT LAST_NAME FIRST_NAME IN 12 COURSE_NAME JOB_DESC
END

With MULTIPATH=SIMPLE, the independent paths create independent joins. All employee records accepted by either join display on the report output. Only Fred Newman (who has no matching record in either of the cross-referenced files) is omitted:

LAST_NAME  FIRST_NAME  COURSE_NAME                     JOB_DESC
---------  ----------  -----------                     --------
STEVENS    ALFRED      FILE DESCRPT & MAINT            SECRETARY
SMITH      MARY        BASIC REPORT PREP FOR PROG      FILE QUALITY
JONES      DIANE       FOCUS INTERNALS                 PROGRAMMER ANALYST
SMITH      RICHARD     BASIC RPT NON-DP MGRS           PRODUCTION CLERK
BANNING    JOHN        .                               DEPARTMENT MANAGER
IRVING     JOAN        .                               ASSIST.MANAGER
ROMANS     ANTHONY     .                               SYSTEMS ANALYST
MCCOY      JOHN        .                               PROGRAMMER
BLACKWOOD  ROSEMARIE   DECISION SUPPORT WORKSHOP       SYSTEMS ANALYST
MCKNIGHT   ROGER       FILE DESCRPT & MAINT            PROGRAMMER
GREENSPAN  MARY        .                               SECRETARY
CROSS      BARBARA     HOST LANGUAGE INTERFACE         DEPARTMENT MANAGER

With MULTIPATH=COMPOUND, only employees with matching records in both of the cross-referenced files display on the report output:

LAST_NAME  FIRST_NAME  COURSE_NAME                     JOB_DESC
---------  ----------  -----------                     --------
STEVENS    ALFRED      FILE DESCRPT & MAINT            SECRETARY
SMITH      MARY        BASIC REPORT PREP FOR PROG      FILE QUALITY
JONES      DIANE       FOCUS INTERNALS                 PROGRAMMER ANALYST
SMITH      RICHARD     BASIC RPT NON-DP MGRS           PRODUCTION CLERK
BLACKWOOD  ROSEMARIE   DECISION SUPPORT WORKSHOP       SYSTEMS ANALYST
MCKNIGHT   ROGER       FILE DESCRPT & MAINT            PROGRAMMER
CROSS      BARBARA     HOST LANGUAGE INTERFACE         DEPARTMENT MANAGER


Example: Creating DB2 Data Sources Used in Join Examples

The following procedure creates DB2 data sources to use in join examples. This assumes the Master Files and Access Files for EMPINFO, JOBINFO, and EDINFO already exist and that you have the authority to create tables:

TABLE FILE EMPLOYEE
SUM LAST_NAME FIRST_NAME CURR_JOBCODE
BY EMP_ID
ON TABLE HOLD AS EMPF FORMAT FOCUS
END
-RUN
 
TABLE FILE JOBFILE
SUM JOB_DESC
BY JOBCODE
ON TABLE HOLD AS JOB1 FORMAT ALPHA
END
-RUN
 
TABLE FILE EDUCFILE
SUM COURSE_CODE COURSE_NAME
BY EMP_ID
ON TABLE HOLD AS ED1 FORMAT ALPHA
END
-RUN
 
-*Create new record with no match in job or ed files
MODIFY FILE EMPF
FREEFORM EMP_ID LAST_NAME FIRST_NAME CURR_JOBCODE
MATCH EMP_ID
 ON NOMATCH INCLUDE
 ON MATCH REJECT
DATA
111111111, NEWMAN, FRED, C07,$
END
-RUN
 
TABLE FILE EMPF
PRINT *
ON TABLE HOLD AS EMP1 FORMAT ALPHA
END
-RUN
 
-*Create DB2 tables
CREATE FILE EMPINFO
-RUN
CREATE FILE JOBINFO
-RUN
CREATE FILE EDINFO
-RUN
-*Load DB2 tables
MODIFY FILE EMPINFO
FIXFORM FROM EMP1
DATA ON EMP1
END
-RUN
MODIFY FILE JOBINFO
FIXFORM FROM JOB1
DATA ON JOB1
END
-RUN
MODIFY FILE EDINFO
FIXFORM FROM ED1
DATA ON ED1
END
-RUN


Example: Optimizing an Outer Join Between DB2 Data Sources

The following request joins the EMPINFO table to the JOBINFO table. The SET SQLJOIN OUTER ON command is required for DB2, which has OFF as its default value:

ENGINE DB2 SET SQLJOIN OUTER ON
SET TRACEUSER=ON
SET TRACEOFF=ALL
SET TRACEON = STMTRACE//CLIENT
-RUN
 
JOIN CLEAR *
-RUN
 
JOIN
 LEFT_OUTER CURR_JOBCODE IN EMPINFO TO MULTIPLE JOBCODE IN JOBINFO AS J0
END
 
TABLE FILE EMPINFO
PRINT LAST_NAME FIRST_NAME IN 12 JOB_DESC
END

The single SQL SELECT statement for both tables shows that the join is optimized:

SELECT T1."LN",T1."FN",T1."CJC",T2."JCD",T2."JDS" FROM
(USERID1."EMPINFO" T1 LEFT OUTER JOIN USERID1."JOBINFO" T2 ON
T2."JCD" = T1."CJC") FOR FETCH ONLY;

Fred Newman is included although he has no matching record in the JOBINFO data source. His missing job description is indicated by the NODATA character (.):

LAST_NAME  FIRST_NAME  JOB_DESC
---------  ----------  --------
SMITH      RICHARD     PRODUCTION CLERK
GREENSPAN  MARY        SECRETARY
STEVENS    ALFRED      SECRETARY
IRVING     JOAN        ASSIST.MANAGER
BANNING    JOHN        DEPARTMENT MANAGER
CROSS      BARBARA     DEPARTMENT MANAGER
MCKNIGHT   ROGER       PROGRAMMER
MCCOY      JOHN        PROGRAMMER
JONES      DIANE       PROGRAMMER ANALYST
BLACKWOOD  ROSEMARIE   SYSTEMS ANALYST
ROMANS     ANTHONY     SYSTEMS ANALYST
SMITH      MARY        FILE QUALITY
NEWMAN     FRED        .


Example: Optimizing Two Outer Joins Between DB2 Data Sources

The following request joins the EMPINFO table to the JOBINFO table and the EDINFO table with the setting MULTIPATH=COMPOUND. The SET SQLJOIN OUTER ON command is required for DB2, which has OFF as its default value:

ENGINE DB2 SET SQLJOIN OUTER ON
SET MULTIPATH=COMPOUND
-RUN
SET TRACEUSER=ON
SET TRACEOFF=ALL
SET TRACEON = STMTRACE//CLIENT
-RUN
 
JOIN CLEAR *
-RUN
 
JOIN
  LEFT_OUTER CURR_JOBCODE IN EMPINFO TO MULTIPLE JOBCODE IN JOBINFO AS J0
  END
JOIN
  LEFT_OUTER EMP_ID IN EMPINFO  TO MULTIPLE EMP_ID IN EDINFO   AS J1
END
 
TABLE FILE EMPINFO
PRINT LAST_NAME  FIRST_NAME IN 12 COURSE_NAME JOB_DESC
END

The single SQL SELECT statement incorporating all tables shows that the join is optimized:

SELECT T1."EID",T1."LN",T1."FN",T1."CJC",T2."E01",T2."CNM",
T3."JCD",T3."JDS" FROM ( ( USERID1."EMPINFO" T1 LEFT OUTER JOIN
USERID1."EDINFO" T2 ON T2."E01" = T1."EID" ) LEFT OUTER JOIN
USERID1."JOBINFO" T3 ON T3."JCD" = T1."CJC" ) FOR FETCH ONLY;

All employees are included on the report output. Missing course names and job descriptions are indicated by the NODATA character (.):

LAST_NAME  FIRST_NAME  COURSE_NAME                     JOB_DESC
---------  ----------  -----------                     --------
SMITH      RICHARD     BASIC RPT NON-DP MGRS           PRODUCTION CLERK
GREENSPAN  MARY        .                               SECRETARY
STEVENS    ALFRED      FILE DESCRPT & MAINT            SECRETARY
IRVING     JOAN        .                               ASSIST.MANAGER
BANNING    JOHN        .                               DEPARTMENT MANAGER
CROSS      BARBARA     HOST LANGUAGE INTERFACE         DEPARTMENT MANAGER
MCKNIGHT   ROGER       FILE DESCRPT & MAINT            PROGRAMMER
MCCOY      JOHN        .                               PROGRAMMER
JONES      DIANE       FOCUS INTERNALS                 PROGRAMMER ANALYST
ROMANS     ANTHONY     .                               SYSTEMS ANALYST
BLACKWOOD  ROSEMARIE   DECISION SUPPORT WORKSHOP       SYSTEMS ANALYST
SMITH      MARY        BASIC REPORT PREP FOR PROG      FILE QUALITY
NEWMAN     FRED        .                               .

Top of page

x
FMLCAP Function

How to:

The FMLCAP function returns the caption value for each row in an FML hierarchy request. In order to retrieve caption values, the Master File must define an FML hierarchy and the request must use the GET CHILDREN, ADD, or WITH CHILDREN option to retrieve hierarchy data. If the FOR field in the request does not have a caption field defined, FMLCAP returns a blank string.

FMLCAP is supported for COMPUTE but is not recommended for use with DEFINE.



x
Syntax: How to Retrieve Captions in an FML Request Using the FMLCAP Function
FMLCAP(fieldname|'format')

where:

fieldname

Is the name of the caption field.

'format'

Is the format of the caption field enclosed in single quotation marks.



Example: Retrieving FML Hierarchy Captions Using FMLCAP

The following request retrieves and aggregates the FML hierarchy that starts with the parent value 2000. FMLCAP retrieves the captions, while the actual account numbers appear as the FOR values.

SET FORMULTIPLE = ON 
TABLE FILE CENTSTMT 
SUM ACTUAL_AMT 
COMPUTE CAP1/A30= FMLCAP(GL_ACCOUNT_CAPTION); 
FOR GL_ACCOUNT 2000 WITH CHILDREN 2 ADD 
END

The output is:

                   Actual  CAP1
                   ------  ----
2000         313,611,852.  Gross Margin
  2100       187,087,470.  Sales Revenue
    2200      98,710,368.  Retail Sales
    2300      13,798,832.  Mail Order Sales
    2400      12,215,780.  Internet Sales
  2500       100,885,159.  Cost Of Goods Sold
    2600      54,877,250.  Variable Material Costs
    2700       6,176,900.  Direct Labor
    2800       3,107,742.  Fixed Costs

Top of page

x
FMLFOR Function

How to:

FMLFOR retrieves the tag value associated with each row in an FML request. If the FML row was generated as a sum of data records using the OR phrase, FMLFOR returns the first value specified in the list. If the OR phrase was generated by an FML Hierarchy ADD command, FMLFOR returns the tag value associated with the parent specified in the ADD command.

The FMLFOR function is supported for COMPUTE but not for DEFINE. Attempts to use it in a DEFINE result in blank values.



x
Syntax: How to Retrieve FML Tag Values
FMLFOR(outfield)

where:

outfield

Is name of the field that will contain the result, or the format of the output value enclosed in single quotation marks.



Example: Retrieving FML Tag Values With FMLFOR
SET FORMULTIPLE = ON
TABLE FILE LEDGER
SUM AMOUNT
COMPUTE RETURNEDFOR/A8 = FMLFOR('A8');
FOR ACCOUNT
1010                  OVER
1020                  OVER
1030                  OVER
BAR                   OVER
1030 OR 1020 OR 1010
END

The output is:

      AMOUNT  RETURNEDFOR
      ------  -----------
1010   8,784  1010
1020   4,494  1020
1030   7,961  1030
      ------  --------
1010  21,239  1030

Top of page

x
FMLLIST Function

How to:

FMLLIST returns a string containing the complete tag list for each row in an FML request. If a row has a single tag value, that value is returned.

The FMLLIST function is supported for COMPUTE but not for DEFINE. Attempts to use it in a DEFINE result in blank values.



x
Syntax: How to Retrieve an FML Tag List
FMLLIST('A4096V')

where:

'A4096V'

Is the required argument.



Example: Retrieving an FML Tag List With FMLLIST
SET FORMULTIPLE=ON
TABLE FILE LEDGER
HEADING
"TEST OF FMLLIST"
" "
SUM AMOUNT
COMPUTE LIST1/A36 = FMLLIST('A4096V');
FOR ACCOUNT
'1010'                 OVER
'1020'                 OVER
'1030'                 OVER
BAR                    OVER
'1030' OR '1020' OR '1010'
END

The output is:

TEST OF FMLLIST
 
      AMOUNT  LIST1
      ------  -----
1010   8,784  1010
1020   4,494  1020
1030   7,961  1030
      ------  ------------------------------------
1010  21,239  1010 OR 1020 OR 1030

Top of page

x
Changing Titles of Columns Created Using Prefix Operators

How to:

Column titles for columns created by applying a prefix operator to a display or sort field can be renamed using an AS phrase in a report request.



x
Syntax: How to Rename a Report Column Created Using a Prefix Operator
operator.fieldname AS 'coltitle'

where:

operator

Is a valid prefix operator.

fieldname

Is a display or sort field in the request.

coltitle

Is the column title for the report column, enclosed in single quotation marks.



Example: Renaming a Report Column Created Using a Prefix Operator

The following request sums wholesale prices of movies by category, counts the instances and sorts by the average wholesale price in descending order. The columns created with the AVE. and CNT. prefix operators are renamed using an AS phrase:

TABLE FILE MOVIES
SUM WHOLESALEPR CNT.WHOLESALEPR AS 'COUNT OF,WHOLESALEPR'
BY CATEGORY
  BY HIGHEST 2 TOTAL AVE.WHOLESALEPR AS 'AVERAGE OF,WHOLESALEPR'
  BY RATING
  WHERE CATEGORY EQ 'CLASSIC' OR 'FOREIGN' OR 'MUSICALS'
END

The output is:

          AVERAGE OF                        COUNT OF
CATEGORY  WHOLESALEPR  RATING  WHOLESALEPR  WHOLESALEPR
--------  -----------  ------  -----------  -----------
CLASSIC         40.99  G             40.99            1
                16.08  NR           160.80           10
FOREIGN         31.00  PG            62.00            2
                23.66  R             70.99            3
MUSICALS        15.00  G             15.00            1
                13.99  PG            13.99            1
                       R             13.99            1

Information Builders