This program reads a sequential file that contains employee-related information. As shown in the first figure, the INPUT parameter characterizes a sequential file that contains fixed-length 200-byte records. The input fields are defined in library member RRECS, which CA Culprit copies at run time; the second figure illustrates the contents of RRECS.
Parameters Coded for Example 1:
DATABASE DICTNAME=ASFDICT PROFILE USER=JFD PW=ROSEBUD IN 200 USE RRECS 01$ 01$ CREATE TABLE EMPLOYEE TABLE 01$ 01OUT TABLE='EMPLOYEE TABLE' TYPE=CREATE ONLINE=Y 0151*010 EMP-NAME SZ=25 IX=A 0151*020 STREET SZ=20 0151*030 CITY SZ=15 0151*040 STATE SZ=2 0151*050 ZIP-CODE SZ=5 0151*060 PHONE FM '999-999-9999' 0151*070 START-DATE FD 02$ 02$ REPLACE TABLE STATUS 02$ 02OUT TABLE=STATUS TYPE=REPLACE 020 DISABILITY ' ' 0251*010 EMP-NAME SZ=25 0251*020 TITLE SZ=20 0251*030 DISABILITY SZ=25 027 IF STATUS EQ '02' 300 027 IF STATUS EQ '03' 400 027 DROP 027300 MOVE 'SHORT-TERM DISABILITY' TO DISABILITY 027 TAKE 027400 MOVE 'LONG-TERM DISABILITY' TO DISABILITY 027 TAKE 03$ 03$ CREATE TABLE 'DEPARTMENT SALARIES' 03$ 03OUTPUT T TABLE='DEPARTMENT SALARIES' TYPE=CREATE CATALOG=TSTDICT * ONLINE=YES 03SORT DEPT-NAME,+ 0351*020 SALARY SZ=10 FP 0351*000 COUNT SZ=4 FP 0361*010 DEPT-NAME SZ=30 0361*020 SALARY SZ=10 FP 0361*030 COUNT SZ=4 FP 0361*040 AVERAGE SZ=10 FP 030 COUNT 1 030 AVERAGE DP=2 0 038010 LEVL EQ 2 DROP 038 SALARY DIVIDE COUNT AVERAGE
Input Field Definitions for Example 1:
REC EMP-ID 1 4 2 REC FIRST-NAME 5 10 REC LAST-NAME 15 15 REC EMP-NAME 5 25 'EMPLOYEE' 'NAME' REC STREET 30 20 'STREET' REC CITY 50 15 'CITY' REC STATE 65 2 'STATE' REC ZIP-CODE 67 5 'ZIP' REC PHONE 72 10 2 'PHONE' REC STATUS 82 2 'STATUS' REC SOC-SEC-NUM 84 9 2 'SOCIAL' 'SECURITY' 'NUMBER' REC START-DATE 93 6 2 'STARTING DATE' REC LEAVE-DATE 99 6 2 'LEAVING DATE' REC BIRTH-DATE 105 6 2 'BIRTHDAY' REC DEPT-ID 111 4 2 REC DEPT-NAME 115 45 REC SALARY 160 7 3 DP=2 REC JOB-ID 167 4 2 REC TITLE 171 20 'JOB TITLE'
The code that appears in the first figure generates three reports that create and populate two tables and replace information in a third. The code for each report is discussed separately below.
Report 01 specifies an OUTPUT parameter that instructs CA Culprit to create EMPLOYEE TABLE and define it to ASFDICT. Because the OUTPUT parameter includes ONLINE=Y, JFD and other authorized users can access and modify the information in EMPLOYEE TABLE online by using ASF.
As shown in the following figure, each row in EMPLOYEE TABLE contains the name, address, phone number, and hire date of a company employee. Column EMP-NAME specifies IX=A, which establishes an index for the table. The information stored in columns PHONE and START-DATE is formatted according to the options specified on the type 5 edit parameters. CA Culprit stores the formatted numeric values as text fields.
A Portion of Table EMPLOYEE TABLE:
EMP-NAME STREET CITY STATE ZIP-CODE PHONE START-DATE ELEANOR PEOPLES 756 YELLOWSTONE DR BOSTON MA 02834 617-329-1212 01/02/81 ALAN DONOVAN 6781 CORNWALL AVE MELROSE MA 02176 617-665-5412 10/10/81 ALBERT BREEZE 100 BOARDWALK OCEAN CITY NJ 03461 617-554-2387 06/02/79 BETH M. CLOUD 3456 PINKY LN NATICK MA 02178 617-432-1212 03/04/77 BETSY ZEDI 34 VALE AVE SOUTHBORO MA 03145 617-431-9909 02/23/76 BRIAN NICEMAN 60 FLORENCE AVE MELROSE MA 02176 617-665-4315 05/06/80 BURT LANCHESTER 45 PINKERTON AVE WALTHAM MA 01476 617-534-1109 02/03/75 CAROL MCDOUGALL 19 URITOP DR WELLESLEY MA 01568 617-887-1324 06/07/80 CAROLYN CROW 891 SUMMER ST WESTWOOD MA 02090 617-329-1776 06/17/79
Note: The column headings are the names of the input fields.
Table STATUS contains the names and titles of employees who are on short- or long-term disability. The OUTPUT parameter instructs CA Culprit to replace the information in the existing table with current data.
Because the OUTPUT parameter specifies REPLACE, the order, size, and format of the output fields must be the same as those specified when STATUS was created. The procedure logic for Report 02 determines the employee's status code; if the code is either 02 or 03, CA Culprit moves a literal to the DISABILITY field. The contents of the table appear in the following figure. No employees are on long-term disability and only one is on short-term disability.
Contents of Table STATUS:
EMP-NAME TITLE DISABILITY JACK KRAMER DATA ENTRY CLERK SHORT-TERM DISABILITY
Report 03 creates DEPARTMENT SALARIES, a totals-only table that summarizes the number of employees, total salary, and average salary for each department.
Contents of Table DEPARTMENT SALARIES:
DEPT-NAME SALARY COUNT AVERAGE ACCOUNTING AND PAYROLL 214,500.00 6 35,750.00 BLUE SKIES 158,250.00 3 52,750.00 BRAINSTORMING 262,000.00 5 52,400.00 COMPUTER OPERATIONS 234,750.00 9 26,083.33 EXECUTIVE ADMINISTRATION 510,000.00 4 127,500.00 INTERNAL SOFTWARE 390,500.00 10 39,050.00 MAIL ROOM 182,000.00 4 45,500.00 PERSONNEL 145,500.00 4 36,375.00 PUBLIC RELATIONS 226,000.00 6 37,666.67
The code that generated DEPARTMENT SALARIES is discussed below:
|
Copyright © 2014 CA.
All rights reserved.
|
|