codegurukool.com · Free coding tutorials & online compiler

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

Steps

  1. Read the records: each has a 10-character name and a 4-digit pay.
  2. Read the control statement: SORT FIELDS=(11,4,CH,D) sorts the pay field in descending order.
  3. Press Run to see the report.
  4. 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

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)
/*

Run this code in the online editor

← Common abends