Home › Mainframe Tutorial › Live project: Payroll batch job
Live project: Payroll batch job
Sort employee records by pay in one batch job.
Build a real batch job like those that run overnight in banks and companies.
What you will build
- A job stream with in-stream employee records
- A
SORTstep that orders them by pay - A printed report
Steps
- Read the records: each has a 10-character name and a 4-digit pay.
- Read the control statement:
SORT FIELDS=(11,4,CH,D)sorts the pay field in descending order. - Press Run to see the report.
- Change a pay value and run again.
Run it
On a real mainframe you submit this job and read the output in the job log. Here the page shows the expected report.
Challenge
- Sort by name instead.
- Add a second step that prints a heading.
Example code
//PAYJOB JOB (ACCT),'PAYROLL',CLASS=A,MSGCLASS=X
//SORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RAVI 0400
ASHA 0600
MEENA 0500
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(11,4,CH,D)
/*