This section is meant to be a preliminary discussion on writing and editing focus programs using the FRS focus files. It is strongly recommended that to become proficient in using the language a FOCUS user's manual should be obtained and attendance at an introduction FOCUS class would be beneficial. Click here for general guidelines in writing your focexec.
Writing and editing a FOCUS report begins with knowing what data needs to be reported, where the data is located and how the data will be presented in the report. The user needs to become familiar with the basic structure of a FOCUS program, also known as a focexec, as well as the syntax used in writing the program.
|FRS MASTER FILES (Data Files)|
The FRS system is updated nightly with new information from the day's activities. This updated data is also fed to focus files called Focus "Shadow" files. These shadow files, more commonly referred to as the Master files, are a duplicate of the information found in FRS and are used for FOCUS report writing. A user cannot go directly against FRS to write a Focus report, but will instead use the Focus Master files for all their FRS reporting needs.
The focus master files are numerous. There are files that contain information on general and subsidiary ledger account attributes, transaction data, vendor and voucher information, purchasing records, fixed asset information, account balances and budgets to name just a few. In most instances, each fiscal year will have its own set of these focus data files. Knowing which focus master file contains the information that is needed for the report is the first step in writing a focus report. Most times data can be taken from one focus data file to create a report, but there are situations when the information must be extracted from more than one focus master file and will require a bit more programming expertise to produce the desired results.
|STRUCTURE OF AN FRS MASTER FILE|
The FRS focus master files are organized in a particular manner. Each master file has its own set of field descriptions associated with it. These field descriptions are kept in what is called a master file description (mfd) or master. Each MFD table is associated with a specific set of FRS data and a specific fiscal year. For instance, current year data for subsidiary ledger account attributes are kept in the D9530F15 mfd and data for the 1995 year would be found in the D9595F15 file. General ledger account attributes are kept in D9530F14 mfd and data for 1997 in D9597F14.
The fields found in each master are presented by fieldname, alias, format and type. The fieldname and alias represent the same field; it is just a different way of referring to the field. The format tells the size of the field or maximum number of characters that makes up the field as well as whether it is alphanumeric, an integer, decimal, etc. Not all fields will have a field type associated with it. Generally, the field type is available if the field is an indexed field. Indexed fields will have a field type of "I" and allow the user to easily link to other focus master files that may have the same indexed field. A Focus user's manual will describe in detail the various formats available. These fields are used to write focus programs that create the focus report. The field references do not change from one year's master file to the next, only the data contained in each field will change dependent upon the year.
Click HERE for a complete listing of all the FRS Focus master file descriptions, the fields found in them and an explanation of the naming convention used for current and prior years.
|WRITING FOCUS PROGRAMS|
Once a user is in the focus environment and at the command caret (>) a new program can be written. Remember, it is at the caret (>) that the user actually executes the focus program. It is now at the carat that a new program can be written. The user types the following command to begin composing the new program:
> TED program name
Where TED is the command "To edit" and program name is the name given by the user to identify the new focus program. So, for this example let's call the program name "Example". The following will then be typed at the carat:
> TED Example
This command brings up a screen that looks like:
Essentially, the user must write the focus program between the "Top of File" line and the "End of File" line. To do this they must place edit dashes before the "Top of Line" asterisks and use the CMS I command to insert additional lines. So, let's say we want to insert 8 lines. We would first type an E at the command arrow to put the edit dashes before the asterisks. Then we would place I8 on the edit dashes of the first line. Like this:
EXAMPLE FOCEXEC A1
=====* * * TOP OF FILE * * *
=====* * * END OF FILE * * *
then we would insert the lines using the following command:
=I 8==* * * TOP OF FILE * * *
This in turn will insert 8 blank lines where the program syntex can be placed. If the user needs more lines they just follow the same procedure on the last line that the blank lines are to follow. This is how it will look. The program syntax or code is placed next to the dashed lines.
Now let's try to actually write the syntax for the "EXAMPLE" focexec. Suppose you want to see a report on the following items for the subsidiary ledger accounts under your department code.
All this data may be taken from the Focus shadow file, D9530F15, which contains the descriptive attributes of subsidiary ledger accounts. So, we have satisfied the first two requirements for writing a focexec; the what & where. We know what we want to report on and we know where it is located. Now, we need to present the data in a report.
The first part of our report should be a documentation section. It will basically give such information as the focexec name, purpose, who wrote it and any additional notes that may be useful to anybody that executes or edits the program in the future. We will use comment lines for any documentation that we do throughout the program. Comment lines are always preceded by a dash star (- *). The program ignores the -*, it is solely for the user's needs. So, here is how one might write the documentation section for this particular focexec:
The next step is to identify the fields from the D9530F15 file that correspond to the items that you want to appear in your report. If the fields cannot be found in the focus data file then you will have to define them in what is called the Define Table of the focexec. So, here are the corresponding field names for the information listed above:
Notice that the Fund Sid is two separate fields. We will need to define a field that will join these two fields into one to create the FUNDSID field in our report. This is where a Define File section is employed and will appear after our comment section. Here it is for the Example focexec:
=====DEFINE FILE D9530F15
=====FUNDSID/A7 =UC_OLD_FUND | UC_OLD_SID;
This first line says that we will be defining a new field not found in the D9530F15 file.
The second line defines the field, FUNDSID, as a 7-digit, alphanumeric value (A7). It is created by joining ( | ) the two fields FS19B, which has the format of A4, & FS19C with a format of A3. Each defined field must end with a semi-colon. Notice that we used the ALIAS for each field to define the new field FUNDSID.
The third line is the End statement and just indicates to the program that there are no other defined fields for the report.
Now that we have all the fields necessary to produce the report desired, the next step will be to have the focus program actually produce the report. This is done in the Table File section of the program. Therefore, the next lines that follow our Define File look something like this:
=====TABLE FILE D9530F15
====="SUBLEDGER ACCOUNTS FOR &DEPT </1"
=====GL_MAP_ACCOUNT AS ' MAP,CODE'
=====FUNDSID AS 'FUND ID'
=====ACCOUNT_DESC AS ' ACCOUNT, DESCRIPTION'
=====IF DEPARTMENT EQ &DEPT
The Table File line tells focus that you are ready to organize data in a report or table.
The next two lines center and print out the report heading. These lines are not always necessary especially if only a table is being created just to hold data.
PRINT is the verb that initiates the creation of the report. Each focus report or table that is created always needs one verb in its syntax.
The next 3 lines tell the program what needs to be printed out and how. The AS option allows the user to create column headings. It is not necessary to use this option when writing programs. The headings would just be the titles as they appear in the masterfile description.
The BY option is used for sorting. This particular report will sort by the account number.
The IF statement is considered a constraint. The report will produce results for the Department number (&DEPT) that the user enters at the program prompt.
All Focus reports conclude with the END statement
Now that the program is written, the user just types SAVE at the command line.
There are two ways that the new program can be executed. The first is to just type RUN at the command line after the program has been saved. Actually, typing RUN before the program is saved will also save what you have written. The second way is to return to a caret (>) after saving by hitting F3 and type EX program name. So, for the EXAMPLE focexec the user would hit F3 and at the caret type EX EXAMPLE. This second method is also used when you know a focexec already exists on your CMS account and you just want to run it without editing.
At this point the user can follow the instructions outlined under Running & Printing Focus Reports.
|EDITING FOCUS PROGRAMS|
Existing focus programs that reside on the user's CMS mainframe account can be edited by using the TED command. Once again the user needs to be in the focus environment and at the caret (>). They then type the command TED program name. For instance, if we wanted to edit the EXAMPLE focexec, the user would type the following at the caret:
|> TED EXAMPLE|
This will bring the focus program to the screen in the edit mode. It will be similar to writing focexecs except that the syntax is already provided. By typing the 'E' at the command line, the edit lines will be placed in front of each program line. Edit commands such as inserting lines, deleting lines, moving lines, etc. will work exactly the same as when you were writing a new program. After all changes have been made the user may SAVE the focus program or RUN it, which also saves the changes.
Once again the user may refer to the instructions given under Running & Printing Focus Reports.
|ACCIDENTALLY ERASING FOCUS PROGRAMS|
Users often accidentally erase focus programs from their FLIST. The way to retrieve them is as follows:
1. If you have NOT logged off of your CMS account and you are at the READY prompt, simply type "Use Tools" (without the quotes) and hit ENTER.
2. Then type GETBACK filename filetype A and hit ENTER.
If you have already logged off of your CMS account, contact UITS HELP DESK and they will restore your FLIST to where it was at the beginning of the day.
Return to Focus Main Menu
Return to FRS Main Menu
Last edited 10/26/09 CBM