Defining and Allocating FOCUS Files

In this section:

You will come across a variety of files when you use FOCUS. These files can be application files that you create, extract files that FOCUS creates as requested by your application, or work files that FOCUS creates as required by your application.

This topic describes FOCUS file allocation requirements and describes how to assign a logical name, or DDNAME, to a file or device for operating systems that support this feature.

Allocating FOCUS Files

In this section:

Reference:

FOCUS files fall into three categories: application files, extract files, and work files. This topic contains information about files and ways to define them in the UNIX and Linux environments.

Some files are automatically allocated by FOCUS, but there are times when you must explicitly define a file and its location. A FILEDEF command generates platform independent file paths for all portable platforms by creating FILEDEF syntax with application names.

Reference: FOCUS Files Under UNIX and Linux

The following tables describe the FOCUS files that you will use under UNIX and Linux. FOCUS uses file extensions to distinguish different file types.

Application Files

Extension

Description

.mas

Master File.

.acx

Access File.

.fex

Procedure (FOCEXEC).

.foc

FOCUS and XFOCUS data sources and external index.

.dat

Sequential data source.

.sty

FOCUS StyleSheet file.

.err

Error messages file or help text.

.prf

Profile.

.htm
.html
.jpeg
.gif
.css
.js
.class
.jar

Files used for HTML files and styling for HTML files.

Extract Files

File

Description

HOLD

Contains data saved using the HOLD command.

SAVB

Contains data saved using the SAVB command.

SAVE

Contains data saved using the SAVE command.

.FTM

Contains data saved using the HOLD, SAVB, or SAVE command.

Note: Dialogue Manager output files must be allocated using the FILEDEF command in system or user profiles.

Work Files

File

Description

FOCSORT

Used during sorting.

FOCPOST

Sequential output file saved using the POST command. The PICKUP command reads it back in.

FOCSML

Used by Financial Modeling Language (FML).

OFFLINE

Used when the SET PRINT parameter is OFFLINE.

SYSIN

Directs input.

SYSPRINT

Directs output to the screen.

Dynamically Defining a File Under UNIX and Linux

You do not have to explicitly define most of your application files prior to referring to them. FOCUS dynamically allocates certain application files. Additionally, FOCUS dynamically defines all extract files and temporary work files to the operating system during a session.

FOCUS defines the following extract, output, and work files:

  • HOLD, SAVB, and SAVE files.
  • FOCUS and XFOCUS data sources.
  • FOCSORT files.
  • SYSIN to input from keyboard. It is assigned to TERM. This is equivalent to the command FILEDEF SYSIN TERM.
  • SYSPRINT to output to be displayed on the screen. It is assigned to TERM. This is equivalent to the command FILEDEF SYSPRINT TERM.
  • OFFLINE to output sent to the printer. It is assigned to PRINTER. This is equivalent to the command FILEDEF OFFLINE PRINTER.

Assigning a Logical Name With the FILEDEF Command

How to:

For a file managed by the operating system, such as an ISAM or comma-delimited data file, the physical file name is the actual name of a file as it appears to the operating system. A logical name (or ddname) is a shorthand name that points to the physical file name. Logical names simplify code by allowing short names to be used in place of the longer physical file name.

The FILEDEF command assigns a logical name to a physical file name and specifies file attributes. You can explicitly define a file and its location to FOCUS using the FILEDEF command. This generates platform independent file paths for all portable platforms by creating FILEDEF syntax with application names. An allocation can be issued in a procedure and lasts for a single request.

It is recommended that instead of including an allocation in each procedure, you include all FILEDEF commands in a single file that you call with the -INCLUDE command at the beginning of each procedure. This enables you to make changes to your FILEDEF commands globally instead of changing the allocation information in each procedure.

The FILEDEF command is typically used in the following ways in operating systems that support this command:

  • Identifying data sources. You must create FILEDEF assignments (or USE directories, in the case of FOCUS data sources) for all data sources you wish to use.
  • Redirecting output sent to the printer. The OFFLINE ddname is used for output sent to the printer. By reassigning this ddname, you can redirect printer output to a file.

You can also use the Universal Naming Convention (UNC) to assign logical names to files that are located on a server. In order to take advantage of the UNC you must first attach to the server you want to use. For information on attaching to a server or mapping network drives, consult your network administrator.

Syntax: How to Assign a Logical Name With a FILEDEF Command

FILEDEF ddname DISK appname[/appnamea...]/filename [(APPEND] [LRECL n] [RECFM F]

where:

ddname

Is the logical name for the file. The ddname can be from one to eight characters. When used to associate a data source with a Master File, the ddname must match the name of the Master File.

DISK

Associates the specified ddname with a file.

appname[/appnamea...]

Is the name of the application under APPROOT, or a nested application name, that contains the physical file.

filename

Is the physical name of the file under the appname.

APPEND

Appends records to the end of the file. Without this option, the file is overwritten.

LRECL n

Specifies the record length. n is an integer.

You must specify an LRECL value if the file is a SAVB file or fixed-format transaction file used in data maintenance (FIXFORM files) that contains binary values.

RECFM F

Specifies fixed length records.

You must specify an RECFM value if the file is a SAVB file or fixed-format transaction file used in data maintenance (FIXFORM files) that contains binary values.

FOCUS data sources (files with the .foc extension) that do not conform to the default naming convention are identified with the USE command, not FILEDEF. For information on the USE command, see the Describing Data manual.

Example: Redirecting Output

To send output to the LPT1 port (provided that the machine is configured properly):

FILEDEF OFFLINE DISK LPT1
Example: Setting a Search Path

To search all directories on the search path for the NEW_EMPS.DAT file, set your APP PATH. For example:

APP PATH app1 app2 app3 ... appn
Example: Appending a Report Extract to Other Content

To append a report extract from the LIBRARY data source to the current content of the file LIB03.FTM:

FILEDEF SAVE DISK C:\LIBRARY\LIB03.FTM (APPEND
Example: Reading Standard Text Editor Files With LRECL

You can specify an LRECL equal to or greater than the implied LRECL for the request. For example, if the length of the longest line in the text file is seven characters, issue this command:

FILEDEF BIGLINE DISK BIGLINE.FTM (LRECL 7

Displaying Current ddnames Assigned With FILEDEF

How to:

The ? FILEDEF command displays the ddnames assigned for various files, input and output.

Syntax: How to Display Current ddnames

? FILEDEF
Example: Displaying Current ddnames

Issuing the command

? FILEDEF

produces information similar to the following:

Lname  Device  Lrecl  Recfm  Append  Expl  Filename
===============================================================
HOLD2  DISK      0    V      N       Y     C:\VM\SMALL\HOLD2.FTM

Clearing Allocations

How to:

You can clear allocations by using FOCUS syntax.

Syntax: How to Clear a Logical Name With Syntax

FILEDEF ddname CLEAR

where:

ddname

Is the logical name. It may contain one to eight alphanumeric characters.

CLEAR

Clears the specified ddname.

Application Files Under UNIX and Linux

In this section:

This topic describes how FOCUS references and searches for application files.

When you do not change the default file type, you can prepare a report without issuing a FILEDEF command or other communication. When you change the default file type of a FOCUS data source, or the data source does not reside in a standard search path, you must issue the USE command. The USE command is discussed in the Describing Data manual.

Master Files Under UNIX and Linux

Reference:

A Master File contains metadata about a data source, and is identified with a file name and extension, for example, filename.mas. It consists of attributes that describe a data source. A Master File and the data source that it describes usually have the same name.

The description of a data source and all files it cross-references must be available whenever you refer to the data source.

For more information about how to generate Master Files, see the Describing Data manual.

Reference: Naming a Master File Under UNIX and Linux

The following rules apply:

  • The file name can be up to 64 characters long. The first character should be a letter, and the remaining characters can be any combination of letters, numbers, and underscores. Other special characters may be used, but could cause problems and are therefore not recommended or supported.
  • The file extension must be .mas for a Master File, since FOCUS searches for a Master File with that extension by default.

Access Files Under UNIX and Linux

Reference:

For some data sources, an Access File supplements a Master File. An Access File includes additional information that completes the description of the data source. For example, it includes the full data source name and location. You need one Master File, and for some data sources one Access File, to describe a data source.

FOCUS searches for an Access File on the path using APP PATH logic.

Reference: Naming an Access File Under UNIX and Linux

The following rules apply:

  • The file name can be up to 64 characters long. The first character should be a letter, and the remaining characters can be any combination of letters, numbers, and underscores. Other special characters may be used, but could cause problems and are therefore not recommended or supported.
  • The file extension must be .acx since FOCUS searches for a FOCUS data source with that extension by default.

Procedures Under UNIX and Linux

Reference:

A procedure contains your report requests and cannot have control characters. A procedure is identified with a file name and extension, for example, filename.fex.

Procedures can be simultaneously accessed and executed by all users. The device and directory must precede the procedure file name and extension for FOCUS to locate the procedure. If you specify a disk and a directory, you must include both the file name and the file extension (.fex) when calling the procedure.

FOCUS searches for a procedure on the path, using APP PATH logic.

Reference: Naming a Procedure Under UNIX and Linux

The following rules apply:

  • File names can be up to 64 characters long. The first character should be a letter, and the remaining characters can be any combination of letters, numbers, and underscores. Other special characters may be used, but could cause problems and are not recommended or supported.
  • The file extension must be .fex, since FOCUS searches for a procedure with that extension by default.

FOCUS and XFOCUS Data Sources Under UNIX and Linux

Reference:

FOCUS and XFOCUS data sources contain data written in FOCUS format. All FOCUS data sources have a record length of 4096 and a fixed length record format. The maximum size of a FOCUS data source is 2G. XFOCUS data source have a record length of 16K and a fixed length record format. XFOCUS data sources can be a maximum size of 16G.

A FOCUS or XFOCUS data source is identified with a file name and extension, for example, filename.foc for both types of data sources. The name of a FOCUS data source usually matches the name of the corresponding Master File. For example, if the Master File is ledger.mas, then the FOCUS or XFOCUS data source is ledger.foc. You can override this default with the USE command, described in the Describing Data manual.

Reference: Naming a FOCUS Data Source Under UNIX and Linux

The following rules apply:

  • The file name can be up to 64 characters long. The first character should be a letter, and the remaining characters can be any combination of letters, numbers, and underscores. Other special characters may be used, but could cause problems and are therefore not recommended or supported.
  • The file extension must be .foc since FOCUS searches for a FOCUS data source with that extension by default.

External Indexes for FOCUS Data Sources Under UNIX and Linux

An external index is a FOCUS data source that contains index, field, and segment information for one or more specified FOCUS data sources. The external index is independent of its associated FOCUS data source and is used to improve retrieval performance. In UNIX and Linux, the external index is automatically allocated as a permanent file when it is created using REBUILD.

Sequential Data Sources Under UNIX and Linux

FOCUS recognizes sequential data sources formatted in the following ways:

  • Fixed-format, in which each field occupies a predefined position in the record.
  • Free-format, also known as comma-delimited, in which fields can occupy any position in a record.
  • Delimited, in which fields are separated by a wide variety of delimiter characters.

For details, see the Describing Data manual.

FOCUS StyleSheets Under UNIX and Linux

Reference:

FOCUS StyleSheets enable you to style and produce reports that highlight key information. With StyleSheets, you specify various stylistic characteristics of a report and style report components individually. You can also use StyleSheets to define a hyperlink from any reporting object.

You can create StyleSheets externally or within a report request. For details, see the Creating Reports manual.

FOCUS searches for a FOCUS StyleSheet on the path, using APP PATH logic.

Reference: Naming a StyleSheet Under UNIX and Linux

The following rules apply:

  • The first character should be a letter, and the remaining characters can be any combination of letters, numbers, and underscores. Other special characters may be used, but could cause problems and are not recommended or supported.
  • The file extension must be .sty since FOCUS searches for a StyleSheet with that extension by default.

Extract Files Under UNIX and Linux

In this section:

FOCUS creates all extract files in a temporary directory, unless you use an APP HOLD command, an APP HOLDDATA command, or FILEDEF the file to a permanent file in a permanent directory.

HOLD Files Under UNIX and Linux

How to:

A HOLD extract file is a sequential data source that contains the results of a report request. It may have a corresponding HOLD Master File. The extension for a HOLD file is .ftm unless you specify the FORMAT option. If a Master File is created, it has the same name as the extract file, with the extension .mas.

Syntax: How to Create a HOLD File Under UNIX and Linux

ON TABLE HOLD [AS [app/]filename]

where:

app
Is the name of the application directory in which to create the file. Both the data file and the Master File are created in this application directory.
filename

Is a name for the HOLD file. If you do not specify a file name, HOLD is used as the default name. Since each subsequent HOLD command overwrites the previous HOLD file, it is useful practice to code a distinct file name in each request to direct the extracted data to a separate file, preventing it from being overwritten.

For the complete syntax with all options, see the Creating Reports manual.

SAVB Files Under UNIX and Linux

How to:

A SAVB file is an extract file containing the results of a report request in internal format. That is, all numeric fields are stored in binary, and all character fields are padded with spaces to a multiple of four bytes. The file cannot be printed.

Syntax: How to Create a SAVB File Under UNIX and Linux

ON TABLE SAVB [AS [app/]filename]

where:

app
Is the name of the application directory in which to create the file.
filename

Is the name of the file. The default is SAVB. The default extension is .ftm.

SAVE Files Under UNIX and Linux

How to:

A SAVE file is an extract file that saves the data of a report, but does not save headings, or subtotals, or create a Master File. It is a simple sequential character data file and can be used by other programs, or merged into another data file using a data maintenance request. The default format is simple character, although you can specify formats compatible with many other software products. FOCUS saves all columns in the report in printable, character format with no spaces between columns.

A SAVE file contains the external character format equivalent to SAVB. The command format and allocations are the same as SAVB. However, the numbers are printable American Standard Code for Information Interchange (ASCII) characters and no padding takes place.

Syntax: How to Create a SAVE File Under UNIX

ON TABLE SAVE [AS [app/]filename]

where:

app
Is the name of the application directory in which to create the file.
filename

Is the name of the file. The default is SAVE. The default extension is .ftm.

HOLDMAST Files Under UNIX and Linux

How to:

A HOLDMAST file is a temporary Master File. Master Files for HOLD files will be created in a temporary directory unless the HOLD command contains an application name (app/filename) or an APP HOLD or APP HOLDMETA command is issued, which specifies its location.

If the HOLD file was created under the default name HOLD, the FILEDEF command can be used in conjunction with the APP HOLDMETA syntax to designate a logical name to the HOLD file and respective Master File.

Syntax: How to Specify the Location for a HOLD Synonym Under UNIX

APP HOLDMETA app_name

where:

app_name

Is a valid application directory.

Example: Allocating a Logical Name for a HOLD File and Location for the Master File Under UNIX and Linux

The following example sets a logical name for the HOLD file with FILEDEF and specifies a location for the Master File with APP HOLDMETA:

FILEDEF SALES DISK app1/sales.ftm
APP HOLDMETA app1
TABLE FILE GGSALES
SUM DOLLARS
BY CATEGORY
ON TABLE HOLD AS SALES
END

The name of the Master File is derived from the ON TABLE HOLD AS filename name, which specifies sales as the logical name for the physical data source (sales.ftm). The Master File is given the same file name with the extension .mas (sales.mas). Both of these files are placed in application directory app1 as permanent files.

Note: Other methods for creating both the HOLD file and Master File in an application directory include the following:

  • Specifying the application directory name in the HOLD command (HOLD AS app1/sales).
  • Issuing the APP HOLD command (APP HOLD app1).

To report on the HOLD file, you need to issue a FILEDEF command (unless the Master File has a DATASET attribute that points to the file). For example:

FILEDEF SALES DISK app1/sales.ftm
TABLE FILE SALES
PRINT *
END

Work Files Under UNIX and Linux

FOCUS creates work files as required by your application. FOCUS creates all extract files in a temporary directory unless you issue an APP HOLD command or FILEDEF the file to a permanent directory.

The available work files are:

Example: Sending Output With the OFFLINE Command Under UNIX and Linux

The following command sends further report output to the file EMPL OUTPUT A with a fixed length record format and a record length of 80 bytes:

OFFLINE
FILEDEF OFFLINE DISK TMP/EMPL.OUT (RECFM F LRECL 80)

Information Builders