FOCUS - 1.1

Updated

Compatibility: v2 v3 Express
What's new? Release Notes
ID: com.castsoftware.focus

Description

If your Mainframe application contains FOCUS source code and you want to view these object types and their links with other objects, then you should install this extension.

The extension provides:

  • FOCUS procedures and their functions.
  • The calls between procedures, and to programs written in other languages.
  • The files that the requests access, the relational tables they access through their Master Files, and the SQL queries they run.
  • The IMS PCBs that the requests access through IMS Master Files.
  • Code metrics.

Download and installation instructions

The extension will be automatically downloaded and installed when any of the file types listed below are delivered in the source code. It can be managed through the Application → Extensions interface.

Supported file types

Code type Supported file extension Comments
FOCUS Procedures *.fex (case insensitive) 1 procedure per file.
FOCUS Master File Descriptions *.mas (case insensitive) Describe the data that the requests access (see Master Files). 1 Master File per data source that the procedures access, shared by all the procedures accessing it. Without it, the requests are not linked to that data.
FOCUS Access Files *.acx (case insensitive) Give the tables of a relational Master File (see Relational tables), or the PSB and PCB of an IMS Master File (see IMS databases). 1 .acx file per relational (Db2, …) or IMS Master File, named after it.
FOCUS FOCPSBs *.focpsb (case insensitive) Describe a PSB to FOCUS: the Master File of each PCB (see IMS databases). 1 .focpsb file per PSB that the procedures use, named after it. It uses this extension, not *.psb, which is the IMS PSB itself.

FOCUS databases (*.foc) are data, not code: they are not analyzed. Master Files, Access Files and FOCPSBs are read to find what the requests access. Access Files and FOCPSBs create no object. Master Files create no object either, except the Focus Entities of a relational Master File.

Supported languages

Scope Status
FOCUS for z/OS procedures: reporting (TABLE, TABLEF, MATCH, GRAPH, FILTER), MODIFY, MAINTAIN, DEFINE, JOIN, Dialogue Manager, SQL passthrough and SQL Translator ✅
WebFOCUS procedures: analyzed as FOCUS. The WebFOCUS-only parts (-HTMLFORM, StyleSheets, App Studio metadata) are not interpreted ⚠️

Transactions

Transaction support is derived from metamodel concepts used to build CAST Imaging Blueprint and structural transaction flows. Entry Points start transactions; Exit Points include both output/boundary concepts and Data Entities manipulated by transactions.

Role Support Breakdown
Entry Point No direct concept type details
Exit Point No direct concept type details

Data version: 1.1.0-beta1

ISO 5055 Structural Rules

Quality support is based on ISO 5055 structural rules available for the selected extension version.

Reliability Maintainability Security Performance Efficiency

Data version: 1.1.0-beta1

What results can you expect?

Procedures and requests

Each .fex file is a Focus Procedure: a program, which other technologies can call (see Calls to other languages).

Inside a procedure, only these commands create an object, attached to the procedure:

Command Object created Named after
DEFINE FUNCTION name (...) ... END Focus Function the function
SQL ..., ENGINE ... running a query Focus SQL Query the first four words of the query (see SQL queries)
a request or a command that reads or writes a file (a Master File describing a file, DATA ON, HOLD, CREATE FILE, -READ, -WRITE…) Focus File the DD of the file (see Files)
ON TABLE HOLD ... FORMAT DB2 (or SQLORA, SQLMSS…) Focus Entity, with its Focus Entity Operations the Master File that FOCUS generates (see Tables that a procedure creates)
a request on an IMS Master File (SUFFIX=IMS) Focus IMS Read PCB or Focus IMS Write PCB the PSB (see IMS databases)

A procedure gets only one Focus File per DD, one Focus Entity per generated Master File, and one Focus IMS PCB per PSB, position and kind (read or write). All of its requests share them.

The requests themselves (TABLE, TABLEF, MATCH, GRAPH, FILTER, MODIFY, MAINTAIN, DEFINE FILE, JOIN) create no object of their own. Their links start from the procedure, positioned on the request.

Calls between procedures

A procedure gets a call link to each analyzed procedure that it runs with EX name or EXEC name, or that it includes with -INCLUDE name. The procedure is found by its name, case insensitive: APP/NAME, IBFS:/WFC/Repository/.../name.fex and NAME.fex all give NAME.

A name held in an amper variable (EX &PROC, -INCLUDE &LIB) is computed from the Dialogue Manager commands that reach the call (-SET, -DEFAULT, -DEFAULTH, -READ, -IF, -GOTO, -REPEAT…). The call is linked to every analyzed procedure named by one of the values found. A value that depends on run-time input (a parameter with no default, a -READ) gives no link.

-* PAYROLL: run the monthly payroll
-INCLUDE PAYCOMMN
-SET &RPT = IF &MONTH EQ 12 THEN 'PAYYEAR' ELSE 'PAYRPT';
EX PAYCALC
EX &RPT MONTH=&MONTH

Here PAYROLL calls PAYCOMMN, PAYCALC, PAYYEAR and PAYRPT.

Calls to programs and functions

A call in an expression, name(...), is linked from the function that holds it, else from the procedure. FOCUS built-in functions (SUBSTR, EDIT, DECODE, …) are ignored. The call is resolved as follows:

  • DF.file.name(...) (or DF.app/file.name(...)): the function name defined in the procedure file.

  • name(...): a function stays defined for the session once it has run, so the analyzer looks for it in this order:

    1. the caller’s own procedure;
    2. the procedures that it runs with EX or -INCLUDE, and the ones those run;
    3. every analyzed procedure.

    When several functions are found at the same step, all of them are linked. A function never calls itself.

  • When no function is found, the analyzer assumes that name is a program written in another language (COBOL, PL/I, Assembler, C, REXX…): a Call to Generic Program object is created (see Calls to other languages). A DF. call that is not resolved creates nothing.

  • -TSO RUN name and -MVS RUN name always run a program: a Call to Generic Program.

For example, the procedure below calls the function NETPAY. It also calls CALCTAX: if no function named CALCTAX is analyzed, the analyzer assumes that it is a program:

DEFINE FUNCTION NETPAY (GROSS/D12.2, RATE/D6.2)
NETPAY/D12.2 = GROSS - GROSS * RATE / 100;
END
DEFINE FILE EMPLOYEE
NET/D12.2 = NETPAY(CURR_SAL, 20);
TAX/D12.2 = CALCTAX(CURR_SAL, NET, 'D12.2');
END
TABLE FILE EMPLOYEE
PRINT LAST_NAME NET TAX
END

The analyzer creates the Focus Function NETPAY and a Call to Generic Program CALCTAX, and links the procedure to both. The Universal Linker extension then links CALCTAX to the analyzed program of that name, whatever its language.

Data access

A procedure accesses data in two ways:

  • With FOCUS requests and commands (TABLE FILE, MODIFY, HOLD, -READ…). They name a Master File or a DD. The extension finds in the Master File what the data is (see Master Files): a file, relational tables or an IMS database. It creates an object for that data and links the procedure to it with a read or a write (see Supported commands).
  • With SQL statements (SQL, ENGINE). The statement names its tables itself. The extension creates a Focus SQL Query and links the procedure to it, and the SQL Analyzer links the query to the tables (see SQL queries). A statement for the FOCUS SQL Translator names Master Files instead of tables, which the extension replaces with tables first.
Kind of data (given by the Master File) Object created A read is A write is The object is then linked to
a file (see Files) a Focus File per DD, attached to the procedure an access read link to the Focus File an access write link to the Focus File the dataset of the JCL DD of the same name (see Calls to other languages)
relational tables (see Relational tables) a Focus Entity per segment, attached to the Master File, with a Focus Entity Operation per kind of access a call link to the operation Select a call link to the operations Insert, Update or Delete its table, by the SQL Analyzer
an IMS database (see IMS databases) a Focus IMS Read PCB or Write PCB per PSB and position, attached to the procedure a call link to the Read PCB a call link to the Write PCB the PCB of the PSB, by the Universal Linker

All the links start from the procedure, positioned on the command.

Master Files

A Master File (.mas) describes data. It is not code: a procedure never reads or writes it. A command names a Master File by its name, case insensitive: the name of the .mas file (its member name on z/OS). The FILENAME of a Master File usually repeats this name, but it does not have to. The analyzer accepts both names.

Several analyzed Master Files can have the same name, for example the same member in two libraries. A command then uses only the one closest to its procedure: the one that has the most folders in common with the procedure, then the one with the fewest folders of its own below them, then the first path in alphabetical order. Each Master File keeps its own objects, such as its Focus Entities. The same rule chooses the Access File of a Master File among the Access Files of its name, and the DYNAM ALLOC ... LONGNAME that gives a long Master File its DD.

The SUFFIX of the Master File gives the kind of data it describes:

SUFFIX The Master File describes
FIX (also when there is no SUFFIX), COM, COMMA, COMT, TAB, TABT, DFIX, VSAM, PRIVATE, FOC, XFOCUS (or XFOC) a file
DB2, SQL... (SQLORA, SQLMSS, SQLEXA, …) relational tables
IMS an IMS database, through one PCB
any other (IDMS, ADBSIN, …) another data source: nothing is created

Two other kinds of files complete a Master File. Neither creates an object:

  • the Access File (.acx), of the same name: the tables of a relational Master File, or the PSB and PCB of an IMS Master File;
  • the FOCPSB (.focpsb): the Master File of each PCB of a PSB.

When no analyzed Master File has the name that a command uses, the command is not linked, and the analysis log lists these names in a warning. Three names are no analyzed Master File but are still linked, with no warning:

  • a HOLD file of the command’s own procedure: the command reads that file (see Files). Its Master File is only generated at run time.
  • the table that a HOLD ... FORMAT DB2 of the command’s own procedure creates: the command calls the operations of its Focus Entity (see Tables that a procedure creates).
  • the CONCATNAME of a FOCPSB: the command accesses the PCB of each Master File that it concatenates (see IMS databases).

A delivered Master File of the same name wins over a HOLD file or a HOLD ... FORMAT DB2 table.

Supported commands

The FOCUS requests and commands that read or write data:

Command Access Kinds of data
a TABLE, TABLEF, MATCH, FILTER or GRAPH request, a FILE name line read all
DB_LOOKUP(name, ...) in a DEFINE or a COMPUTE read all
the Dialogue Manager command -READFILE name read all
a MODIFY or MAINTAIN request write: on tables, Insert, Update or Delete after the actions of the request all; on IMS, only with WRITE=YES in the Access File
CREATE FILE name [DROP] write: on tables, Delete a FOCUS database (FOC, XFOCUS); tables only with DROP
DATA ON ddname, FIXFORM ON ddname (the transactions of a MODIFY) read the file of the DD
the Dialogue Manager command -READ ddname read the file of the DD
the Dialogue Manager command -WRITE ddname write the file of the DD
FILE name at the end of an SQL Translator request (see SQL Translator) write the file name, else HOLD
saves a report with ON TABLE HOLD, SAVE or SAVB, field HOLD, a HOLD, SAVE or SAVB command after the report, or AFTER MATCH HOLD; or runs a MATCH FILE request, which writes HOLD write the file named after the AS name, else HOLD, SAVE or SAVB; tables with FORMAT DB2 (see Tables that a procedure creates)

SQL statements are described in SQL queries: the SQL Analyzer, not the extension, decides what they read and write.

A FILE name line is the next file of a MATCH FILE a ... RUN FILE b, or of a TABLE ... MORE FILE b.

A HOLD with a relational output format (FORMAT DB2, FORMAT SQLORA…) creates a table, not a file, while FORMAT SQL_SCRIPT writes a file. PCHOLD and HOLD AT CLIENT write no file.

A DEFINE FILE request accesses no data, and a JOIN only declares a structure: neither creates a link. CREATE FILE on a sequential or VSAM file creates no link: it is only documented for FOCUS databases and tables.

Files

A Focus File is a file that a procedure reads or writes: the data of a Master File describing a file, or a DD. It is attached to that procedure, which gets one Focus File per name. On z/OS, a file is allocated under a DD: the Focus File is named after this DD.

The DD of a Master File’s data is the name of the Master File, its .mas file name, not its FILENAME. The FILENAME may differ and be longer than the 8 characters of a DD name. For example, the Master File SALTRAN.mas below is read by TABLE FILE SALTRAN: its Focus File is SALTRAN, the DD of the data.

FILENAME=SALARY_TRANSACTIONS, SUFFIX=FIX, $
SEGNAME=TRANS, SEGTYPE=S0, $
FIELDNAME=EMP_ID, ALIAS=EID, USAGE=A9, ACTUAL=A9, $

A long Master File ($ VIRT=long_name) is allocated with DYNAM ALLOC DD ddname LONGNAME long_name, in FOCUS or as a Dialogue Manager -DYNAM. Its Focus File is named after that ddname. Without such a command in the analyzed files, it keeps its long name, and the analysis log lists it in a warning.

For example, with the Master File EMPLOYEE.MAS below, the procedure reads the file EMPLOYEE, writes SALTEMP, then reads SALTEMP and writes the file SALHIST. SALHIST is described by another Master File with SUFFIX=FOC:

FILENAME=EMPLOYEE, SUFFIX=FIX, $
SEGNAME=EMPINFO, SEGTYPE=S0, $
FIELDNAME=EMP_ID, ALIAS=EID, USAGE=A9, ACTUAL=A9, $
FIELDNAME=CURR_SAL, ALIAS=CSAL, USAGE=D12.2, ACTUAL=A12, $
TABLE FILE EMPLOYEE
PRINT EMP_ID CURR_SAL
ON TABLE HOLD AS SALTEMP
END
MODIFY FILE SALHIST
FIXFORM FROM SALTEMP
MATCH EMP_ID
ON MATCH UPDATE CURR_SAL
ON NOMATCH INCLUDE
DATA ON SALTEMP
END

Assume that this procedure is SALUPD.fex, that a JCL step runs it (EX SALUPD) with the DDs EMPLOYEE, SALTEMP and SALHIST on the data sets PROD.HR.EMPLOYEE, PROD.PAY.SALTEMP and PROD.PAY.SALHIST, and that a COBOL program of an earlier step writes PROD.HR.EMPLOYEE. The analysis then gives:

The data set PROD.HR.EMPLOYEE connects the COBOL program that writes the data and the FOCUS procedure that reads it. The links from the Focus Files to the data sets are created by the Universal Linker, and the data sets by the Mainframe Analyzer.

Relational tables

A relational Master File (SUFFIX=DB2, SQL...) describes tables: each of its segments is on a table. The extension models them as entities, as is done for the ORM frameworks:

  • a Focus Entity for each segment (SEGNAME) that a command accesses, attached to the Master File;
  • a Focus Entity Operation for each kind of access to the segment: Select, Insert, Update or Delete, attached to the entity.

A command that reads (see Supported commands) calls the operation Select. A command that writes calls:

  • a MODIFY or MAINTAIN request: one operation for each action of the request: Insert for INCLUDE, Update for UPDATE, Delete for DELETE, Insert and Update for REVISE. A request that names no action inserts, as a MODIFY loading data with FIXFORM ... DATA does.
  • CREATE FILE name DROP: Delete on every segment: each table is dropped and created again. Without DROP, an existing table is kept and no row is accessed: no operation.

A command calls the operations of the segments whose fields it uses, by name or alias, and of every segment of the Master File when it uses none. A DB_LOOKUP uses its lookup and return fields.

The table of each segment is given by the Access File (.acx), which has the same name as the Master File: its TABLENAME, with its CREATOR when there is one. The entity holds that table name, and so does each of its operations. The SQL Analyzer extension then links each operation to its table: a select link for Select, an insert link for Insert, and so on. When no analyzed DDL declares the table, it creates a Focus Missing Table for it instead, and links the operation to it the same way.

For example, with the Master File EMPDB2.mas and its Access File EMPDB2.acx:

FILENAME=EMPDB2, SUFFIX=DB2, $
SEGNAME=DEPTINFO, SEGTYPE=S0, $
FIELDNAME=DEPT_ID, ALIAS=DID, USAGE=A4, ACTUAL=A4, $
FIELDNAME=DEPT_NAME, ALIAS=DNAME, USAGE=A20, ACTUAL=A20, $
SEGNAME=EMPINFO, SEGTYPE=S0, PARENT=DEPTINFO, $
FIELDNAME=EMP_ID, ALIAS=EID, USAGE=A9, ACTUAL=A9, $
FIELDNAME=LAST_NAME, ALIAS=LNAME, USAGE=A20, ACTUAL=A20, $
SEGNAME=DEPTINFO, TABLENAME=HR.DEPARTMENT, CONNECTION=DB2P, $
SEGNAME=EMPINFO, TABLENAME=HR.EMPLOYEE, CONNECTION=DB2P, $

the request below calls the operations Select of the entities DEPTINFO (table HR.DEPARTMENT) and EMPINFO (table HR.EMPLOYEE):

TABLE FILE EMPDB2
PRINT LAST_NAME
BY DEPT_NAME
END

Assume that this request is in the procedure EMPLIST.fex, and that an analyzed SQL script creates the tables HR.DEPARTMENT and HR.EMPLOYEE. The analysis then gives:

When the Access File of a relational Master File is not delivered, its tables are not known. The entities and their operations are created with no table name and are not linked to any table. The analysis log lists these Master Files in a warning.

Tables that a procedure creates

ON TABLE HOLD AS name FORMAT DB2 (or FORMAT SQLORA, SQLMSS…) creates a table from the report output and inserts its rows. FOCUS also generates, at run time, a Master File and an Access File for it, named after the last part of the AS name. The extension creates a Focus Entity for this table, named after that Master File and attached to the procedure, since no .mas file declares it. The table is the AS name (HOLD without AS), or the TABLENAME given in the command:

  • the HOLD calls the operation Insert of the entity;
  • a later command of the same procedure that names the generated Master File calls its operations, as on any relational Master File. A delivered Master File of the same name wins.
TABLE FILE EMPLOYEE
PRINT LAST_NAME CURR_SAL
BY EMP_ID
ON TABLE HOLD AS HR.EMPRAISE FORMAT DB2
END
TABLE FILE EMPRAISE
SUM CURR_SAL
END

Here the procedure calls the operations Insert and Select of the entity EMPRAISE (table HR.EMPRAISE).

IMS databases

A procedure reads or writes an IMS database through a Master File with SUFFIX=IMS. The example below shows how the extension goes from the command to the database, then the rules it follows.

From the command to the database: an example
  1. The command. The procedure EMPRPT.fex reads the Master File EMPIMS:

    TABLE FILE EMPIMS
    PRINT LAST_NAME
    END
    
  2. The Master File EMPIMS.mas says that the data is in IMS (SUFFIX=IMS), but not where:

    FILENAME=EMPIMS, SUFFIX=IMS, $
    SEGNAME=EMPL, SEGTYPE=S1, $
    FIELDNAME=EMP_ID, ALIAS=EMPNO.KEY, USAGE=A9, ACTUAL=A9, $
    FIELDNAME=LAST_NAME, ALIAS=LNAME, USAGE=A15, ACTUAL=A15, $
    
  3. The FOCPSB RPTPSB.focpsb says where. It is named after the PSB RPTPSB, the list of the databases that the job may access (IMS calls each entry of this list a PCB). Its records list the Master File of each entry, in order. The TERM record is not a database and is not counted, so EMPIMS is the first database entry:

    PCBNAME=,PCBTYPE=TERM,$
    PCBNAME=EMPIMS,PCBTYPE=DB,$
    
  4. What the extension creates: a Focus IMS Read PCB named RPTPSB, and a call link to it from the EMPRPT procedure.

  5. The link to IMS. The Mainframe Analyzer creates the entries of the PSB from RPTPSB.psb. The Universal Linker links the Read PCB to the entry at the same position.

Assume that the PSB RPTPSB (.psb file) and the database EMPDBD (.dbd file) are analyzed too. The analysis then gives:

The rules
  • Reads and writes. A command that reads (see Supported commands) calls a Focus IMS Read PCB, a command that writes calls a Focus IMS Write PCB.
  • The Access File first. When the Access File of the Master File (.acx, same name) gives PSB=psbname, PCBNUMBER=n, $, it is used instead of a FOCPSB. Only an Access File with WRITE=YES lets a procedure write.
  • Several FOCPSBs. The FOCPSB that a job uses is only known when the job runs: every analyzed FOCPSB that lists the Master File gives a PCB.
  • SKIP records of a FOCPSB are counted, TERM records are not.
  • Groups. CONCATNAME=name, USE=master1/master2/..., $ in a FOCPSB groups several Master Files: a command that names the group accesses the PCB of each of them.
  • Positions. A PCB object is positioned on the first command that accesses it, on the record that gives the PCB (the PCBNAME= record of the FOCPSB, or the PSB= line of the Access File), and on the declaration of the Master File in its .mas.
  • Nothing found. When neither file gives the PCB, the commands on the Master File are not linked, and the analysis log lists the Master File in a warning.

SQL queries

A procedure can also run SQL statements itself, instead of naming a Master File. For each statement that is a query (SELECT, INSERT, UPDATE, DELETE, MERGE or WITH), the extension:

  • creates a Focus SQL Query, attached to the procedure. Its SQL text is the statement up to its ; (or up to the END of the request), without the comments. It is named after the first four words of this text;
  • links the procedure to the query with a call link, positioned on the request.

The other statements (SET, COMMIT, …) create nothing.

The procedure has this call link whatever the statement does: whether it reads or writes is not decided by the extension. The SQL Analyzer extension then reads the SQL text of each query. It links the query to the tables, views and procedures that the text uses, when they are analyzed too (from a DDL script, for example), with a link that depends on the statement (a select, an insert, an update or a delete). It also computes its SQL quality rules on the query.

When a table or a view that the text uses is not found in the analyzed DDL, the SQL Analyzer creates a Focus Missing Table for it, and links the query to it as it would to the table. Likewise, it creates a Focus Missing Procedure for a procedure or a function that the text calls. Both are attached to a Focus Missing Schema, attached to the FOCUS project (see Objects). The SQL Analyzer does the same for the table of a Focus Entity Operation (see Relational tables).

Where the statement is sent decides which table names its SQL text holds: the database receives it as written (SQL passthrough), while the FOCUS SQL Translator receives Master File names, which the extension replaces with tables (SQL Translator).

SQL passthrough

These requests send their statement to the database engine (DB2, SQLORA, SQLMSS, …) as written, with PREPARE name FOR before it or not:

  • SQL engine statement ; END;
  • ENGINE engine statement ; END;
  • SQL statement ; END, with no engine, after a SET SQLENGINE = engine of the procedure (SET SQLENGINE = OFF does not count).

The query keeps the SQL text as written: its table names are the names of the database.

SQL DB2 PREPARE SQLOUT FOR
SELECT EMPNO, LASTNAME FROM DSN8C10.EMP WHERE WORKDEPT = 'E21' ;
END
TABLE FILE SQLOUT
PRINT *
END

Here the procedure gets the Focus SQL Query SELECT EMPNO, LASTNAME FROM, which the SQL Analyzer links to the table DSN8C10.EMP. PREPARE SQLOUT FOR keeps the answer of the query under the name SQLOUT, which the TABLE FILE SQLOUT request reads: that request reads no data of its own and is not linked. Without PREPARE, the answer of a query is also named SQLOUT.

SQL Translator

A SQL statement ; END with no engine, and with no SET SQLENGINE earlier in the procedure, goes to the FOCUS SQL Translator. Its table names, after FROM, JOIN, INTO and UPDATE, are Master File names, which the database does not know. The extension resolves each name before it creates the query:

  • A relational Master File: the name is replaced with the tables that the statement uses: the tables of the segments whose fields it names (by name or alias), else all the tables of the Master File. The tables come from the Access File (see Relational tables). When the Access File is not delivered, the name is replaced with {} and the query is marked as incomplete: the SQL Analyzer computes no quality rule on it. Besides its request, the query is also positioned on the declaration of each of these Master Files, in their .mas.
  • A Master File describing a file: the procedure is linked to the Focus File, as by a report: an access read link for a SELECT, an access write link otherwise. A statement that names no relational Master File creates no query.
  • A name that no analyzed Master File has: the name is kept as written. The engine may be set in a profile, and the statement then goes to the database as written.

FILE name after the statement (SQL statement ; FILE name END) saves the FOCUS request that the Translator makes from the statement to the file name (HOLD with no name): the procedure has an access write link to the Focus File name.

For example, with the Master File EMPDB2 of Relational tables:

SQL
SELECT LAST_NAME FROM EMPDB2 WHERE EMP_ID = '000010';
END

LAST_NAME and EMP_ID are fields of the segment EMPINFO, so the query is SELECT LAST_NAME FROM HR.EMPLOYEE WHERE EMP_ID = '000010', named SELECT LAST_NAME FROM HR.EMPLOYEE. The SQL Analyzer links it to the table HR.EMPLOYEE.

Calls to other languages

The Universal Linker extension links FOCUS to the other technologies:

  • FOCUS calling other languages: FOCUS procedures call user-written subroutines and programs written in other languages (COBOL, PL/I, Assembler, C, REXX, …). Each such call creates a Call to Generic Program object (see Calls to programs and functions). The Universal Linker links this object to the analyzed program of the same name, whatever its language.
  • Other languages calling FOCUS: a Focus Procedure is a program, so a call to a program of the same name from another technology is linked to it.
  • JCL running FOCUS: a JCL step that runs FOCUS (EXEC PGM=FOCUS, with EX name in its SYSIN) is linked to the procedure name. This needs Mainframe Analyzer 1.7.5 or later. Each Focus File of the procedure is then linked to the dataset of the step’s DD of the same name.

For example, the step REPORT below is linked to the procedure SALRPT, and the Focus File SALTRAN of SALRPT is linked to the dataset PROD.PAY.SALTRAN:

//REPORT   EXEC PGM=FOCUS
//MASTER   DD DSN=PROD.FOCUS.MASTER,DISP=SHR
//FOCEXEC  DD DSN=PROD.FOCUS.FOCEXEC,DISP=SHR
//SALTRAN  DD DSN=PROD.PAY.SALTRAN,DISP=SHR
//SYSIN    DD *
EX SALRPT
FIN
/*

For example, the procedure below calls the program CALCTAX and runs the program PAYEXTR. Each one is linked to the analyzed program of that name, for example a COBOL CALCTAX and a PL/I PAYEXTR:

-SET &TAX = CALCTAX(&SALARY, 'D12.2');
-TSO RUN PAYEXTR, &MONTH

Metrics

The extension computes these metrics for each Focus Procedure, Function and SQL Query:

  • Code lines: the lines that hold FOCUS code, blank lines and comment-only lines excluded. A procedure counts all the lines of its file, except the lines of its functions, which each have their own count.
  • Comment lines before the object: for a function or an SQL query, the comments (-*, /* ... */) directly before it. A procedure has none.
  • Comment lines in the object: the other comments of the object, with these exceptions:
    • For a procedure, the comments of its functions, and the comments directly before them, are not counted.
    • In the comment at the top of a procedure’s file, the banner lines that hold no letter (-*********, -*-------) are not counted.

It also computes the cyclomatic complexity of each Focus Procedure and Function: 1, plus 1 for each of these:

  • a Dialogue Manager -IF, and each ELSE IF of it;
  • a -REPEAT;
  • an IF of an IF ... THEN ... ELSE expression, in a DEFINE, a COMPUTE, a function or a -SET.

The IF and WHERE record selection tests of a request, -GOTO, DECODE, and the AND/OR of a condition are not counted. The complexity of a procedure does not include the complexity of its functions.

Objects

Type Object Name Creation rule
FOCUS reporting procedures Focus Procedure Created for each .fex file, named after the file.
CAST_Focus_Function Focus Function Created for each DEFINE FUNCTION name (...) ... END of a procedure.
CAST_Focus_SqlQuery Focus SQL Query Created for each SQL statement that a procedure runs with SQL [engine] ... or ENGINE engine ..., attached to the procedure.
CAST_Focus_File Focus File Created once per procedure for each file that it reads or writes, attached to it. The file is the data of a Master File describing a file (SUFFIX FIX (the default), COM, COMMA, COMT, TAB, TABT, DFIX, VSAM, PRIVATE, FOC or XFOCUS), named after the Master File, or a file named after its ddname (DATA ON, FIXFORM ON, HOLD, SAVE, SAVB, -READ, -WRITE).
CAST_Focus_Entity Focus Entity Created for each segment (SEGNAME) of a relational Master File (SUFFIX=DB2, SQL...) that a request accesses, attached to the Master File. It holds the table that the Access File gives the segment. Also created for the table that HOLD ... FORMAT DB2 (or SQL...) creates, attached to the procedure.
CAST_Focus_Entity_Operation Focus Entity Operation Created for each kind of access to the table of an entity by the requests (Select, Insert, Update or Delete), attached to the entity. It holds the table of the entity.
CAST_Focus_IMS_Read_PCB Focus IMS Read PCB Created once per procedure for each IMS PCB that its requests read through an IMS Master File (SUFFIX=IMS), attached to the procedure. It is named after the PSB and holds the position of the PCB, given by the Access File (PSB=, PCBNUMBER=) or by a FOCPSB (PCBNAME=).
CAST_Focus_IMS_Write_PCB Focus IMS Write PCB Created once per procedure for each IMS PCB that its MODIFY or MAINTAIN requests write through an IMS Master File whose Access File allows it (WRITE=YES), attached to the procedure. It is named after the PSB and holds the position of the PCB.
CAST_Focus_CalltoProgram Focus Call to Generic Program Created when a procedure or a function calls a program, in an expression (a name that is not a FOCUS built-in function or an analyzed function) or with -TSO RUN / -MVS RUN. There is one object per caller and program name, attached to the caller.
CAST_Focus_MissingTable_Schema Missing Schema Created by the SQL Analyzer as the parent of the missing tables and procedures, attached to the FOCUS project.
CAST_Focus_MissingTable_Table Missing Table Created by the SQL Analyzer for each table or view that a Focus SQL Query or a Focus Entity Operation uses and that no analyzed DDL declares, attached to the Missing Schema.
CAST_Focus_MissingTable_Procedure Missing Procedure Created by the SQL Analyzer for each procedure or function that a Focus SQL Query calls and that no analyzed DDL declares, attached to the Missing Schema.
Caller type Caller description Link Callee type Callee description Creation rule
FOCUS reporting procedures Focus Procedure accessRead Link CAST_Focus_File Focus File Created when a TABLE, TABLEF, MATCH, FILTER or GRAPH request, or a FILE name line (the next file of a MATCH or of a TABLE ... MORE), of the procedure names a Master File describing a file, or a HOLD file that the procedure writes. Also created when a MODIFY reads its transactions with DATA ON ddname or FIXFORM ON ddname, a DB_LOOKUP or a -READFILE names a Master File describing a file, a -READ reads a ddname, or an SQL Translator SELECT names a Master File describing a file.
FOCUS reporting procedures Focus Procedure accessWrite Link CAST_Focus_File Focus File Created when a MODIFY or MAINTAIN request of the procedure names a Master File describing a file, or an SQL Translator statement other than a SELECT names one. Also created when a report saves its output with HOLD, SAVE or SAVB, a MATCH FILE request writes HOLD, a CREATE FILE erases a FOCUS database, or a -WRITE writes a ddname.
FOCUS reporting procedures Focus Procedure call Link CAST_Focus_Entity_Operation Focus Entity Operation Created when a request of the procedure on a relational Master File runs the operation on the segment: Select for a report or a DB_LOOKUP, Insert, Update or Delete for the actions of a MODIFY or MAINTAIN, Delete for a CREATE FILE ... DROP. Also created when a HOLD ... FORMAT DB2 creates a table (Insert), and when a later request names its generated Master File.
FOCUS reporting procedures Focus Procedure call Link CAST_Focus_IMS_Read_PCB Focus IMS Read PCB Created when a request of the procedure reads an IMS Master File: a TABLE, TABLEF, MATCH, FILTER or GRAPH request, a FILE name line, a DB_LOOKUP or a -READFILE, or a request on the CONCATNAME of a FOCPSB.
FOCUS reporting procedures Focus Procedure call Link CAST_Focus_IMS_Write_PCB Focus IMS Write PCB Created when a MODIFY or MAINTAIN request of the procedure writes an IMS Master File whose Access File allows it (WRITE=YES).
FOCUS reporting procedures Focus Procedure call Link CAST_Focus_SqlQuery Focus SQL Query Created when the procedure runs an SQL statement.
FOCUS reporting procedures Focus Procedure call Link FOCUS reporting procedures Focus Procedure Created when the procedure runs another analyzed procedure with EX name, EXEC name or -INCLUDE name, the name being written or held in an amper variable that the analyzer resolves.
FOCUS reporting procedures Focus Procedure call Link CAST_Focus_Function Focus Function Created when the procedure calls a function in an expression, name(...) or DF.file.name(...), or uses a virtual field of a Master File that calls one.
FOCUS reporting procedures Focus Procedure call Link CAST_Focus_CalltoProgram Focus Call to Generic Program Created when the procedure calls, in an expression, a name that is not a FOCUS built-in function or an analyzed function, or uses a virtual field of a Master File that calls one. The procedure also calls the program of a -TSO RUN name or -MVS RUN name.
CAST_Focus_Function Focus Function call Link CAST_Focus_Function Focus Function Created when the function calls a function in an expression, name(...) or DF.file.name(...).
CAST_Focus_Function Focus Function call Link CAST_Focus_CalltoProgram Focus Call to Generic Program Created when the function calls, in an expression, a name that is not a FOCUS built-in function or an analyzed function.
Caller type Caller description Link Callee type Callee description Creation rule
CAST_Focus_SqlQuery Focus SQL Query useSelect, useInsert, useUpdate, useDelete Link SQL Table, SQL View SQL objects Created by the SQL Analyzer for each table or view that the SQL text of the query uses and that an analyzed DDL declares, the link depending on the statement: a select, an insert, an update or a delete.
CAST_Focus_SqlQuery Focus SQL Query useSelect, useInsert, useUpdate, useDelete Link CAST_Focus_MissingTable_Table Missing Table Created by the SQL Analyzer for each table or view that the SQL text of the query uses and that no analyzed DDL declares, the link depending on the statement.
CAST_Focus_SqlQuery Focus SQL Query call Link SQL Procedure, SQL Function SQL objects Created by the SQL Analyzer for each procedure or function that the SQL text of the query calls and that an analyzed DDL declares.
CAST_Focus_SqlQuery Focus SQL Query call Link CAST_Focus_MissingTable_Procedure Missing Procedure Created by the SQL Analyzer for each procedure or function that the SQL text of the query calls and that no analyzed DDL declares.
CAST_Focus_Entity_Operation Focus Entity Operation useSelect, useInsert, useUpdate, useDelete Link SQL Table, SQL View SQL objects Created by the SQL Analyzer when an analyzed DDL declares the table of the operation: a select link for Select, an insert link for Insert, an update link for Update, a delete link for Delete.
CAST_Focus_Entity_Operation Focus Entity Operation useSelect, useInsert, useUpdate, useDelete Link CAST_Focus_MissingTable_Table Missing Table Created by the SQL Analyzer when no analyzed DDL declares the table of the operation, the link depending on the operation as above.

Quality rules

Known limitations

The following common constructs are not supported yet:

  • Amper variables: a file or a program whose name is held in an amper variable (TABLE FILE &FILE, -TSO RUN &PGM) is not resolved. Only the procedures run or included by EX, EXEC and -INCLUDE are resolved (see Calls between procedures).
  • Functions: which definition a call reaches depends on what ran before it in the session. The analyzer resolves it statically (see Calls to programs and functions), and may link a call to several functions of the same name.
  • Master Files: only the Master Files describing a file, relational tables or an IMS database are supported (see Master Files). IDMS and the other data sources create no link.
  • IMS: the PSB that IMS SET PSB psbname selects in a procedure is ignored, and so are the secondary indexes (ALTPCBNAME, ALTPCBNUMBER) of an Access File. When several FOCPSBs have a record for a Master File, a request is linked to the PCB of each of them.
  • Datasets allocated by FOCUS: a Focus File is linked to a dataset only through the DD cards of the JCL step. A file that the procedure allocates itself (DYNAM ALLOC ... DS dataset, -TSO ALLOC) is not linked to its dataset.
  • Relational Master Files: a request is linked to the operations of the segments that it uses, not to the columns or the conditions of the request. A request that uses no field of a segment by name (COUNT *) calls the operations of every segment.