Example 3 -- Employee Earning Potential

The input file to this program contains the job title, dates of employment, and salary level for past and present employees of the company. The input file also contains salary levels that correspond to each job title.
idmscu
The input file to this program contains the job title, dates of employment, and salary level for past and present employees of the company. The input file also contains salary levels that correspond to each job title.
The following figure shows the contents of the input file for the CA Culprit run. The input file contains a field that occurs four times; this multiply-occurring field contains the salary levels assigned to each job title.
 Record Size:        80 bytes  Block Size:       3600 bytes  Record Format:    Fixed  Data Field        Start Position    Length     Data Type  Employee ID           1               4        Zoned decimal  Starting date         6               6        Alphanumeric  Finish date          12               6        Alphanumeric  Salary level         18               2        Zoned decimal  Title                20              20        Alphanumeric  Number of positions  40               3        Zoned decimal  Available positions  43               3        Zoned decimal  Salary levels for    46               2        Zoned decimal   each job title                       (four times)
Input File Layout for the Employee Earning Potential Report:
This program performs the following functions:
  • Sorts the detail lines by job title.
  • Determines whether an employee is currently employed or was once employed with the specified job title.
  • Compares the employee's salary to possible salary levels. If the salary is not in error or at the highest level for the job, the program outputs future salary levels available to the employee.
The parameters coded for this report appear in H7 and are described below. The report output appears in H8.
Input Definition Parameters
Library member JOBRECS stores the input parameters for this report. CA Culprit copies these parameters into the parameter stream during the precompile phase. The run uses six of the nine input fields contained in JOBRECS. START-DATE, FINISH-DATE, and TITLE define alphanumeric fields; EMP-ID, SALARY, and the multiply-occurring field GRADE define zoned decimal fields.
Output Definition Parameters
Report 01 is a printed report that contains title lines, header lines, and detail lines; total lines are suppressed by the details-only specification on the OUTPUT parameter. Type 4 edit parameters specify literals in absolute column positions on three header lines; the third header line specifies a single blank, which generates a blank line between the header and detail lines for Report 01.
Report 01 specifies two detail lines. The first detail line contains the employee's identification number, job title, and salary. CA Culprit prints the identification number with leading zeros because the edit parameter specifies format code FN.
The second detail line contains the employee's start date, termination date (if any), a message that indicates the employee's salary status, and a work field indicating future salary levels.
The type 5 edit parameter that specifies EMP-ID also specifies a spacing code in column 10. CA Culprit outputs a blank line before each detail line 1 is printed.
Work Field Parameters
Report 01 specifies five work fields, as follows:
  • INDEX defines a numeric work field initialized to 1. INDEX is used as the subscript for GRADE, the multiply-occurring input field.
  • LDATE and SDATE define 6-byte alphanumeric fields that are initialized to blanks. In type 7 procedure logic, CA Culprit moves either the employee's termination date or a blank character string to LDATE. CA Culprit also moves either the employee's start date or a blank character string to SDATE.
  • MESSAGE defines a 20-byte alphanumeric field; the field is initialized to blanks. CA Culprit moves literal values to the field in type 7 procedure logic.
  • SALGRADE defines a numeric work field initialized to 0. CA Culprit moves values of the multiply-occurring field to SALGRADE in type 7 procedure logic.
Process Parameters
The type 7 procedure logic for Report 01 consists of three sections. The first section of logic determines the employee's employment status; CA Culprit compares FINISH-DATE to the literal '000000', which is the value assigned to active employees. If the employee is no longer active, CA Culprit moves 'PAST EMPLOYEE' to MESSAGE, FINISH-DATE to LDATE, and 0 to SALGRADE. CA Culprit then executes a TAKE, which extracts detail lines 1 and 2 for output. Otherwise, the procedure logic branches to the type 7 process statement that has sequence number 100.
In the second section of type 7 procedure logic, CA Culprit processes input records that contain data on active employees. CA Culprit reinitializes LDATE to blanks and compares the employee's salary level to one of four possible levels assigned to the employee's job title.
If the employee's salary is not equal to GRADE.INDEX, CA Culprit increments the value of INDEX by 1. If the value of INDEX is less than or equal to 4, CA Culprit branches to the process parameter that has sequence number 110. This loop continues until either SALARY equals GRADE.INDEX or the value of INDEX exceeds 4.
If the value of SALARY is equal to an occurrence of GRADE, the procedure logic branches to sequence number 400. Otherwise, the procedure logic branches to sequence number 300 once the value of INDEX exceeds 4. Starting with sequence number 300, CA Culprit moves an error message to MESSAGE, reinitializes INDEX and SALGRADE, and extracts detail lines 1 and 2 for output.
The third portion of type 7 procedure logic begins at sequence number 400. This portion of procedure logic processes input buffers of employees with a salary level equal to one of four possible levels for the employee's job title.
If the employee earns the highest amount possible for the job (that is, INDEX equals 4), CA Culprit moves 'AT HIGHEST LEVEL' to MESSAGE, reinitializes SALGRADE and INDEX, and executes a TAKE; otherwise, the procedure logic branches to sequence number 500. Beginning with sequence number 500, CA Culprit moves 'EARNING POTENTIAL' to MESSAGE, increments INDEX by 1, moves the value of GRADE.INDEX to SALGRADE, and releases detail lines 1 and 2 for extracting.
Following the RELS statement, CA Culprit deselects detail line 1 for extracting. The procedure logic moves blanks to SDATE and MESSAGE and branches to the type 7 parameter that has sequence number 510. Within this loop, CA Culprit increments the value of INDEX, compares its value to 4 (the number of occurrences of GRADE), and releases detail line 2 for extracting. Once the value of INDEX exceeds 4, the procedure logic branches to sequence number 600, where INDEX is reinitialized and the input buffer is dropped.
CA Culprit Parameters for Employee Earning Potential Report:
 mm/dd/yy                   SEQUENTIAL PARAMETER LISTING               Vnn.n  PAGE 1  00 ** SYSIN **                           USE JOBRECS  01 JOBRECS                                IN  80     INSTALLATION SECURITY OPTION IS NO                                             REC EMP-ID          1  4  2    'EMPLOYEE ID'                                             REC START-DATE      6  6       'START DATE'                                             REC FINISH-DATE    12  6       'TERMINATION' 'DATE'                                             REC SALARY         18  2  2                                             REC TITLE          20 20                                             REC NO-POSITIONS   40  3  2    'NUMBER' 'OF POSTIONS'                                             REC NO-OPEN        43  3  2    'NUMBER' 'POSITIONS OPEN'                                             REC SALARY-GRADE   46         GROUP AA 2.4                                             REC GRADE           1  2  2    ELMNT AA  00 ** SYSIN **                            01OUT   D                                             013EMPLOYEE EARNING POTENTIAL                                             01SORT TITLE                                             01410010 'EMPLOYEE ID'                                             01410035 'JOB TITLE'                                             01410057 'SALARY LEVEL'                                             01420015 'EMPLOYMENT DATES'                                             01420035 'JOB STATUS'                                             01430001 ' '                                             015100100EMP-ID      FN                                             01510035 TITLE                                             01510057 SALARY                                             01520015 SDATE       SZ=6                                             01520022 LDATE       SZ=6                                             01520035 MESSAGE     SZ=20                                             01520057 SALGRADE    SZ=2                                             010 INDEX  1 LDATE '      ' MESSAGE   '                    '                                            *    SALGRADE 0   SDATE '      '                                             017    MOVE START-DATE TO SDATE                                             017    FINISH-DATE EQ '000000'   100                                             017    MOVE FINISH-DATE TO LDATE                                             017    MOVE 'PAST EMPLOYEE ' TO MESSAGE                                             017    MOVE 0 TO SALGRADE                                             017    TAKE                                             017100 MOVE ' ' TO LDATE                                             017110 SALARY EQ GRADE.INDEX      400                                             017    INDEX ADD 1 INDEX                                             017    INDEX GT 4                 300                                             017    B 110                                             017300 MOVE 'CHECK SALARY LEVEL' TO MESSAGE                                             017    MOVE 0 TO SALGRADE                                             017    MOVE 1 TO INDEX                                             017    TAKE                                             017400 INDEX NE  4                 500                                             017    MOVE 'AT HIGHEST LEVEL' TO MESSAGE                                             017    MOVE 0 TO SALGRADE                                             017    MOVE 1 TO INDEX                                             017    TAKE                                             017500 MOVE 'EARNING POTENTIAL' TO MESSAGE                                             017510 INDEX + 1 INDEX                                             017    INDEX GT 4                   600                                             017    MOVE GRADE.INDEX TO SALGRADE                                             017    RELS                                             017    UNPICK 1                                             017    MOVE ' ' TO SDATE                                             017    MOVE ' ' TO MESSAGE                                             017    B 510                                             017600 MOVE 1 TO INDEX                                             017    DROP
Employee Earning Potential Output:
REPORT NO. 01               EMPLOYEE EARNING POTENTIAL               mm/dd/yy PAGE   1            EMPLOYEE ID              JOB TITLE             SALARY LEVEL                 EMPLOYMENT DATES    JOB STATUS            0106                     AR CLERK              12                 800816              EARNING POTENTIAL     14                                                           15            0049                     COMPUTER OPERATOR     21                 790929 810401       PAST EMPLOYEE            0371                     CUMULUS CARETAKER     53                 770304              EARNING POTENTIAL     55            0048                     DATA ENTRY CLERK      11                 820526 821103       PAST EMPLOYEE            0471                     DIR WEATHER           82                 820101              EARNING POTENTIAL     84            0035                     DOCUMENTATION SPEC    43                 800909              AT HIGHEST LEVEL            0015                     MGR BRAINSTORMING     72                 800102              EARNING POTENTIAL     75            0015                     MGR BRAINSTORMING     71                 780102 800101       PAST EMPLOYEE            0471                     MGR BRAINSTORMING     72                 780907 811231       PAST EMPLOYEE            0013                     MGR PERSONNEL         72                 810102              EARNING POTENTIAL     73                                                           75            0349                     MGR THERMOREGULATION  72                 791111              AT HIGHEST LEVEL            0119                     PHOTOGRAPHER          33                 771214              EARNING POTENTIAL     38                                                           39            0149                     PR WRITER             33                 770908              EARNING POTENTIAL     34            0030                     PRESIDENT             93                 731121              EARNING POTENTIAL     95            0023                     PROGRAMMER TRAINEE    43                 780504 790504       PAST EMPLOYEE            0021                     PROGRAMMER TRAINEE    21                 801221              EARNING POTENTIAL     41                                                           42                                                           43            0023                     PROGRAMMER/ANALYST    44