Week 3 - Validation Example
The Employeepf *FILE has data problems. Write a program that displays each record. The record should be validated according to the validation scheme below. All messages should be displayed when the screen is presented. Pressing enter will change the data in the database file and present the next record for display.
Be sure to copy Employeepf to your library so that you can change the data using the CPYF command or PDM option 15.
Employeepf has the following layout:
(use DSPFFD employeepf or RDP’s show in table fields option to fill in this table)
Field Description / Type / Size / COBOL Field-nameEmployee number / S / 5, 0 / Employee-number
Employee Name / A / 15 / Employee-name
Salary / P / 9, 0 / Salary
Address 1 / A / 30 / Address1
Address 2 / A / 30 / Address2
City / A / 20 / Employee-city
Province / A / 2 / Province-code
Postal code / A / 6 / Postal-code
Employee start date / L / Employee-start-date
Employee changed date / L / Employee-changed-date
The display file, EMPSCREEN’s SCREEN3 looks like this:
Add/Change PAYROLL DEPARTMENTEmployee number . . . 99999 DD/DD/DD
TT:TT:TT
Employee Name . . . . BBBBBBBBBBBBBBB UUUUUUUUUU
Name Must be entered
Employee Salary . . . 9,999,999- Salary Must be entered
Address 1 ...... BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
Address Must be entered
Province ...... BB OOOOOOOOOOOOOOOOOOOO
InvalidProvince Code
Postal Code . . . . . BBBBBB Invalid Postal Code
Employee Started. . . BBBBBBBBBB Invalid start date
Record Changed. . . . OOOOOOOOOO
Employee has notes
F3 = Exit F12 = Cancel
The screen buffers have the following layout:
EMPSCREEN-RECORD PIC X(105)
SCREEN3-I:
Field Description / Type / Size / COBOL Field-nameEmployee number / S / 5, 0 / Scr3-employee-number
Employee name / A / 15 / Scr3-employee-name
Salary / S / 7, 0 / Scr3-employee-salary
Address / A / 30 / Scr3-employee-address
Province / A / 2 / Scr3-province-code
Postal code / A / 6 / Scr3-postal-code
Start date / L / Scr3-start-date
SCREEN3-O:
Field Description / Type / Size / COBOL Field-nameEmployee number / S / 5, 0 / Scr3-employee-number
Employee name / A / 15 / Scr3-employee-name
Salary / S / 7, 0 / Scr3-employee-salary
Address / A / 30 / Scr3-employee-address
Province / A / 2 / Scr3-province-code
Postal code / A / 6 / Scr3-postal-code
Start date / L / Scr3-start-date
Province name / 20 / A / Scr3-province-name
Changed date / L / Scr3-changed-date
Validation rules:
Field / Rule / IndicatorSCR3-EMPLOYEE-NAME / Name must not be spaces / 97
SCR3-EMPLOYEE-SALARY / Salary must be greater than 0 / 96
SCR3-EMPLOYEE-ADDRESS / Address must not be spaces / 95
SCR3-PROVINCE-CODE / Province must not be spaces / 94
SCR3-POSTAL-CODE / 1st character must be alphabetic
2nd character must be numeric
… etc. / 93
SCR3-START-DATE / Invalid Start Date
Date must be greater than or equal to the system date. / 92