Split Records per Page in Reports
Split Records per Page in Reports Example
Scenario - Create the report with data printing 4 records for page.
Input File - MATEPK.SORT.INPUT01 - FB file of 80 length
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 00001 student1 dept1 560 00003 student3 dept2 520 00004 student4 dept1 540 00005 student5 dept2 500 00002 student2 dept3 510 00006 student6 dept3 550 00008 student8 dept1 530 00007 student7 dept3 510 00009 student9 dept2 520 00010 student10 dept2 505
JCL -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//MATEPKD JOB (123),'MTH',NOTIFY=&SYSUID
//*
//STEP01 EXEC PGM=SORT
//SORTIN DD DSN=MATEPK.SORT.INPUT01,DISP=SHR
//OUTPUT1 DD DSN=MATEPK.SORT.OUTPT01,
// SPACE=(CYL,(1,1),RLSE),DCB=*.SORTIN,
// DISP=(NEW,CATLG,DELETE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,5,CH,A)
OUTFIL FNAMES=OUTPUT1,LINES=11,
HEADER2=(/,30:'printing Page',PAGE,53:' on ',58:DATE=(MD4-),4/),
OUTREC=(1,80)
/*
Output File - MATEPK.SORT.OUTPT01 - FB file of 80 length
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 printing Page 1 on 01-13-2017 00001 student1 dept1 560 00002 student2 dept3 510 00003 student3 dept2 520 00004 student4 dept1 540 printing Page 2 on 01-13-2017 00005 student5 dept2 500 00006 student6 dept3 550 00007 student7 dept3 510 00008 student8 dept1 530 printing Page 3 on 01-13-2017 00009 student9 dept2 520 00010 student10 dept2 505
Explaining Example -
- SORT FIELDS=(1,5,ZD,A) - Sort all outputs in ascending order based on the ZD value from 1 to 5 positions.
- OUTFIL FNAMES=OUTPUT1,LINES=11, - Prints 4 lines for page.
- HEADER2=(/,30:'printing Page',PAGE,53:' on ',58:DATE=(MD4-),4/) - Creates a page level header.
- OUTREC=(1,80) - Build the output record from input file of length 80.