Previous Topic: Example 2—Creating Tables from Database RecordsNext Topic: Example 4—Consolidating Tables


Example 3—Generating Reports from a Table

In this example, CA Culprit uses EMPLOYEE TABLE, which was created in Example 1, as input. The output from this program includes a report that prints the contents of EMPLOYEE TABLE and a new table that contains a subset of the information contained in EMPLOYEE TABLE. The following figure lists the CA Culprit parameters coded for the program.

Parameters Coded for Example 3:

DATABASE DICTNAME=ASFDICT PROFILE USER=LHN PW=ROSEBUD INPUT TABLE='EMPLOYEE TABLE' TYPE=COPY VALIDATE=ALL 01$ 01$ OUTPUT TABLE EMPLOYEE TABLE 01$ 01OUT D 0151*010 EMP-NAME HF 0151*020 STREET HF 0151*030 CITY HF 0151*040 STATE HF 0151*050 PHONE HF 02$ 02$ CREATE MELROSE EMPLOYEES FROM EMPLOYEE TABLE 02$ 02OUTPUT TABLE='MELROSE EMPLOYEES' TYPE=CREATE ONLINE=YES 0251*010 EMP-NAME SZ=25 0251*020 STREET SZ=20 0251*030 PHONE SZ=12 027010 IF STATE NE 'MA' DROP 027 IF CITY NE 'MELROSE' DROP

The DATABASE parameter identifies ASFDICT as the dictionary that defines the table. The PROFILE parameter identifies the id and the password of the user who is accessing the table. The INPUT parameter instructs CA Culprit to access table EMPLOYEE TABLE. Since the INPUT parameter does not specify the owner of the table or the dictionary in which the table is defined, CA Culprit defaults to the user ID coded on the PROFILE parameter and the dictionary specified on the DATABASE parameter.

Report 01 prints all the columns of EMPLOYEE TABLE except for START-DATE. The type 5 edit parameters specify the column names as field names. Note that column PHONE is output as a formatted

Printed Contents of a Portion of Table EMPLOYEE TABLE:

EMP-NAME STREET CITY STATE PHONE ELEANOR PEOPLES 756 YELLOWSTONE DR BOSTON MA 617-329-1212 ALAN DONOVAN 6781 CORNWALL AVE MELROSE MA 617-665-5412 ALBERT BREEZE 100 BOARDWALK OCEAN CITY NJ 617-554-2387 BETH M. CLOUD 3456 PINKY LN NATICK MA 617-432-1212 BETSY ZEDI 34 VALE AVE SOUTHBORO MA 617-431-9909 BRIAN NICEMAN 60 FLORENCE AVE MELROSE MA 617-665-4315 BURT LANCHESTER 45 PINKERTON AVE WALTHAM MA 617-534-1109 CAROL MCDOUGALL 19 URITOP DR WELLESLEY MA 617-887-1324 CAROLYN CROW 891 SUMMER ST WESTWOOD MA 617-329-1776 CYNTHIA JOHNSON 17 MANIFESTO DR WALPOLE MA 617-777-8888 - - - - - - - - - - EDWARD HUTTON 781 CROSS ST M ELROSE MA 617-665-1010 - - - - - - - - - - RUPERT JENSON 999 HARVEY ST MELROSE MA 617-665-5556

Report 02 creates MELROSE EMPLOYEES, a table that contains the name, street address, and phone number of all employees who live in Melrose, MA. CA Culprit establishes LHN as the owner of MELROSE EMPLOYEES, which is defined to ASFDICT. The contents of table MELROSE EMPLOYEES

Contents of Table MELROSE EMPLOYEES:

EMP-NAME STREET PHONE ALAN DONOVAN 6781 CORNWALL A 617-665-5412 BRIAN NICEMAN 60 FLORENCE AVE 617-665-4315 DORIS KING 716 MORRIS ST 617-665-6161 EDWARD HUTTON 781 CROSS S T 617-665-1010 RUPERT JENSON 999 HARVEY ST 617-665-5556