Previous Topic: Sample JCL (Fixed-Format Records)Next Topic: Programming User Exits


Extracting Data (FEX)

Data collected by a query and stored using the EXTRACT command can be accessed by user application programs. By calling the Extract Interface (FEX), these user programs can access the extract data table created by the EXTRACT command. FEX handles both batch and online extracts.

Extracted data is stored in the DQF. Unlike Saved sets and Found sets, an extract extracts and stores data not pointers. Thus an extract can require a significant amount of space. If you plan to use the EXTRACT command, you should review the size of your DQF table. If you need to enlarge it, see DQF: Found Table for details.

Operation

By calling the Extract Interface (FEX), these user programs can access the extract data table created by the EXTRACT command. The Extract Interface handles both batch and online applications. In batch, it can be used by CA Datacom/DB Reporting Facility to create reports or sequential output tables. See CA Datacom/DB Reporting Facility documentation for further information on these reporting capabilities.

Procedure

Use a standard CALL statement to communicate with FEX. For each call, provide a place for the FEX to return a code set to indicate the result. Each call with a return code of zero puts the next logical row of the EXTRACT member in the data area you provide. The sequence is specified by the SORT statement of the original query. All six parameters are required and must be specified.

The format of the call is as follows:

COBOL

CALL 'DQFEXPR' USING parm1 parm2 ... parm6

FORTRAN

CALL DQFEXPR (parm1,parm2, ... parm6)

Assembler

CALL DQFEXPR,(parm1,parm2, ... parm6)

PL/I

CALL DQFEXPR,(parm1,parm2, ...parm6)

Parameters for FEX

The six parameters you must provide to the FEX are as follows:

WORK AREA

An 1100-byte area reserved for use by the FEX. Your program should initialize this area to blanks or binary zeros prior to the first request for an EXTRACT member, or when changing from one member to another before EOF is encountered on the first member. The program must not modify the work area between requests for the same member.

Set up the work area in working storage or in the linkage section of the program on a fullword boundary (a 01-level field for COBOL). If the program is online and reentrant, define the work area in a task-related storage area described in the program's linkage section.

MEMBER NAME

Names the eight-character field containing the member name of the EXTRACT member being accessed.

OPERATOR ID

Names the 32-character signon ID of the user who created the EXTRACT member being accessed.

PASSWORD

Refers to the nine-character password specified in the EXTRACT command. If a password was not specified, provide a blank field.

ROW LENGTH

Refers to a two-byte binary field containing the length of the logical rows in the EXTRACT member. See the section in this chapter on logical row format.

DATA AREA

Names the data area into which the FEX is to return EXTRACT member rows. You are responsible for correctly defining data values within this area. To avoid unpredictable results, ensure that this area is large enough to accept the logical rows passed from the FEX.

Return Codes

When the call to the FEX is completed, a code is returned to the calling program to indicate the results of the request. The program must interrogate the code each time to determine whether to continue. The return code is a two-byte character field located in the first two positions of the work area provided as the first parameter of the call.

Following are FEX return codes:

0

Good return - the data requested was successfully returned to the program.

4

Logical end of file - no more data exists for the requested EXTRACT member.

8

The requested EXTRACT member does not exist or the user ID (or password) is invalid.

12

An error was returned from CA Datacom/DB during a request to read the DQF (Found Table). The second two positions (bytes 3-4) of the work area contain the CA Datacom/DB return code.

16

Length error - the actual length of a logical row for the EXTRACT member specified exceeds the row length specified in the input parameter list.

Logical Row Format

EXTRACT member data rows are formatted as follows:

Implementing the FEX Online

To implement an online version of the FEX, write and link-edit the program just as you would any other CA Datacom/DB online program, with these additions:

Implementing the FEX in Batch

To implement a batch version, write and link-edit the program as you would any other batch CA Datacom/DB program, with these additions:

Note: For additional information about installing or using CA Datacom/DB programs, see the CA Datacom/DB Programming" Guide and the CA Datacom/DB Database and System Administration Guide.