You can write a user routine to provide records to the FOCUS report writer from any non-standard data source not directly describable to FOCUS using the Master File. FOCUS treats the record, which can come from any data source, exactly as if it came from a FOCUS data source. The user routine must be coded as a subroutine in FORTRAN, COBOL, BAL, or PL/I, and must pass data to the FOCUS calling program through arguments in the subroutine.
The user program is loaded automatically by the report writer and is identified by the file suffix, in the Master File. If, for example, the Master File contains:
FILE = ABC, SUFFIX = MYREAD
FOCUS will load and call the program MYREAD to obtain data whenever a TABLE, TABLEF, MATCH, or GRAPH command is issued against file ABC.
The record returned to FOCUS must correspond to a segment instance in the Master File. The layout of the fields must correspond to the ACTUAL formats specified.
The user program is responsible for determining which segment to pass to FOCUS if the Master File has more than one segment. FOCUS will traverse the hierarchy in a top-to-bottom, left-to-right sequence; if the user routine can anticipate which segment FOCUS expects, the number of rejected segments will decrease and retrieval efficiency will improve.
In FORTRAN, the subroutine MYREAD would be coded as follows:
SUBROUTINE MYREAD (LCHAR, BUF, OFFSET, RECTYP, NERRX, CSEG, REGI, NFIND, MATCH, IGNOR, NUMFLD, NUMLEV, CVT)
where:
OFFSET = IADDR (MYBUF) - IADDR (BUF)
On CMS, FOCUS looks for MYREAD TEXT on any accessed CMS minidisk. If MYREAD TEXT is not found, FOCUS next looks for member MYREAD within all TXTLIB files currently pointed at by a GLOBAL TXTLIB command.
On TSO, the MYREAD object code, and any other routine that it calls, must be link-edited into a load module in the load library with member name MYREAD. This load library can be allocated as ddname USERLIB or concatenated with the STEPLIB program library.
Information Builders |