Features Added in FOCUS 7.6.1

In this section:

Starting in FOCUS 7.6.1, you can declare a filter or a COMPUTE in a Master File, describe a group field as a set of elements, specify multilingual TITLE and DESCRIPTION attributes in a Master File, use date system amper variables in a Master File DEFINE, and automatically drop an existing table when creating a new version.


Top of page

x
Declaring Filters in a Master File

How to:

Reference:

Boolean virtual fields (DEFINE fields that evaluate to TRUE or FALSE) can be used as record selection criteria. If the primary purpose of a virtual field is for use in record selection, you can clarify this purpose and organize virtual fields in the Master File by storing the expression using a FILTER declaration rather than a DEFINE. Filters offer the following features:



x
Syntax: How to Declare a Filter in a Master File
FILTER  filtername = expression;

where:

filtername

Is the name assigned to the filter. The filter is internally assigned a format of I1, which cannot be changed.

expression

Is a logical expression that evaluates to TRUE (which assigns the value 1 to the filter field) or FALSE (which assigns the value 0 to the filter field). For any other type of expression, the field becomes a standard numeric virtual field in the Master File. Dialogue Manager variables (amper variables) can be used in the filter expression in same way they are used in standard Master File DEFINEs.



x
Syntax: How to Use a Master File Filter in a Request
TABLE FILE filename 
   .
   .
   .
{WHERE|IF} expression_using_filters

where:

expression_using_filters

Is a logical expression that references a filter. In a WHERE phrase, the logical expression can reference one or more filters and/or virtual fields.



x
Reference: Usage Notes for Filters in a Master File


Example: Defining and Using a Master File Filter

Consider the following filter declaration added to the MOVIES Master File:

FILTER G_RATING = RATING EQ 'G' OR 'PG'; $

The following request applies the G_RATING filter:

TABLE FILE MOVIES
HEADING CENTER
"Rating G and PG"
PRINT TITLE CATEGORY RATING
WHERE G_RATING
ON TABLE SET PAGE NOPAGE
ON TABLE SET GRID OFF
ON TABLE HOLD FORMAT HTML
ON TABLE SET STYLE *
type=report, style=bold, color=black, backcolor=yellow, $
type=data, backcolor=aqua, $
ENDSTYLE
END

The output is:


Top of page

x
Describing GROUP Fields as a Set of Elements

How to:

Reference:

A GROUP declaration in a Master File describes several fields as a single entity. One use of a group is to describe group keys in a VSAM data source. Sometimes referring to several fields by one group name facilitates ease of reporting.

Traditionally, when describing a GROUP field, you had to take account of the fact that while the USAGE and ACTUAL format for the GROUP field are both alphanumeric, the length portion of the USAGE format for the group had to be calculated as the sum of the component lengths, where each integer or single precision field counted as 4 bytes, each double precision field as 8 bytes, and each packed field counted as either 8 or 16 bytes depending on its size.

To avoid the need to calculate these lengths, you can use the GROUP ELEMENTS option, which describes a group as a set of elements without USAGE and ACTUAL formats.



x
Syntax: How to Describe a GROUP Field as a Set of Elements
GROUP=group1, ALIAS=g1alias,ELEMENTS=n1,$
   FIELDNAME=field11, ALIAS=alias11, USAGE=ufmt11, ACTUAL=afmt11, $
   .
   .
   .
   FIELDNAME=field1h, ALIAS=alias1h, USAGE=ufmt1h, ACTUAL=afmt1h, $
GROUP=group2,ALIAS=g2alias,ELEMENTS=n2,$
   FIELDNAME=field21, ALIAS=alias21, USAGE=ufmt21, ACTUAL=afmt21, $
   .
   .
   .
   FIELDNAME=field2k, ALIAS=alias2k, USAGE=ufmt2k, ACTUAL=afmt2k, $

where:

group1, group2

Are valid names assigned to a group of fields. The rules for acceptable group names are the same as the rules for acceptable field names.

n1, n2

Are the number of elements (fields and/or groups) that compose the group. If a group is defined within another group, the subgroup (with all of its elements) counts as one element of the parent group.

field11, field2k

Are valid field names.

alias11, alias2k

Are valid alias names.

ufmt11, ufmt2k

Are USAGE formats for each field.

afmt11, afmt2k

Are ACTUAL formats for each field.



x
Reference: Usage Notes for Group Elements


Example: Declaring a GROUP With ELEMENTS

In the following Master File, GRP2 consists of two elements, fields FIELDA and FIELDB. GRP1 consists of two elements, GRP2 and field FIELDC. Field FIELDD is not part of a group:

FILENAME=XYZ     , SUFFIX=FIX     , $
  SEGMENT=XYZ, SEGTYPE=S2, $
GROUP=GRP1,ALIAS=CCR,ELEMENTS=2,$
   GROUP=GRP2,ALIAS=CC,ELEMENTS=2,$
    FIELDNAME=FIELDA, ALIAS=E01, USAGE=A10, ACTUAL=A10, $
    FIELDNAME=FIELDB, ALIAS=E02, USAGE=A16, ACTUAL=A16, $
    FIELDNAME=FIELDC, ALIAS=E03, USAGE=P27, ACTUAL=A07, $
    FIELDNAME=FIELDD, ALIAS=E04, USAGE=D7, ACTUAL=A07, $

The following chart shows the offsets and formats of these fields.

Field Number

Field Name

Offset

USAGE

ACTUAL

1

GRP1

0

A42 - Supports 16 characters for FIELDC (P27)

A33

2

GRP2

0

A26

A26

3

FIELDA

0

A10

A10

4

FIELDB

10

A16

A16

5

FIELDC

26

P27

A7

6

FIELDD

42

D7

A7



x
Specifying Multilingual Descriptions in a Master File

How to:

Reference:

Master Files support descriptions in multiple languages. The description used depends on the value of the LANG parameter and whether a DESC_ln attribute is specified in the Master File, where ln identifies the language to which the description applies. In order to display these descriptions properly, all of the languages used must be consistent with your NLS configuration.



x
Syntax: How to Specify Multilingual DESCRIPTION Attributes in a Master File

For a file declaration in a Master File, use the following syntax

FILE = filename,
   .
   .
   .
{REMARKS|DESC} = default_desc 
DESC_ln = desc_for_ln 
   .
   .
   .

For a field, use the following syntax

FIELDNAME = field, ...
   .
   .
   .
TITLE = default_column_heading 
TITLE_ln = column_heading_for_ln 
   .
   .
   .
DESC = default_desc 
DESC_ln = desc_for_ln 
   .
   .
   .

where:

field

Is a field in the Master File.

default_column_heading

Is the column heading to use when SET TITLES=ON and either the LANG parameter is set to the default language, or another language is set but the Master File has no corresponding TITLE_ln attribute for that field. This column heading is also used if the ln value is invalid.

TITLE_ln

Specifies the language to which the associated column heading applies.

column_heading_for_ln

Specifies the text of the column heading for the specified language. That column heading is used when SET TITLES=ON, the LANG parameter is set to a non-default language for FOCUSand the Master File has a corresponding TITLE_ln attribute, where ln is the two-digit code for the language specified by the LANG parameter. Valid values for ln are the two-letter ISO 639 language code abbreviations.

default_desc

Is the description to use when either the LANG parameter is set to the default language, or another language is set but the Master File has no corresponding DESC_ln attribute for that field. This description is also used if an the ln value is invalid.

DESC_ln

Specifies the language to which the associated description applies.

desc_for_ln

Specifies the description text for the specified language. This description is used when the LANG parameter is set to a non-default language for FOCUS and the Master File has a corresponding DESC_ln attribute. Valid values for ln are the two-letter ISO 639 language code abbreviations.



x
Reference: Languages and Language Codes

Language Name

Two-Letter Language Code

Three-Letter Language Abbreviation

Arabic

ar

ARB

Baltic

lt

BAL

Chinese - Simplified GB

zh

PRC

Chinese - Traditional Big-5

tw

ROC

Czech

cs

CZE

Danish

da

DAN

Dutch

nl

DUT

English - American

en

AME or ENG

English - UK

uk

UKE

Finnish

fi

FIN

French - Canadian

fc

FRE

French - Standard

fr

FRE

German - Austrian

at

GER

German - Standard

de

GER

Greek

el

GRE

Hebrew

iw

HEW

Italian

it

ITA

Japanese - Shift-JIS(cp942) on ascii cp939 on EBCDIC

ja

JPN

Japanese - EUC(cp10942) on ascii (UNIX)

je

JPE

Korean

ko

KOR

Norwegian

no

NOR

Polish

pl

POL

Portuguese - Brazilian

br

POR

Portuguese - Portugal

pt

POR

Russian

ru

RUS

Spanish

es

SPA

Swedish

sv

SWE

Thai

th

THA

Turkish

tr

TUR



x
Syntax: How to Activate the Use of a Language

Issue the following command in a supported profile, on the command line, or in a FOCEXEC:

SET LANG = lng

or

SET LANG = ln

In the NLSCGF ERRORS configuration file, issue the following command

LANG = lng

where:

lng

Is the three-letter abbreviation for the language.

ln

Is the two-letter ISO language code.

Note: If SET LANG is used in a procedure, its value will override the values set in NLSCGF ERRORS or in any profile.



x
Reference: Usage Notes for Multilingual Metadata


Example: Using Multilingual Descriptions in a Master File

The following Master File for the CENTINV data source specifies French descriptions (DESC_FR) and Spanish descriptions (DESC_ES) as well as default descriptions (DESC) for the PROD_NUM and PRODNAME fields:

FILE=CENTINV, SUFFIX=FOC, FDFC=19, FYRT=00
 SEGNAME=INVINFO, SEGTYPE=S1, $
  FIELD=PROD_NUM, ALIAS=PNUM, FORMAT=A4, INDEX=I,
   DESCRIPTION='Product Number'
   DESC='Product Number',
   DESC_ES='Numero de Producto',
   DESC_FR='Nombre de Produit', $
  FIELD=PRODNAME, ALIAS=PNAME, FORMAT=A30,
   WITHIN=PRODCAT,
   DESCRIPTION='Product Name'
   DESC_FR='Nom de Produit',
   DESC_ES='Nombre de Producto', $
  FIELD=QTY_IN_STOCK, ALIAS=QIS, FORMAT=I7,
   DESCRIPTION='Quantity In Stock', $
  FIELD=PRICE, ALIAS=RETAIL, FORMAT=D10.2,
   TITLE='Price:',
   DESCRIPTION=Price, $

Top of page

x
Specifying Multilingual TITLE Attributes in a Master File

How to:

Reference:

In a Master File, column headings are taken from:

  1. A heading specified in the report request using the AS phrase.
  2. A TITLE attribute in the Master File, if no AS phrase is specified in the request and SET TITLES=ON.
  3. The field name specified in the Master File, if no AS phrase or TITLE attribute is specified, or if SET TITLES=OFF.

Master Files support column headings in multiple languages. The heading used depends on the value of the LANG parameter and whether a TITLE_ln attribute is specified in the Master File, where ln identifies the language to which the column heading applies.



x
Syntax: How to Specify Multilingual TITLE Attributes in a Master File
FIELDNAME = field, ...
   .
   .
   .
TITLE= default_column_heading 
   .
   .
   .
TITLE_ln = column_heading_for_ln 
   .
   .
   .

where:

field

Is a field in the Master File.

default_column_heading

Is the column heading to use when SET TITLES=ON and either the LANG parameter is set to the default language for FOCUS, or another language is set but the Master File has no corresponding TITLE_ln attribute for that field. This column heading is also used if an the ln value is invalid.

TITLE_ln

Specifies the language for which the column heading applies. Valid values for ln are the two-letter ISO 639 language code abbreviations:

Language Name

Two-Letter Language Code

Three-Letter Language Abbreviation

Arabic

ar

ARB

Baltic

lt

BAL

Chinese - Simplified GB

zh

PRC

Chinese - Traditional Big-5

tw

ROC

Czech

cs

CZE

Danish

da

DAN

Dutch

nl

DUT

English - American

en

AME or ENG

English - UK

uk

UKE

Finnish

fi

FIN

French - Canadian

fc

FRE

French - Standard

fr

FRE

German - Austrian

at

GER

German - Standard

de

GER

Greek

el

GRE

Hebrew

he

HEB

Hebrew

iw

HEW

Italian

it

ITA

Japanese - Shift-JIS(cp942) on ascii cp939 on EBCDIC

ja

JPN

Japanese - EUC(cp10942) on ascii (UNIX)

je

JPE

Korean

ko

KOR

Norwegian

no

NOR

Polish

pl

POL

Portuguese - Brazilian

br

POR

Portuguese - Portugal

pt

POR

Russian

ru

RUS

Spanish

es

SPA

Swedish

sv

SWE

Thai

th

THA

Turkish

tr

TUR

column_heading_for_ln

Is the column heading to use when SET TITLES=ON, the LANG parameter is set to a non-default language for FOCUS, and the Master File has a corresponding TITLE_ln attribute, where ln is the two-digit code for the language specified by the LANG parameter.



x
Syntax: How to Activate the Use of a Language

Issue the following command in a supported profile, on the command line, or in a FOCEXEC:

SET LANG = lng

or

SET LANG = ln

In the NLSCGF ERRORS configuration file, issue the following command

LANG = lng

where:

lng

Is the three-letter abbreviation for the language. For a list of supported languages, see How to Specify Multilingual TITLE Attributes in a Master File.

ln

Is the two-letter ISO language code. For a list of supported codes, see How to Specify Multilingual TITLE Attributes in a Master File.

Note: If SET LANG is used in a procedure, its value will overwrite the values set in NLSCGF ERRORS or in any profile.



x
Reference: Usage Notes for Multilingual Titles


Example: Using Multilingual Titles in a Request

The following Master File for the CENTINV data source specifies French titles (TITLE_FR) and Spanish titles (TITLE_ES) as well as default titles (TITLE) for the PROD_NUM and PRODNAME fields:

FILE=CENTINV, SUFFIX=FOC, FDFC=19, FYRT=00
 SEGNAME=INVINFO, SEGTYPE=S1, $
  FIELD=PROD_NUM, ALIAS=PNUM, FORMAT=A4, INDEX=I,
   TITLE='Product,Number:',
   TITLE_FR='Nombre,de Produit:',
   TITLE_ES='Numero,de Producto:',
   DESCRIPTION='Product Number', $
  FIELD=PRODNAME, ALIAS=PNAME, FORMAT=A30,
   WITHIN=PRODCAT,
   TITLE='Product,Name:',
   TITLE_FR='Nom,de Produit:',
   TITLE_ES='Nombre,de Producto:'
   DESCRIPTION='Product Name', $
  FIELD=QTY_IN_STOCK, ALIAS=QIS, FORMAT=I7,
   TITLE='Quantity,In Stock:',
   DESCRIPTION='Quantity In Stock', $
  FIELD=PRICE, ALIAS=RETAIL, FORMAT=D10.2,
   TITLE='Price:',
   DESCRIPTION=Price, $

The default language is English and, by default, SET TITLES=ON. Therefore, the following request uses the TITLE attributes to produce column headings that are all in English:

TABLE FILE CENTINV
PRINT PROD_NUM PRODNAME PRICE
WHERE PRICE LT 200
END

The output is:

Product  Product
Number:  Name:                                 Price:
-------  -------                               ------
1004     2 Hd VCR LCD Menu                     179.00
1008     DVD Upgrade Unit for Cent. VCR        199.00
1026     AR3 35MM Camera 10 X                  129.00
1028     AR2 35MM Camera 8 X                   109.00
1030     QX Portable CD Player                 169.00
1032     R5 Micro Digital Tape Recorder         89.00

Now, issue the following command to set the language to Spanish :

SET LANG = SPA

Issue the CHECK FILE CENTINV command to re-read the Master File, and rerun the request.

The output now displays column headings from the TITLE_ES attributes where they exist (Product Number and Product Name). Where no Spanish title is specified (the Price field), the column heading in the TITLE attribute appears:

Numero        Nombre
de Producto:  de Producto:                          Price:
------------  ------------                          ------
1004          2 Hd VCR LCD Menu                     179.00
1008          DVD Upgrade Unit for Cent. VCR        199.00
1026          AR3 35MM Camera 10 X                  129.00
1028          AR2 35MM Camera 8 X                   109.00
1030          QX Portable CD Player                 169.00
1032          R5 Micro Digital Tape Recorder         89.00

Top of page

x
Using Date System Amper Variables in Master File DEFINEs

Reference:

Master File DEFINE fields can use Dialogue Manager system date variables to capture the system date each time the Master File is parsed for use in a request.

The format of the returned value for each date variable is the format indicated in the variable name. For example, &DATEYYMD returns a date value with format YYMD. The exceptions are &DATE and &TOD, which return alphanumeric values and must be assigned to a field with an alphanumeric format. The variable names &DATE and &TOD must also be enclosed in single quotation marks in the DEFINE expression.

The variables supported for use in Master File DEFINEs are:

Note that all other reserved amper variables are not supported in Master Files.



Example: Using the Date Variable &DATE in a Master File DEFINE

The following version of the EMPLOYEE Master File has the DEFINE field named TDATE added to it. TDATE has format A12 and retrieves the value of &DATE, which returns an alphanumeric value and must be enclosed in single quotation marks:

FILENAME=EMPLOYEE, SUFFIX=FOC
SEGNAME=EMPINFO,  SEGTYPE=S1
 FIELDNAME=EMP_ID,       ALIAS=EID,     FORMAT=A9,       $
 FIELDNAME=LAST_NAME,    ALIAS=LN,      FORMAT=A15,      $
 FIELDNAME=FIRST_NAME,   ALIAS=FN,      FORMAT=A10,      $
 FIELDNAME=HIRE_DATE,    ALIAS=HDT,     FORMAT=I6YMD,    $
 FIELDNAME=DEPARTMENT,   ALIAS=DPT,     FORMAT=A10,      $
 FIELDNAME=CURR_SAL,     ALIAS=CSAL,    FORMAT=D12.2M,   $
 FIELDNAME=CURR_JOBCODE, ALIAS=CJC,     FORMAT=A3,       $
 FIELDNAME=ED_HRS,       ALIAS=OJT,     FORMAT=F6.2,     $
DEFINE TDATE/A12   ='&DATE';, $
   .
   .
   .

The following request displays the value of TDATE:

TABLE FILE EMPLOYEE
PRINT LAST_NAME FIRST_NAME HIRE_DATE TDATE AS 'TODAY''S,DATE'
WHERE LAST_NAME EQ 'BANNING'
END

The output is:

                                        TODAY'S
LAST_NAME        FIRST_NAME  HIRE_DATE  DATE
---------        ----------  ---------  -------
BANNING          JOHN         82/08/01  05/11/04


Example: Using the Date Variable &YYMD in a Master File DEFINE

The following version of the EMPLOYEE Master File has the DEFINE field named TDATE added to it. TDATE has format YYMD and retrieves the value of &YYMD:

FILENAME=EMPLOYEE, SUFFIX=FOC
SEGNAME=EMPINFO,  SEGTYPE=S1
 FIELDNAME=EMP_ID,       ALIAS=EID,     FORMAT=A9,       $
 FIELDNAME=LAST_NAME,    ALIAS=LN,      FORMAT=A15,      $
 FIELDNAME=FIRST_NAME,   ALIAS=FN,      FORMAT=A10,      $
 FIELDNAME=HIRE_DATE,    ALIAS=HDT,     FORMAT=I6YMD,    $
 FIELDNAME=DEPARTMENT,   ALIAS=DPT,     FORMAT=A10,      $
 FIELDNAME=CURR_SAL,     ALIAS=CSAL,    FORMAT=D12.2M,   $
 FIELDNAME=CURR_JOBCODE, ALIAS=CJC,     FORMAT=A3,       $
 FIELDNAME=ED_HRS,       ALIAS=OJT,     FORMAT=F6.2,     $
DEFINE TDATE/YYMD   = &YYMD ;, $
   .
   .
   .

The following request displays the value of TDATE:

TABLE FILE EMPLOYEE
PRINT LAST_NAME FIRST_NAME HIRE_DATE TDATE AS 'TODAY''S,DATE'
WHERE LAST_NAME EQ 'BANNING'
END

The output is:

                                        TODAY'S
LAST_NAME        FIRST_NAME  HIRE_DATE  DATE
---------        ----------  ---------  -------
BANNING          JOHN         82/08/01  2004/05/11


x
Reference: Messages for Date System Amper Variables in Master File DEFINEs

The following message appears if an attempt is made to use an unsupported amper variable in a Master File DEFINE:

(FOC104) DEFINE IN MASTER REFERS TO A FIELD OUTSIDE ITS SCOPE: var

Top of page

x
CREATE FILE DROP

How to:

Reference:

The CREATE FILE command creates a data source that conforms to an existing Master File. You can use this command to create a FOCUS, XFOCUS, or relational data source.

If you issue the CREATE FILE command when the data source already exists, the following message appears for a FOCUS or XFOCUS data source:

(FOC441) WARNING. THE FILE EXISTS ALREADY. CREATE WILL WRITE OVER IT

For a relational data source, the following messages appear, followed by messages from the Relational engine indicating that the table cannot be created and then by a FOC1414 message:

(FOC1400) SQLCODE IS 955 (HEX: 000003BB)
(FOC1421) TABLE EXISTS ALREADY. DROP IT OR USE ANOTHER TABLENAME

The DROP option on the CREATE FILE command prevents the display of the messages and creates the data source, dropping the existing table first if necessary and re-parsing the Master File if it changed.



x
Syntax: How to Issue the CREATE FILE Command With the DROP Option
CREATE FILE filename DROP

where:

filename

Is the Master File name for a FOCUS, XFOCUS, or relational data source.



Example: Creating a FOCUS Data Source That Already Exists

The following CREATE FILE command creates the EMPLOYEE data source, which already exists:

create file employee
(FOC441) WARNING. THE FILE EXISTS ALREADY. CREATE WILL WRITE OVER IT
 
REPLY :

If you reply NO, the file is not created. If you reply anything else, the file is created.

The following CREATE FILE command creates the EMPLOYEE data source, which already exists without generating the FOC441 warning or requesting a reply.

create file employee drop
 NEW FILE EMPLOYEE  FOCUS   A1 ON 05/12/2004 AT 16.09.14


Example: Creating an Oracle Table That Already Exists

The Oracle table name EMPINFO exists therefore, the following CREATE FILE command generates an error and the new version of the table is not created:

create file empinfo
(FOC1400) SQLCODE IS 955 (HEX: 000003BB)
(FOC1421) TABLE EXISTS ALREADY. DROP IT OR USE ANOTHER TABLENAME
  : ORA-00955: name is already used by an existing object
  : Erroneous token: EMPINFO
(FOC1414) EXECUTE IMMEDIATE ERROR.

The following CREATE FILE command drops the existing table and creates a new version:

create file empinfo drop
>

The SQLDI trace shows that the original version of the table is dropped and then the new version is created:

SET TRACEUSER = ON
SET TRACEOFF = ALL
SET TRACEON = SQLDI//CLIENT
create file empinfo drop
 
**** orafoc: gfun: 3, fun: 2, cnum: 0
**** orafoc: gfun: 1, fun: 6, cnum: 0
**** Local server assigned for operation
**** OOPEN call
**** OOPEN return
**** acda=008DC0C8,ocnum=1,retcode=0
**** OPARSE call
**** l of sql cmd  20
SQL:  DROP TABLE EMPINFO
**** lngflg value  1
**** OPARSE return
**** acda=008DC0C8,ocnum=1,retcode=0
**** OEXEC call:
**** OEXEC return
**** acda=008DC0C8,ocnum=1,retcode=0
**** orafoc: gfun: 1, fun: 6, cnum: 0
**** Local server assigned for operation
**** OPARSE call
**** l of sql cmd  259
SQL:  CREATE TABLE EMPINFO( "EID" VARCHAR2 (9) NOT NULL ,"LN" VARCHAR2
SQL: (15) NOT NULL ,"FN" VARCHAR2 (10) NOT NULL ,"HDT" DATE  NOT NULL ,"
SQL: DPT" VARCHAR2 (10),"CSAL" DECIMAL(7, 2) NOT NULL ,"CJC" VARCHAR2 (3
SQL: ) NOT NULL ,"OJT" FLOAT ,"BONUS_PLAN" INTEGER  NOT NULL )
**** lngflg value  1
**** OPARSE return
**** acda=008DC0C8,ocnum=1,retcode=0
**** OEXEC call:
**** OEXEC return
**** acda=008DC0C8,ocnum=1,retcode=0
**** orafoc: gfun: 1, fun: 6, cnum: 0
**** Local server assigned for operation
**** OPARSE call
**** l of sql cmd  57
SQL:  CREATE  UNIQUE INDEX EMPINFOIX ON EMPINFO ("EID"  ASC)
**** lngflg value  1
**** OPARSE return
**** acda=008DC0C8,ocnum=1,retcode=0
**** OEXEC call:
**** OEXEC return
**** acda=008DC0C8,ocnum=1,retcode=0
**** orafoc: gfun: 1, fun: 5, cnum: 0
**** OCLOSE call
 
**** OCLOSE return
**** acda=008DC0C8,ocnum=0,retcode=0
**** OCOM call
**** OCOM return
**** orafoc: gfun: 3, fun: 3, cnum: 0


x
Reference: Usage Notes for CREATE FILE DROP

If you issue the CREATE FILE filename DROP command for a FOCUS or XFOCUS data source that has an external index or MDI, you must REBUILD the index after creating the data source.


Top of page

x
COMPUTE in a Master File

How to:

Reference:

COMPUTE commands can be included in Master Files and referenced in subsequent TABLE requests, enabling you to build expressions once and use them in multiple requests.



x
Syntax: How to Include a COMPUTE Command in a Master File
COMPUTE fieldname/fmt=expression;

where:

fieldname

Is name of the calculated field.

fmt

Is the format and length of the calculated field.

expression

Is the formula for calculating the value of the field.



x
Reference: Usage Notes for COMPUTE in a Master File

In all instances, COMPUTEs in the Master File have the same functionality and limitations as temporary COMPUTEs. Specifically, fields computed in the Master File must follow these rules:



Example: Coding a COMPUTE in the Master File and Accessing the Computed Value

Use standard COMPUTE syntax to add a calculated value to your Master File. You can then access the calculated value by referencing the computed fieldname in subsequent TABLE requests. When used as a verb object, as in the following example, the syntax is SUM (or PRINT) COMPUTE field.

The following is the SALESTES Master File (the SALES FILE modified with an embedded COMPUTE):

FILENAME=SALESTES, SUFFIX=FOC,
SEGNAME=STOR_SEG, SEGTYPE=S1,
   FIELDNAME=STORE_CODE,  ALIAS=SNO,  FORMAT=A3,   $
   FIELDNAME=CITY,        ALIAS=CTY,  FORMAT=A15,  $
   FIELDNAME=AREA,        ALIAS=LOC,  FORMAT=A1,   $
 
SEGNAME=DATE_SEG, PARENT=STOR_SEG, SEGTYPE=SH1,
   FIELDNAME=DATE,        ALIAS=DTE,  FORMAT=A4MD, $
 
SEGNAME=PRODUCT, PARENT=DATE_SEG, SEGTYPE=S1,
   FIELDNAME=PROD_CODE,     ALIAS=PCODE,   FORMAT=A3,    FIELDTYPE=I, $
   FIELDNAME=UNIT_SOLD,     ALIAS=SOLD,    FORMAT=I5,    $
   FIELDNAME=RETAIL_PRICE,  ALIAS=RP,      FORMAT=D5.2M, $
   FIELDNAME=DELIVER_AMT,   ALIAS=SHIP,    FORMAT=I5,    $
   FIELDNAME=OPENING_AMT,   ALIAS=INV,     FORMAT=I5,    $
   FIELDNAME=RETURNS,       ALIAS=RTN,     FORMAT=I3,    MISSING=ON, $
   FIELDNAME=DAMAGED,       ALIAS=BAD,     FORMAT=I3,    MISSING=ON, $
 
   COMPUTE REVENUE/D12.2M=UNIT_SOLD*RETAIL_PRICE;

In the TABLE request, computed field, REVENUE, is a verb object of SUM.

TABLE FILE SALESTES
HEADING CENTER
"NEW YORK PROFIT REPORT"
" "
SUM UNIT_SOLD AS 'UNITS,SOLD' RETAIL_PRICE AS 'RETAIL_PRICE'
COMPUTE REVENUE;
BY PROD_CODE AS 'PROD,CODE'
WHERE CITY EQ 'NEW YORK'
END

The output is:

           NEW YORK PROFIT REPORT
 
  PROD  UNITS
  CODE  SOLD   RETAIL_PRICE          REVENUE
  ----  ----   ------------          -------
  B10      30          $.85           $25.50
  B17      20         $1.89           $37.80
  B20      15         $1.99           $29.85
  C17      12         $2.09           $25.08
  D12      20         $2.09           $41.80
  E1       30          $.89           $26.70
  E3       35         $1.09           $38.15

Information Builders